mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-02 07:47:32 +00:00
[mobile] favourites: redesigned it.
This commit is contained in:
parent
f4eacae253
commit
cffc0743d2
@ -1138,6 +1138,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</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">
|
||||
<td class="alc"><img src="{{ MEDIA_URL }}img/file/<%= icon_path %>" alt="{% trans "icon" %}" /></td>
|
||||
<td>
|
||||
@ -1153,6 +1168,23 @@
|
||||
<a href="#" class="sf2-icon-delete unstar op-icon vh" title="{% trans "Unstar" %}" aria-label="{% trans "Unstar" %}"></a>
|
||||
</td>
|
||||
</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">
|
||||
<tr>
|
||||
|
@ -163,15 +163,7 @@
|
||||
<script type="text/template" id="starred-file-tmpl">
|
||||
<h3 class="hd">{% trans "Favorites" %}</h3>
|
||||
<table class="hide">
|
||||
<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>
|
||||
<thead></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<span class="loading-icon loading-tip"></span>
|
||||
|
@ -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;
|
||||
},
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user