Skip to content

@brendanmckenzie /gist:f72f3e484801abb9d53c secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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) {
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
Something went wrong with that request. Please try again.