1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 23:00:57 +00:00

[mobile] favourites: redesigned it.

This commit is contained in:
llj
2016-12-15 16:54:51 +08:00
parent f4eacae253
commit cffc0743d2
4 changed files with 43 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ define([
tagName: 'tr',
template: _.template($('#starred-file-item-tmpl').html()),
mobileTemplate: _.template($('#starred-file-item-mobile-tmpl').html()),
events: {
'click .unstar': 'removeShare'
@@ -26,7 +27,8 @@ define([
data['is_img'] = Common.imageCheck(data['file_name']);
data['encoded_path'] = Common.encodePath(data['path']);
this.$el.html(this.template(data));
var tmpl = $(window).width() >= 768 ? this.template : this.mobileTemplate;
this.$el.html(tmpl(data));
return this;
},

View File

@@ -14,6 +14,7 @@ define([
id: 'starred-file',
template: _.template($('#starred-file-tmpl').html()),
theadTemplate: _.template($('#starred-file-thead-tmpl').html()),
initialize: function() {
this.starredFiles = new StarredFilesCollection();
@@ -29,9 +30,10 @@ define([
reset: function() {
this.$tableBody.empty();
this.$loadingTip.hide();
this.starredFiles.each(this.addOne, this);
if (this.starredFiles.length) {
this.$emptyTip.hide();
this.renderThead();
this.starredFiles.each(this.addOne, this);
this.$table.show();
} else {
this.$emptyTip.show();
@@ -77,6 +79,10 @@ define([
});
},
renderThead: function() {
this.$('thead').html(this.theadTemplate());
},
show: function() {
$("#right-panel").html(this.$el);
this.showStarredFiles();