mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 22:54:11 +00:00
Move scripts from media to static folder
This commit is contained in:
70
static/scripts/app/views/organization-repo.js
Normal file
70
static/scripts/app/views/organization-repo.js
Normal file
@@ -0,0 +1,70 @@
|
||||
define([
|
||||
'jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'common',
|
||||
'text!' + app.config._tmplRoot + 'organization-repo.html'
|
||||
], function($, _, Backbone, Common, reposTemplate) {
|
||||
'use strict';
|
||||
|
||||
var OrganizationRepoView = Backbone.View.extend({
|
||||
tagName: 'tr',
|
||||
|
||||
template: _.template(reposTemplate),
|
||||
|
||||
events: {
|
||||
'mouseenter': 'showAction',
|
||||
'mouseleave': 'hideAction',
|
||||
'click .cancel-share': 'removeShare'
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
},
|
||||
|
||||
removeShare: function(e) {
|
||||
var _this = this,
|
||||
success_callback = function(data) {
|
||||
Common.feedback(gettext('Success'), 'success', Common.SUCCESS_TIMOUT);
|
||||
_this.$el.remove();
|
||||
_this.collection.remove(_this.model, {silent: true});
|
||||
if (_this.collection.length == 0) {
|
||||
$('#organization-repos table').hide();
|
||||
$('#organization-repos .empty-tips').show();
|
||||
};
|
||||
};
|
||||
|
||||
Common.ajaxGet({
|
||||
'get_url': Common.getUrl({name: 'ajax_repo_remove_share'}),
|
||||
'data': {
|
||||
'repo_id': this.model.get('id'),
|
||||
'share_type': this.model.get('share_type')
|
||||
},
|
||||
'after_op_success': success_callback
|
||||
});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var data, show_unshare_btn;
|
||||
if (this.model.get('share_from') == app.pageOptions.current_user || app.pageOptions.is_staff == true) {
|
||||
show_unshare_btn = true;
|
||||
} else {
|
||||
show_unshare_btn = false;
|
||||
};
|
||||
data = $.extend(this.model.toJSON(), {'show_unshare_btn': show_unshare_btn});
|
||||
this.$el.html(this.template(data));
|
||||
return this;
|
||||
},
|
||||
|
||||
showAction: function() {
|
||||
this.$el.addClass('hl');
|
||||
this.$el.find('.op-icon').removeClass('vh');
|
||||
},
|
||||
|
||||
hideAction: function() {
|
||||
this.$el.removeClass('hl');
|
||||
this.$el.find('.op-icon').addClass('vh');
|
||||
}
|
||||
});
|
||||
|
||||
return OrganizationRepoView;
|
||||
});
|
Reference in New Issue
Block a user