diff --git a/seahub/templates/js/templates.html b/seahub/templates/js/templates.html index 9a111adee9..b001bb1b82 100644 --- a/seahub/templates/js/templates.html +++ b/seahub/templates/js/templates.html @@ -196,12 +196,10 @@ <%- name %> - <% if (show_admin && app.pageOptions.is_pro) { %> - <% if (is_admin) { %> - - <% } %> + <% if (app.pageOptions.is_pro && is_admin) { %> + <% } %> - <% if (is_staff || share_from_me || is_admin) { %> + <% if (is_staff || share_from_me) { %> <% } %> @@ -224,6 +222,9 @@ <%= mtime_relative %> + <% if (app.pageOptions.is_pro && is_admin) { %> + + <% } %> <% if (is_staff || share_from_me) { %> <% } %> @@ -1117,6 +1118,9 @@ <%= mtime_relative %> + <% if (app.pageOptions.is_pro && is_admin) { %> + + <% } %> @@ -1521,12 +1525,12 @@ diff --git a/static/scripts/app/views/group-item.js b/static/scripts/app/views/group-item.js index e6de3bcc8c..337cb24f69 100644 --- a/static/scripts/app/views/group-item.js +++ b/static/scripts/app/views/group-item.js @@ -43,8 +43,7 @@ define([ model: new GroupRepo(item, {collection: groupRepos}), group_id: group_id, is_staff: is_staff, - show_shared_by: false, // don't show 'Shared By' - show_admin: false + show_shared_by: false // don't show 'Shared By' }); $listContainer.append(view.render().el); }); diff --git a/static/scripts/app/views/group-repo.js b/static/scripts/app/views/group-repo.js index 1037c0bced..91e65283f3 100644 --- a/static/scripts/app/views/group-repo.js +++ b/static/scripts/app/views/group-repo.js @@ -31,7 +31,6 @@ define([ } this.listenTo(this.model, 'destroy', this.remove); - this.show_admin = options.show_admin }, render: function() { @@ -43,22 +42,23 @@ define([ group_id: this.group_id, is_staff: this.is_staff, // for '#groups' (no 'share_from_me') - share_from_me: app.pageOptions.username == this.model.get('owner') ? true : false, + share_from_me: app.pageOptions.username == this.model.get('owner'), // 'owner_name' for '#groups', 'owner_nickname' for '#group/id/' owner_name: this.model.get('owner_nickname') || this.model.get('owner_name'), show_shared_by: this.show_shared_by, icon_url: icon_url, - icon_title: this.model.getIconTitle(), - is_admin: this.model.get('is_admin'), - show_admin: this.show_admin + icon_title: this.model.getIconTitle() }); this.$el.html(tmpl(obj)); return this; }, + // only for 'is_admin:true' share: function() { var options = { - 'is_repo_owner': true, + 'is_repo_owner': app.pageOptions.username == this.model.get('owner'), + 'is_admin': true, // only for shared repo + 'is_virtual': false, 'user_perm': 'rw', 'repo_id': this.model.get('id'), 'repo_encrypted': this.model.get('encrypted'), @@ -66,6 +66,7 @@ define([ 'dirent_path': '/', 'obj_name': this.model.get('name') }; + new ShareView(options); return false; }, diff --git a/static/scripts/app/views/group.js b/static/scripts/app/views/group.js index 5914014b13..9c60b6f7f1 100644 --- a/static/scripts/app/views/group.js +++ b/static/scripts/app/views/group.js @@ -47,8 +47,7 @@ define([ var view = new GroupRepoView({ model: repo, group_id: this.group_id, - is_staff: this.repos.is_staff, - show_admin: true + is_staff: this.repos.is_staff }); if (options.prepend) { this.$tableBody.prepend(view.render().el); diff --git a/static/scripts/app/views/share.js b/static/scripts/app/views/share.js index dbe2a04a3e..fd51f632d4 100644 --- a/static/scripts/app/views/share.js +++ b/static/scripts/app/views/share.js @@ -848,8 +848,8 @@ define([ $add_item.after(new_item.el); }); $groups_input.select2("val", ""); + $('option', $perm).removeAttr('selected'); $('[value="rw"]', $perm).attr('selected', 'selected'); - $('[value="r"]', $perm).removeAttr('selected'); $error.addClass('hide'); } if (data.failed.length > 0) { diff --git a/static/scripts/app/views/shared-repo.js b/static/scripts/app/views/shared-repo.js index 0ca10bf56a..3f8b10da38 100644 --- a/static/scripts/app/views/shared-repo.js +++ b/static/scripts/app/views/shared-repo.js @@ -15,8 +15,8 @@ define([ mobileTemplate: _.template($('#shared-repo-mobile-tmpl').html()), events: { - 'click .unshare-btn': 'removeShare', - 'click .repo-share-btn': 'share' + 'click .repo-share-btn': 'share', + 'click .unshare-btn': 'removeShare' }, initialize: function() {