1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-06-29 08:27:55 +00:00
seahub/media/scripts/app/views/group-repos.js

48 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-01-21 14:22:34 +00:00
define([
'jquery',
'underscore',
'backbone',
'text!' + app.config._tmplRoot + 'group-repos.html'
], function($, _, Backbone, reposTemplate) {
'use strict';
var GroupRepoView = Backbone.View.extend({
tagName: 'tr',
template: _.template(reposTemplate),
events: {
'mouseenter': 'showAction',
'mouseleave': 'hideAction',
'click .cancel-share': 'unshare'
},
initialize: function() {
console.log('init GroupRepoView');
Backbone.View.prototype.initialize.apply(this, arguments);
},
render: function() {
this.$el.html(this.template(this.model.toJSON()));
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');
},
unshare: function() {
this.model.destroy();
}
});
return GroupRepoView;
});