Sha256: 3580a00dc8d8e9c7b28ee3c47bd9cd8a0d8f333e292b2e679317ec222c24a11f
Contents?: true
Size: 964 Bytes
Versions: 15
Compression:
Stored size: 964 Bytes
Contents
pageflow.CheckBoxInputView = Backbone.Marionette.ItemView.extend({ mixins: [pageflow.inputView], template: 'pageflow/ui/templates/inputs/check_box', className: 'check_box_input', events: { 'change': 'save' }, ui: { input: 'input', label: 'label' }, onRender: function() { this.ui.label.attr('for', this.cid); this.ui.input.attr('id', this.cid); this.load(); this.listenTo(this.model, 'change:' + this.options.propertyName, this.load); }, save: function() { if (!this.options.disabled) { this.model.set(this.options.propertyName, this.ui.input.is(':checked')); } }, load: function() { if (!this.isClosed) { this.ui.input.prop('checked', this.displayValue()); } }, displayValue: function() { if (this.options.disabled && this.options.displayUncheckedIfDisabled) { return false; } else { return this.model.get(this.options.propertyName); } } });
Version data entries
15 entries across 15 versions & 1 rubygems