diff --git a/seahub/templates/js/templates.html b/seahub/templates/js/templates.html index fbf712b344..723d0cfa46 100644 --- a/seahub/templates/js/templates.html +++ b/seahub/templates/js/templates.html @@ -138,7 +138,7 @@ {% trans "Files" %} - <%= file_count %> + {% trans "Size" %} diff --git a/static/scripts/app/views/repo-details.js b/static/scripts/app/views/repo-details.js index 904e8852d3..8fca3ec4f1 100644 --- a/static/scripts/app/views/repo-details.js +++ b/static/scripts/app/views/repo-details.js @@ -36,6 +36,14 @@ define([ this.$el.html(this.template(this.data)); }, + update: function(part_data) { + if (part_data.error) { + this.$('#file-count').html('' + gettext("Error") + ''); + } 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;` diff --git a/static/scripts/app/views/repo.js b/static/scripts/app/views/repo.js index 43d4c2a8f7..40dc7870c6 100644 --- a/static/scripts/app/views/repo.js +++ b/static/scripts/app/views/repo.js @@ -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; diff --git a/static/scripts/common.js b/static/scripts/common.js index 7d02e20bfb..1eb274640c 100644 --- a/static/scripts/common.js +++ b/static/scripts/common.js @@ -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/';