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:
@@ -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));
|
||||
|
Reference in New Issue
Block a user