|
|
|
@ -23,11 +23,12 @@ module.exports = require('backbone').View.extend({ |
|
|
|
}, |
|
|
|
|
|
|
|
initialize(o) { |
|
|
|
this.config = o.config || {}; |
|
|
|
const config = o.config || {}; |
|
|
|
this.config = config; |
|
|
|
this.coll = o.coll || null; |
|
|
|
this.pfx = this.config.stylePrefix || ''; |
|
|
|
this.ppfx = this.config.pStylePrefix || ''; |
|
|
|
this.em = this.config.em; |
|
|
|
this.pfx = config.stylePrefix || ''; |
|
|
|
this.ppfx = config.pStylePrefix || ''; |
|
|
|
this.em = config.em; |
|
|
|
this.listenTo(this.model, 'change:active', this.updateStatus); |
|
|
|
}, |
|
|
|
|
|
|
|
@ -84,7 +85,8 @@ module.exports = require('backbone').View.extend({ |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
changeStatus() { |
|
|
|
this.model.set('active', !this.model.get('active')); |
|
|
|
const { model } = this; |
|
|
|
model.set('active', !model.get('active')); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
@ -105,17 +107,17 @@ module.exports = require('backbone').View.extend({ |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
updateStatus() { |
|
|
|
var chkOn = 'fa-check-square-o'; |
|
|
|
var chkOff = 'fa-square-o'; |
|
|
|
const { model, $el } = this; |
|
|
|
const chkOn = 'fa-check-square-o'; |
|
|
|
const chkOff = 'fa-square-o'; |
|
|
|
const $chk = $el.find('[data-tag-status]'); |
|
|
|
|
|
|
|
if (!this.$chk) this.$chk = this.$el.find('#' + this.pfx + 'checkbox'); |
|
|
|
|
|
|
|
if (this.model.get('active')) { |
|
|
|
this.$chk.removeClass(chkOff).addClass(chkOn); |
|
|
|
this.$el.removeClass('opac50'); |
|
|
|
if (model.get('active')) { |
|
|
|
$chk.removeClass(chkOff).addClass(chkOn); |
|
|
|
$el.removeClass('opac50'); |
|
|
|
} else { |
|
|
|
this.$chk.removeClass(chkOn).addClass(chkOff); |
|
|
|
this.$el.addClass('opac50'); |
|
|
|
$chk.removeClass(chkOn).addClass(chkOff); |
|
|
|
$el.addClass('opac50'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|