1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

[dirent details] improvement

This commit is contained in:
llj
2017-07-05 12:17:11 +08:00
parent 5d48dac96c
commit 3905f7b3ef
5 changed files with 51 additions and 14 deletions

View File

@@ -1074,6 +1074,10 @@ textarea:-moz-placeholder {/* for FF */
.details-panel { .details-panel {
width:320px; width:320px;
} }
.details-panel-item-name {
display:inline-block;
max-width:215px;
}
.details-panel-img-container { .details-panel-img-container {
text-align:center; text-align:center;
height:160px; height:160px;

View File

@@ -777,7 +777,7 @@
<a href="#" title="{% trans "Close" %}" aria-label="{% trans "Close" %}" class="sf-popover-close js-close sf2-icon-x1 op-icon fleft"></a> <a href="#" title="{% trans "Close" %}" aria-label="{% trans "Close" %}" class="sf-popover-close js-close sf2-icon-x1 op-icon fleft"></a>
<h3 class="right-side-panel-title"> <h3 class="right-side-panel-title">
<img src="<%= icon_url %>" width="24" alt="" class="vam" /> <img src="<%= icon_url %>" width="24" alt="" class="vam" />
<span class="vam"><%- dirent.obj_name %></span> <span class="vam ellipsis details-panel-item-name" title="<%- dirent.obj_name %>"><%- dirent.obj_name %></span>
</h3> </h3>
</div> </div>
<div class="right-side-panel-con"> <div class="right-side-panel-con">
@@ -791,31 +791,48 @@
</div> </div>
<div class="details-panel-text-info-container"> <div class="details-panel-text-info-container">
<% if (dirent.is_file) { %>
<table> <table>
<tr class="vh"> <tr class="vh">
<th width="35%"></th> <th width="35%"></th>
<td width="65%"></td> <td width="65%"></td>
</tr> </tr>
<% if (dirent.is_file) { %>
<tr> <tr>
<th>{% trans "Size" %}</th> <th>{% trans "Size" %}</th>
<td><%= dirent.file_size %></td> <td><%= dirent.file_size %></td>
</tr> </tr>
<% } else { %> <tr>
<th>{% trans "Location" %}</th>
<td><%- path %></td>
</tr>
<% if (dirent.last_modified) { %>
<tr>
<th>{% trans "Last Update" %}</th>
<td><%= dirent.last_update %></td>
</tr>
<% } %>
</table>
<% } else { %>
<p class="loading-icon loading-tip"></p>
<p class="error hide"></p>
<table class="hide">
<tr class="vh">
<th width="35%"></th>
<td width="65%"></td>
</tr>
<tr> <tr>
<th>{% trans "Folders" %}</th> <th>{% trans "Folders" %}</th>
<td class="dir-folder-counts"></td> <td class="dir-folder-counts"></td>
</tr> </tr>
<tr> <tr>
<th>{% trans "Files" %}</th> <th>{% trans "Files" %}</th>
<td class="dir-file-counts"><span class="loading-icon"></span></td> <td class="dir-file-counts"></td>
</tr> </tr>
<tr> <tr>
<th>{% trans "Size" %}</th> <th>{% trans "Size" %}</th>
<td class="dir-size"></td> <td class="dir-size"></td>
</tr> </tr>
<% } %>
<tr> <tr>
<th>{% trans "Location" %}</th> <th>{% trans "Location" %}</th>
@@ -828,8 +845,8 @@
</tr> </tr>
<% } %> <% } %>
</table> </table>
<% } %>
</div> </div>
</div> </div>
</script> </script>

View File

@@ -45,13 +45,15 @@ define([
}, },
update: function(part_data) { update: function(part_data) {
if (part_data.error) { var $container = this.$('.details-panel-text-info-container');
this.$('.dir-folder-counts, .dir-file-counts, .dir-size') $('.loading-icon', $container).hide();
.html('<span class="error">' + gettext("Error") + '</span>'); if (part_data.error_msg) {
$('.error', $container).html(part_data.error_msg).show();
} else { } else {
this.$('.dir-folder-counts').html(part_data.dir_count); this.$('.dir-folder-counts').html(part_data.dir_count);
this.$('.dir-file-counts').html(part_data.file_count); this.$('.dir-file-counts').html(part_data.file_count);
this.$('.dir-size').html(part_data.size); this.$('.dir-size').html(part_data.size);
$('table', $container).show();
} }
}, },

View File

@@ -323,8 +323,15 @@ define([
'size': Common.fileSizeFormat(data.size, 1) 'size': Common.fileSizeFormat(data.size, 1)
}); });
}, },
error: function() { error: function(xhr) {
detailsView.update({'error': true}); var error_msg;
if (xhr.responseText) {
var parsed_resp = $.parseJSON(xhr.responseText);
error_msg = parsed_resp.error_msg || parsed_resp.detail;
} else {
error_msg = gettext("Failed. Please check the network.");
}
detailsView.update({'error_msg': error_msg});
} }
}); });
} }

View File

@@ -605,8 +605,15 @@ define([
'size': Common.fileSizeFormat(data.size, 1) 'size': Common.fileSizeFormat(data.size, 1)
}); });
}, },
error: function() { error: function(xhr) {
detailsView.update({'error': true}); var error_msg;
if (xhr.responseText) {
var parsed_resp = $.parseJSON(xhr.responseText);
error_msg = parsed_resp.error_msg || parsed_resp.detail;
} else {
error_msg = gettext("Failed. Please check the network.");
}
detailsView.update({'error_msg': error_msg});
} }
}); });
} }