1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 21:07:17 +00:00

[mobile] my libs: redesigned it

This commit is contained in:
llj
2016-11-29 15:03:13 +08:00
parent 214fd20fbb
commit 7a9a89a7d1
6 changed files with 84 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ define([
template: _.template($('#my-own-repos-tmpl').html()),
reposHdTemplate: _.template($('#my-repos-hd-tmpl').html()),
mobileReposHdTemplate: _.template($('#my-repos-hd-mobile-tmpl').html()),
events: {
'click .repo-create': 'createRepo',
@@ -27,6 +28,11 @@ define([
this.listenTo(this.repos, 'reset', this.reset);
this.render();
var _this = this;
$(window).resize(function() {
_this.reset();
});
},
addOne: function(repo, collection, options) {
@@ -39,7 +45,8 @@ define([
},
renderReposHd: function() {
this.$tableHead.html(this.reposHdTemplate());
var tmpl = $(window).width() >= 768 ? this.reposHdTemplate : this.mobileReposHdTemplate;
this.$tableHead.html(tmpl());
},
reset: function() {

View File

@@ -19,6 +19,7 @@ define([
tagName: 'tr',
template: _.template($('#repo-tmpl').html()),
mobileTemplate: _.template($('#repo-mobile-tmpl').html()), // for extra small devices (phones, less than 768px)
renameTemplate: _.template($("#repo-rename-form-template").html()),
transferTemplate: _.template($('#repo-transfer-form-tmpl').html()),
@@ -43,16 +44,23 @@ define([
var obj = this.model.toJSON();
var icon_size = Common.isHiDPI() ? 96 : 24;
var icon_url = this.model.getIconUrl(icon_size);
var tmpl, dropdownOptions = {};
if ($(window).width() >= 768) {
tmpl = this.template;
} else {
tmpl = this.mobileTemplate;
dropdownOptions = {'right': 0};
}
_.extend(obj, {
'icon_url': icon_url,
'icon_title': this.model.getIconTitle(),
'can_generate_share_link': app.pageOptions.can_generate_share_link,
'can_generate_upload_link': app.pageOptions.can_generate_upload_link
});
this.$el.html(this.template(obj));
this.dropdown = new DropdownView({
this.$el.html(tmpl(obj));
this.dropdown = new DropdownView($.extend({
el: this.$('.sf-dropdown')
});
}, dropdownOptions));
return this;
},

View File

@@ -65,7 +65,7 @@ define([
var $toggle = this.$('.sf-dropdown-toggle');
var $menu = this.$('.sf-dropdown-menu');
app.ui.currentDropdown = this;
if (this.options.right) {
if (this.options.right != undefined) {
$menu.css('right', this.options.right);
} else {
$menu.css('left', this.options.left);

View File

@@ -51,7 +51,10 @@ define([
return;
}
app.ui.currentHighlightedItem = null;
this.$el.removeClass('hl').find(this.hiddenOperationClass).addClass('vh');
this.$el.removeClass('hl');
if ($(window).width() >= 768) {
this.$el.find(this.hiddenOperationClass).addClass('vh');
}
}
});