1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-13 23:14:29 +00:00
seahub/static/scripts/app/views/group-discussion.js

46 lines
1003 B
JavaScript
Raw Normal View History

2016-03-08 05:36:58 +00:00
define([
'jquery',
'underscore',
'backbone',
'common',
'marked'
], function($, _, Backbone, Common, Marked) {
'use strict';
var View = Backbone.View.extend({
tagName: 'li',
className: 'user-item cspt ovhd',
template: _.template($('#group-discussion-tmpl').html()),
events: {
'mouseenter': 'highlight',
'mouseleave': 'rmHighlight'
},
initialize: function() {
},
render: function() {
var obj = this.model.attributes;
Common.getMomentWithLocale(obj['created_at']);
_.extend(obj, {
'content_marked': Marked(obj.content, { breaks: true })
});
this.$el.html(this.template(obj));
return this;
},
highlight: function() {
this.$el.addClass('hl');
},
rmHighlight: function() {
this.$el.removeClass('hl');
}
});
return View;
});