mirror of
https://github.com/haiwen/seahub.git
synced 2025-06-26 23:17:58 +00:00
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
|
define([
|
||
|
'jquery',
|
||
|
'underscore',
|
||
|
'backbone',
|
||
|
'common',
|
||
|
'text!' + app.config._tmplRoot + 'shared-repo.html'
|
||
|
], function($, _, Backbone, Common, reposTemplate) {
|
||
|
'use strict';
|
||
|
|
||
|
var SharedRepoView = Backbone.View.extend({
|
||
|
tagName: 'tr',
|
||
|
|
||
|
template: _.template(reposTemplate),
|
||
|
|
||
|
events: {
|
||
|
'mouseenter': 'showAction',
|
||
|
'mouseleave': 'hideAction',
|
||
|
'click .repo-delete-btn': 'delete',
|
||
|
'click .repo-share-btn': 'share'
|
||
|
},
|
||
|
|
||
|
initialize: function() {
|
||
|
this.listenTo(this.model, 'destroy', this.remove);
|
||
|
},
|
||
|
|
||
|
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');
|
||
|
},
|
||
|
|
||
|
|
||
|
});
|
||
|
|
||
|
return SharedRepoView;
|
||
|
});
|