1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-28 08:06:56 +00:00
This commit is contained in:
zhengxie
2015-01-22 17:15:17 +08:00
committed by Daniel Pan
parent 26e26ac22d
commit 700dc2bf1d
9 changed files with 213 additions and 23 deletions

View File

@@ -2,8 +2,9 @@ define([
'jquery',
'underscore',
'backbone',
'common',
'text!' + app.config._tmplRoot + 'group-repos.html'
], function($, _, Backbone, reposTemplate) {
], function($, _, Backbone, Common, reposTemplate) {
'use strict';
var GroupRepoView = Backbone.View.extend({
@@ -20,6 +21,8 @@ define([
initialize: function() {
console.log('init GroupRepoView');
Backbone.View.prototype.initialize.apply(this, arguments);
this.listenTo(this.model, 'destroy', this.remove);
},
render: function() {
@@ -38,8 +41,29 @@ define([
},
unshare: function() {
this.model.destroy();
}
var that = this;
var yesCallback = function() {
Common.closeModal();
Common.feedback(gettext('Loading...'), 'info', Common.INFO_TIMEOUT); // TODO: what if there is still response after 10 secs ?
// send delete request and wait response
that.model.destroy({
wait: true,
success: function(model, rep) {
Common.feedback(gettext('Success'), 'success', Common.SUCCESS_TIMOUT);
},
error: function() {
Common.feedback(gettext('Error'), 'error', Common.ERROR_TIMEOUT);
}
});
};
Common.showConfirm(
gettext('Unshare Library'),
gettext('Are you sure you want to unshare {placeholder} ?')
.replace(/\{placeholder\}/g, '<span class="op-target">' + this.model.get('name') + '</span>'),
yesCallback
);
},
});