1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-06-29 00:17:18 +00:00
seahub/static/scripts/app/views/activity-item.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-07-24 03:37:57 +00:00
define([
'jquery',
'underscore',
'backbone',
'common',
'app/views/details'
], function($, _, Backbone, Common, DetailesView) {
'use strict';
var ActivityItem = Backbone.View.extend({
tagName: 'li',
className: 'event-item',
template: _.template($('#activity-item-tmpl').html()),
events: {
'click .lsch': 'showDetails'
},
initialize: function(activity) {
this.activity = activity;
2018-03-01 06:45:29 +00:00
if (activity.etype == 'clean-up-repo-trash') {
if (activity.days == 0) {
this.activity.desc = gettext('Removed all items from trash.');
} else {
this.activity.desc = gettext('Removed items older than {n} days from trash.').replace('{n}', this.activity.days);
}
}
2015-07-24 03:37:57 +00:00
},
showDetails: function () {
var options = {
'repo_id': this.activity.repo_id,
'cmmt_id': this.activity.commit_id
};
new DetailesView(options);
},
render: function () {
this.$el.html(this.template({'activity': this.activity}));
return this;
}
});
return ActivityItem;
});