From 46334b8118718810a4f82767285d409fef898f09 Mon Sep 17 00:00:00 2001 From: llj Date: Wed, 27 May 2015 17:09:29 +0800 Subject: [PATCH] [sub lib] bugfix for 'create' & 'dir op bar' --- seahub/templates/js/templates.html | 2 +- static/scripts/app/views/dir.js | 6 +++--- static/scripts/app/views/myhome-sub-repos.js | 21 ++++++++++---------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/seahub/templates/js/templates.html b/seahub/templates/js/templates.html index 7c2ded7dee..85283a8c60 100644 --- a/seahub/templates/js/templates.html +++ b/seahub/templates/js/templates.html @@ -140,7 +140,7 @@ <% if (user_perm == 'rw') { %> <% } %> - <% if (is_repo_owner) { %> + <% if (is_repo_owner && !is_virtual) { %> <% } %> <% } %> diff --git a/static/scripts/app/views/dir.js b/static/scripts/app/views/dir.js index 03b7262486..92692a710e 100644 --- a/static/scripts/app/views/dir.js +++ b/static/scripts/app/views/dir.js @@ -263,16 +263,16 @@ define([ }, renderDirOpBar: function() { - var dir = this.dir, - user_perm = dir.user_perm; + var dir = this.dir; this.$dir_op_bar.html($.trim(this.dir_op_bar_template({ - user_perm: user_perm, + user_perm: dir.user_perm, encrypted: dir.encrypted, path: dir.path, repo_id: dir.repo_id, site_root: app.pageOptions.site_root, is_repo_owner: dir.is_repo_owner, + is_virtual: dir.is_virtual, enable_upload_folder: app.pageOptions.enable_upload_folder }))); }, diff --git a/static/scripts/app/views/myhome-sub-repos.js b/static/scripts/app/views/myhome-sub-repos.js index ce44197a19..cc6808dec1 100644 --- a/static/scripts/app/views/myhome-sub-repos.js +++ b/static/scripts/app/views/myhome-sub-repos.js @@ -142,18 +142,19 @@ define([ dataType: 'json', success: function(data) { $.modal.close(); + var new_sub_lib = { + 'id': data["sub_repo_id"], + 'name': data["name"], + 'origin_repo_id': ori_repo_id, + 'origin_path': path, + 'abbrev_origin_path': data["abbrev_origin_path"], + 'mtime': new Date().getTime() / 1000, + 'mtime_relative': gettext("Just now") + }; if (_this.repos.length > 0) { - _this.repos.add({ - 'id': data["sub_repo_id"], - 'name': data["name"], - 'origin_repo_id': ori_repo_id, - 'origin_path': path, - 'abbrev_origin_path': data["abbrev_origin_path"], - 'mtime': new Date().getTime() / 1000, - 'mtime_relative': gettext("Just now") - }, {prepend: true}); + _this.repos.add(new_sub_lib , {prepend: true}); } else { - _this.showMyRepos(); + _this.repos.reset([new_sub_lib]); } }, error: function(xhr, textStatus, errorThrown) {