mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-17 22:47:59 +00:00
[mobile] favourites: redesigned it.
This commit is contained in:
parent
f4eacae253
commit
cffc0743d2
@ -1138,6 +1138,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
<script type="text/template" id="starred-file-thead-tmpl">
|
||||||
|
<tr>
|
||||||
|
<% if ($(window).width() >= 768) { %>
|
||||||
|
<th width="5%"></th>
|
||||||
|
<th width="40%">{% trans "File Name" %}</th>
|
||||||
|
<th width="32%">{% trans "Library" %}</th>
|
||||||
|
<th width="18%">{% trans "Last Update" %}</th>
|
||||||
|
<th width="5%"></th>
|
||||||
|
<% } else { %>
|
||||||
|
<th width="5%"></th>
|
||||||
|
<th width="90%">{% trans "File Name" %}</th>
|
||||||
|
<th width="5%"></th>
|
||||||
|
<% } %>
|
||||||
|
</tr>
|
||||||
|
</script>
|
||||||
<script type="text/template" id="starred-file-item-tmpl">
|
<script type="text/template" id="starred-file-item-tmpl">
|
||||||
<td class="alc"><img src="{{ MEDIA_URL }}img/file/<%= icon_path %>" alt="{% trans "icon" %}" /></td>
|
<td class="alc"><img src="{{ MEDIA_URL }}img/file/<%= icon_path %>" alt="{% trans "icon" %}" /></td>
|
||||||
<td>
|
<td>
|
||||||
@ -1153,6 +1168,23 @@
|
|||||||
<a href="#" class="sf2-icon-delete unstar op-icon vh" title="{% trans "Unstar" %}" aria-label="{% trans "Unstar" %}"></a>
|
<a href="#" class="sf2-icon-delete unstar op-icon vh" title="{% trans "Unstar" %}" aria-label="{% trans "Unstar" %}"></a>
|
||||||
</td>
|
</td>
|
||||||
</script>
|
</script>
|
||||||
|
<script type="text/template" id="starred-file-item-mobile-tmpl">
|
||||||
|
<td class="alc"><img src="{{ MEDIA_URL }}img/file/<%= icon_path %>" alt="{% trans "icon" %}" /></td>
|
||||||
|
<td>
|
||||||
|
<% if (is_img) { %>
|
||||||
|
<a class="img-name-link" href="{{ SITE_ROOT }}lib/<%= repo_id %>/file<%- encoded_path %>" target="_blank" data-mfp-src="{{ SITE_ROOT }}repo/<%= repo_id %>/raw<%- encoded_path %>"><%- file_name %></a>
|
||||||
|
<% } else { %>
|
||||||
|
<a href="{{ SITE_ROOT }}lib/<%= repo_id %>/file<%- encoded_path %>" target="_blank"><%- file_name %></a>
|
||||||
|
<% } %>
|
||||||
|
<br />
|
||||||
|
<span class="dirent-meta-info"><%- repo_name %></span>
|
||||||
|
<span class="dirent-meta-info"><%= mtime_relative %></span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="#" class="sf2-icon-delete unstar op-icon" title="{% trans "Unstar" %}" aria-label="{% trans "Unstar" %}"></a>
|
||||||
|
</td>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/template" id="my-repos-hd-tmpl">
|
<script type="text/template" id="my-repos-hd-tmpl">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -163,15 +163,7 @@
|
|||||||
<script type="text/template" id="starred-file-tmpl">
|
<script type="text/template" id="starred-file-tmpl">
|
||||||
<h3 class="hd">{% trans "Favorites" %}</h3>
|
<h3 class="hd">{% trans "Favorites" %}</h3>
|
||||||
<table class="hide">
|
<table class="hide">
|
||||||
<thead>
|
<thead></thead>
|
||||||
<tr>
|
|
||||||
<th width="5%"></th>
|
|
||||||
<th width="40%">{% trans "File Name" %}</th>
|
|
||||||
<th width="32%">{% trans "Library" %}</th>
|
|
||||||
<th width="18%">{% trans "Last Update" %}</th>
|
|
||||||
<th width="5%"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
</table>
|
</table>
|
||||||
<span class="loading-icon loading-tip"></span>
|
<span class="loading-icon loading-tip"></span>
|
||||||
|
@ -11,6 +11,7 @@ define([
|
|||||||
tagName: 'tr',
|
tagName: 'tr',
|
||||||
|
|
||||||
template: _.template($('#starred-file-item-tmpl').html()),
|
template: _.template($('#starred-file-item-tmpl').html()),
|
||||||
|
mobileTemplate: _.template($('#starred-file-item-mobile-tmpl').html()),
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .unstar': 'removeShare'
|
'click .unstar': 'removeShare'
|
||||||
@ -26,7 +27,8 @@ define([
|
|||||||
data['is_img'] = Common.imageCheck(data['file_name']);
|
data['is_img'] = Common.imageCheck(data['file_name']);
|
||||||
data['encoded_path'] = Common.encodePath(data['path']);
|
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;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ define([
|
|||||||
id: 'starred-file',
|
id: 'starred-file',
|
||||||
|
|
||||||
template: _.template($('#starred-file-tmpl').html()),
|
template: _.template($('#starred-file-tmpl').html()),
|
||||||
|
theadTemplate: _.template($('#starred-file-thead-tmpl').html()),
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.starredFiles = new StarredFilesCollection();
|
this.starredFiles = new StarredFilesCollection();
|
||||||
@ -29,9 +30,10 @@ define([
|
|||||||
reset: function() {
|
reset: function() {
|
||||||
this.$tableBody.empty();
|
this.$tableBody.empty();
|
||||||
this.$loadingTip.hide();
|
this.$loadingTip.hide();
|
||||||
this.starredFiles.each(this.addOne, this);
|
|
||||||
if (this.starredFiles.length) {
|
if (this.starredFiles.length) {
|
||||||
this.$emptyTip.hide();
|
this.$emptyTip.hide();
|
||||||
|
this.renderThead();
|
||||||
|
this.starredFiles.each(this.addOne, this);
|
||||||
this.$table.show();
|
this.$table.show();
|
||||||
} else {
|
} else {
|
||||||
this.$emptyTip.show();
|
this.$emptyTip.show();
|
||||||
@ -77,6 +79,10 @@ define([
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
renderThead: function() {
|
||||||
|
this.$('thead').html(this.theadTemplate());
|
||||||
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
$("#right-panel").html(this.$el);
|
$("#right-panel").html(this.$el);
|
||||||
this.showStarredFiles();
|
this.showStarredFiles();
|
||||||
|
Loading…
Reference in New Issue
Block a user