1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-11 20:01:10 +00:00

[backbone] Add shared repo view

This commit is contained in:
Daniel Pan
2015-02-04 21:57:26 +08:00
parent 4a1d11d0fc
commit 86fc129add
11 changed files with 192 additions and 11 deletions

View File

@@ -0,0 +1,45 @@
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;
});