1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 00:43:53 +00:00

share permission refactor (#1843)

* rebuild

* share admin

* use seafile_api

* rebase 6.2

* complete test

* api changed

* some error

* break up to two method

* review

* js review
This commit is contained in:
zMingGit
2017-11-01 18:13:51 +08:00
committed by xiez
parent a28b1f05c4
commit f5d1be1f59
13 changed files with 854 additions and 160 deletions

View File

@@ -11,7 +11,7 @@ define([
tagName: 'tr',
template: _.template($('#share-admin-folder-tmpl').html()),
template: _.template($('#share-admin-repo-tmpl').html()),
events: {
'click .perm-edit-icon': 'showPermSelect',
@@ -61,7 +61,11 @@ define([
data: data,
beforeSend: Common.prepareCSRFToken,
success: function() {
_this.model.set({'share_permission': perm});
if (perm == 'admin'){
_this.model.set({'share_permission': 'rw', 'is_admin': true});
} else {
_this.model.set({'share_permission': perm, 'is_admin': false});
}
Common.feedback(gettext("Successfully modified permission"), 'success');
},
error: function(xhr) {
@@ -105,13 +109,20 @@ define([
render: function() {
var obj = this.model.toJSON(),
icon_size = Common.isHiDPI() ? 48 : 24,
icon_url = this.model.getIconUrl(icon_size);
icon_url = this.model.getIconUrl(icon_size),
share_type = this.model.get('share_type');
this.show_admin = false;
if (app.pageOptions.is_pro && share_type != 'public') {
this.show_admin = true;
}
_.extend(obj, {
'icon_url': icon_url,
'icon_title': this.model.getIconTitle(),
'url': this.model.getWebUrl(),
'name': this.model.get('repo_name')
'name': this.model.get('repo_name'),
'show_admin': this.show_admin
});
this.$el.html(this.template(obj));