mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 14:21:23 +00:00
Add share link admin dialog and permission settings dialog
This commit is contained in:
@@ -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>
|
||||||
|
44
static/scripts/app/views/dialogs/repo-permissions.js
Normal file
44
static/scripts/app/views/dialogs/repo-permissions.js
Normal 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;
|
||||||
|
});
|
44
static/scripts/app/views/dialogs/repo-share-link-admin.js
Normal file
44
static/scripts/app/views/dialogs/repo-share-link-admin.js
Normal 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;
|
||||||
|
});
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user