Created — forked from brendanmckenzie/gist:f72f3e484801abb9d53c

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:7ed24c85d5f5a816f0fe
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
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
Something went wrong with that request. Please try again.