Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (47 sloc) 1.76 KB
view = Backbone.View.extend({
events: {
'click a[href=#add]': 'add',
'click .delete': 'del'
initialize: function() {
_(this).bindAll('render', 'add', 'del');
this.collection.bind('add', this.render);
this.collection.bind('remove', this.render);
render: function() {
$('.bleed .active').removeClass('active');
$('.bleed .projects').addClass('active');
return this;
add: function() {
var model = new models.Project({}, {collection:this.collection});
new views.ProjectAdd({ el: $('#popup'), model: model });
del: function(ev) {
var id = $(ev.currentTarget).attr('id');
var model = this.collection.get(id);
new views.Modal({
content: _('Are you sure you want to delete "<%=get("name")||id%>?"').template(model),
callback: _(function() {
success: _(function() {
// Reset the project nav item to be disabled if
// set to the project that is being deleted.
if ($('.bleed .editor').attr('href') === '#/project/' +
$('.bleed .editor')
error: _(function(model, err) {
new views.Modal(err);
affirmative: 'Delete'
return false;
Something went wrong with that request. Please try again.