Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- App.Views.DocBill = Backbone.View.extend({
- template: _.template('<button class="btn tool<%= button_class %>"><i class="fa fa-fw fa-lg fa-angle-up"></i>Bill</button>'),
- initialize : function(opts) {
- this.doc = opts.doc;
- this.views = {};
- this.tmp_doc = new App.Models.Sales({
- org_id: this.doc.get('org_id'),
- doc_id: this.doc.get('id')
- });
- this.tmp_doc.fetch({reset:true});
- this.listenTo(this.tmp_doc,'reset',this.render());
- },
- render : function() {
- console.log(this.tmp_doc);
- console.log(this.tmp_doc.get('doc_status'));
- var button_class = '';
- switch(this.tmp_doc.doc_status){
- case 'drafted':
- button_class = ' btn-default';
- break;
- case 'pushed':
- button_class = ' btn-success';
- break;
- default:
- break;
- }
- this.$el.html(this.template({'button_class':button_class}));
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment