1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-14 06:11:16 +00:00

Add share link admin dialog and permission settings dialog

This commit is contained in:
Daniel Pan
2015-12-28 11:17:26 +08:00
committed by llj
parent 8d12ea22c7
commit 92044f6a34
4 changed files with 115 additions and 5 deletions

View File

@@ -53,7 +53,7 @@
<% if (enable_repo_history_setting) { %> <% if (enable_repo_history_setting) { %>
<li><a class="op js-popup-history-settings" href="#">{% trans "History Settings" %}</a></li> <li><a class="op js-popup-history-settings" href="#">{% trans "History Settings" %}</a></li>
<% } %> <% } %>
<li><a class="op js-view-links" href="#">{% trans "Sharing Links" %}</a></li> <li><a class="op js-popup-share-link-admin" href="#">{% trans "Sharing Links" %}</a></li>
</ul> </ul>
</div> </div>
</td> </td>
@@ -1106,3 +1106,11 @@
<input type="submit" value="{% trans "Submit" %}" class="submit" /> <input type="submit" value="{% trans "Submit" %}" class="submit" />
</form> </form>
</script> </script>
<script type="text/template" id="repo-permissions-dialog-tmpl">
<h3><%= title %></h3>
</script>
<script type="text/template" id="repo-share-link-admin-dialog-tmpl">
<h3><%= title %></h3>
</script>

View File

@@ -0,0 +1,44 @@
define([
'jquery',
'underscore',
'backbone',
'common'
], function($, _, Backbone, Common) {
'use strict';
var RepoPermissionsDialog = Backbone.View.extend({
tagName: 'div',
id: 'repo-permissions-dialog',
template: _.template($('#repo-permissions-dialog-tmpl').html()),
initialize: function(options) {
this.repo_name = options.repo_name;
this.repo_id = options.repo_id;
this.render();
this.$el.modal();
$("#simplemodal-container").css({'height':'auto'});
},
render: function() {
this.$el.html(this.template({
title: gettext("{placeholder} Permission Settings")
.replace('{placeholder}',
'<span class="op-target ellipsis ellipsis-op-target" title="'
+ Common.HTMLescape(this.repo_name) + '">'
+ Common.HTMLescape(this.repo_name) + '</span>'),
repo_id: this.repo_id
// TODO: get settings from server
}));
return this;
},
events: {
}
});
return RepoPermissionsDialog;
});

View File

@@ -0,0 +1,44 @@
define([
'jquery',
'underscore',
'backbone',
'common'
], function($, _, Backbone, Common) {
'use strict';
var RepoShareLinkAdminDialog = Backbone.View.extend({
tagName: 'div',
id: 'repo-share-link-admin-dialog',
template: _.template($('#repo-share-link-admin-dialog-tmpl').html()),
initialize: function(options) {
this.repo_name = options.repo_name;
this.repo_id = options.repo_id;
this.render();
this.$el.modal();
$("#simplemodal-container").css({'height':'auto'});
},
render: function() {
this.$el.html(this.template({
title: gettext("{placeholder} Share Links")
.replace('{placeholder}',
'<span class="op-target ellipsis ellipsis-op-target" title="'
+ Common.HTMLescape(this.repo_name) + '">'
+ Common.HTMLescape(this.repo_name) + '</span>'),
repo_id: this.repo_id
// TODO: get settings from server
}));
return this;
},
events: {
}
});
return RepoShareLinkAdminDialog;
});

View File

@@ -4,8 +4,11 @@ define([
'backbone', 'backbone',
'common', 'common',
'app/views/share', 'app/views/share',
'app/views/dialogs/history-settings' 'app/views/dialogs/history-settings',
], function($, _, Backbone, Common, ShareView, HistorySettingsDialog) { 'app/views/dialogs/repo-permissions',
'app/views/dialogs/repo-share-link-admin'
], function($, _, Backbone, Common, ShareView, HistorySettingsDialog,
RepoPermissionsDialog, RepoShareLinkAdminDialog) {
'use strict'; 'use strict';
var RepoView = Backbone.View.extend({ var RepoView = Backbone.View.extend({
@@ -23,7 +26,8 @@ define([
'click .js-toggle-popup': 'togglePopup', 'click .js-toggle-popup': 'togglePopup',
'click .js-repo-rename': 'rename', 'click .js-repo-rename': 'rename',
'click .js-popup-history-settings': 'popupHistorySettings', 'click .js-popup-history-settings': 'popupHistorySettings',
'click .js-popup-permission-settings': 'popupPermissionSettings' 'click .js-popup-permission-settings': 'popupPermissionSettings',
'click .js-popup-share-link-admin': 'popupShareLinkAdmin'
}, },
initialize: function() { initialize: function() {
@@ -184,7 +188,17 @@ define([
'repo_id': this.model.get('id') 'repo_id': this.model.get('id')
}; };
this.togglePopup(); // close the popup this.togglePopup(); // close the popup
new HistorySettingsDialog(options); new RepoPermissionsDialog(options);
return false;
},
popupShareLinkAdmin: function() {
var options = {
'repo_name': this.model.get('name'),
'repo_id': this.model.get('id')
};
this.togglePopup(); // close the popup
new RepoShareLinkAdminDialog(options);
return false; return false;
} }