mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 02:42:47 +00:00
[mobile] redesigned 'libs list' UI for shared/org/groups/group
This commit is contained in:
@@ -86,6 +86,19 @@ define([
|
||||
|
||||
this.currentView = this.myReposView;
|
||||
|
||||
var _this = this;
|
||||
var originalWindowWidth = $(window).width();
|
||||
$(window).resize(function() {
|
||||
var curWidth = $(window).width();
|
||||
if (_this.currentView.reset) {
|
||||
if ((originalWindowWidth < 768 && curWidth >= 768 ) ||
|
||||
(originalWindowWidth >= 768 && curWidth < 768)) {
|
||||
_this.currentView.reset();
|
||||
}
|
||||
}
|
||||
originalWindowWidth = curWidth;
|
||||
});
|
||||
|
||||
$('#info-bar .close').click(Common.closeTopNoticeBar);
|
||||
$('#top-browser-tip-close').click(function () {
|
||||
$('#top-browser-tip').addClass('hide');
|
||||
|
@@ -11,6 +11,7 @@ define([
|
||||
|
||||
var GroupItemView = Backbone.View.extend({
|
||||
template: _.template($('#group-item-tmpl').html()),
|
||||
mobileTemplate: _.template($('#group-item-mobile-tmpl').html()),
|
||||
|
||||
events: {
|
||||
},
|
||||
@@ -19,7 +20,8 @@ define([
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template(this.model.attributes));
|
||||
var tmpl = $(window).width() >= 768 ? this.template : this.mobileTemplate;
|
||||
this.$el.html(tmpl(this.model.attributes));
|
||||
var repos = this.model.get('repos');
|
||||
if (repos.length) {
|
||||
this.renderRepoList(repos);
|
||||
@@ -27,7 +29,7 @@ define([
|
||||
return this;
|
||||
},
|
||||
|
||||
renderRepoList: function (repos) {
|
||||
renderRepoList: function(repos) {
|
||||
repos.sort(function(a, b) {
|
||||
return Common.compareTwoWord(a.name, b.name);
|
||||
});
|
||||
|
@@ -11,6 +11,7 @@ define([
|
||||
tagName: 'tr',
|
||||
|
||||
template: _.template($('#group-repo-tmpl').html()),
|
||||
mobileTemplate: _.template($('#group-repo-mobile-tmpl').html()),
|
||||
|
||||
events: {
|
||||
'click .cancel-share': 'unshare'
|
||||
@@ -34,6 +35,7 @@ define([
|
||||
var obj = this.model.toJSON();
|
||||
var icon_size = Common.isHiDPI() ? 96 : 24;
|
||||
var icon_url = this.model.getIconUrl(icon_size);
|
||||
var tmpl = $(window).width() >= 768 ? this.template : this.mobileTemplate;
|
||||
$.extend(obj, {
|
||||
group_id: this.group_id,
|
||||
is_staff: this.is_staff,
|
||||
@@ -45,7 +47,7 @@ define([
|
||||
icon_url: icon_url,
|
||||
icon_title: this.model.getIconTitle()
|
||||
});
|
||||
this.$el.html(this.template(obj));
|
||||
this.$el.html(tmpl(obj));
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@@ -19,6 +19,7 @@ define([
|
||||
template: _.template($('#group-tmpl').html()),
|
||||
groupTopTemplate: _.template($('#group-top-tmpl').html()),
|
||||
reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()),
|
||||
mobileReposHdTemplate: _.template($('#shared-repos-hd-mobile-tmpl').html()),
|
||||
|
||||
events: {
|
||||
'click #group-settings-icon': 'toggleSettingsPanel',
|
||||
@@ -56,7 +57,8 @@ define([
|
||||
},
|
||||
|
||||
renderReposHd: function() {
|
||||
this.$tableHead.html(this.reposHdTemplate());
|
||||
var tmpl = $(window).width() >= 768 ? this.reposHdTemplate : this.mobileReposHdTemplate;
|
||||
this.$tableHead.html(tmpl());
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
|
@@ -28,11 +28,6 @@ define([
|
||||
this.listenTo(this.repos, 'reset', this.reset);
|
||||
|
||||
this.render();
|
||||
|
||||
var _this = this;
|
||||
$(window).resize(function() {
|
||||
_this.reset();
|
||||
});
|
||||
},
|
||||
|
||||
addOne: function(repo, collection, options) {
|
||||
|
@@ -13,6 +13,7 @@ define([
|
||||
|
||||
template: _.template($('#repos-shared-to-me-tmpl').html()),
|
||||
reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()),
|
||||
mobileReposHdTemplate: _.template($('#shared-repos-hd-mobile-tmpl').html()),
|
||||
|
||||
initialize: function(options) {
|
||||
this.repos = new RepoCollection({type: 'shared'});
|
||||
@@ -31,7 +32,8 @@ define([
|
||||
},
|
||||
|
||||
renderReposHd: function() {
|
||||
this.$tableHead.html(this.reposHdTemplate());
|
||||
var tmpl = $(window).width() >= 768 ? this.reposHdTemplate : this.mobileReposHdTemplate;
|
||||
this.$tableHead.html(tmpl());
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
|
@@ -11,6 +11,7 @@ define([
|
||||
tagName: 'tr',
|
||||
|
||||
template: _.template($('#organization-repo-tmpl').html()),
|
||||
mobileTemplate: _.template($('#organization-repo-mobile-tmpl').html()),
|
||||
|
||||
initialize: function() {
|
||||
HLItemView.prototype.initialize.call(this);
|
||||
@@ -20,11 +21,12 @@ define([
|
||||
var obj = this.model.toJSON();
|
||||
var icon_size = Common.isHiDPI() ? 96 : 24;
|
||||
var icon_url = this.model.getIconUrl(icon_size);
|
||||
var tmpl = $(window).width() >= 768 ? this.template : this.mobileTemplate;
|
||||
_.extend(obj, {
|
||||
'icon_url': icon_url,
|
||||
'icon_title': this.model.getIconTitle()
|
||||
});
|
||||
this.$el.html(this.template(obj));
|
||||
this.$el.html(tmpl(obj));
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@@ -17,6 +17,7 @@ define([
|
||||
|
||||
template: _.template($('#organization-repos-tmpl').html()),
|
||||
reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()),
|
||||
mobileReposHdTemplate: _.template($('#shared-repos-hd-mobile-tmpl').html()),
|
||||
|
||||
initialize: function(options) {
|
||||
this.repos = new PubRepoCollection();
|
||||
@@ -77,7 +78,8 @@ define([
|
||||
},
|
||||
|
||||
renderReposHd: function() {
|
||||
this.$tableHead.html(this.reposHdTemplate());
|
||||
var tmpl = $(window).width() >= 768 ? this.reposHdTemplate : this.mobileReposHdTemplate;
|
||||
this.$tableHead.html(tmpl());
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
|
@@ -11,6 +11,7 @@ define([
|
||||
tagName: 'tr',
|
||||
|
||||
template: _.template($('#shared-repo-tmpl').html()),
|
||||
mobileTemplate: _.template($('#shared-repo-mobile-tmpl').html()),
|
||||
|
||||
events: {
|
||||
'click .unshare-btn': 'removeShare'
|
||||
@@ -48,11 +49,12 @@ define([
|
||||
var obj = this.model.toJSON();
|
||||
var icon_size = Common.isHiDPI() ? 96 : 24;
|
||||
var icon_url = this.model.getIconUrl(icon_size);
|
||||
var tmpl = $(window).width() >= 768 ? this.template : this.mobileTemplate;
|
||||
_.extend(obj, {
|
||||
'icon_url': icon_url,
|
||||
'icon_title': this.model.getIconTitle()
|
||||
});
|
||||
this.$el.html(this.template(obj));
|
||||
this.$el.html(tmpl(obj));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user