/gist:7ed24c85d5f5a816f0fe Secret
Created
April 22, 2012 03:54
-
-
Save ccummings/7ed24c85d5f5a816f0fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steal( | |
'jquery/controller', | |
'jquery/controller/view', | |
'jquery/view/mustache') | |
.then( | |
'./views/draft.mustache', | |
'./views/submitted.mustache', function ($) { | |
/** | |
* @class Ecm.Campaign.Show | |
*/ | |
$.Controller('Ecm.Campaign.Show', | |
/** @Static */ | |
{ | |
defaults: { | |
} | |
}, | |
/** @Prototype */ | |
{ | |
init: function (View, args) { | |
this.render(); | |
}, | |
update: function(options){ | |
this._super(options); | |
this.render(); | |
}, | |
render: function() { | |
var that = this; | |
ECM.Models.Campaign.findOne(args, function (model) { | |
if (model.status == 0) { | |
that.element.html(that.view('draft.mustache', model)); | |
$(that.element).removeClass('submitted').addClass('draft'); | |
} | |
else { | |
that.element.html(that.view('submitted.mustache', model)); | |
$(that.element).removeClass('draft').addClass('submitted'); | |
} | |
}); | |
}, | |
'.delete click': function(ev, el) { | |
if (confirm("Are you sure you want to destroy?")) { | |
el.closest('.content').model().destroy(); | |
} | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment