1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-01 23:38:37 +00:00

[repo details] added 'file count'

This commit is contained in:
llj 2017-06-27 18:58:08 +08:00
parent 067a17b106
commit 88c79b4894
4 changed files with 30 additions and 2 deletions

View File

@ -138,7 +138,7 @@
</tr>
<tr>
<th>{% trans "Files" %}</th>
<td><%= file_count %></td>
<td id="file-count"><span class="loading-icon"></span></td>
</tr>
<tr>
<th>{% trans "Size" %}</th>

View File

@ -36,6 +36,14 @@ define([
this.$el.html(this.template(this.data));
},
update: function(part_data) {
if (part_data.error) {
this.$('#file-count').html('<span class="error">' + gettext("Error") + '</span>');
} else {
this.$('#file-count').html(part_data.file_count);
}
},
setConMaxHeight: function() {
this.$('.right-side-panel-con').css({
'height': $(window).height() - // this.$el `position:fixed; top:0;`

View File

@ -333,7 +333,26 @@ define([
icon_url: this.model.getIconUrl(icon_size),
big_icon_url: this.model.getIconUrl(96)
});
this.myReposView.repoDetailsView.show(data);
var detailsView = this.myReposView.repoDetailsView;
detailsView.show(data);
// fetch other data
$.ajax({
url: Common.getUrl({
'name': 'repo_v2.1',
'repo_id': this.model.get('id')
}),
cache: false,
dataType: 'json',
success: function(data) {
detailsView.update({
'file_count': data.file_count
});
},
error: function() {
detailsView.update({'error': true});
}
});
this.togglePopup(); // close the popup
return false;

View File

@ -106,6 +106,7 @@ define([
case 'dir_shared_items': return siteRoot + 'api2/repos/' + options.repo_id + '/dir/shared_items/';
case 'shared_repos': return siteRoot + 'api2/shared-repos/' + options.repo_id + '/';
case 'repo': return siteRoot + 'api2/repos/' + options.repo_id + '/';
case 'repo_v2.1': return siteRoot + 'api/v2.1/repos/' + options.repo_id + '/';
case 'repo_owner': return siteRoot + 'api2/repos/' + options.repo_id + '/owner/';
case 'repo_history_limit': return siteRoot + 'api2/repos/' + options.repo_id + '/history-limit/';
case 'repo_shared_download_links': return siteRoot + 'api2/repos/' + options.repo_id + '/download-shared-links/';