feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
This commit is contained in:
109
modules/system/assets/ui/js/inspector.editor.checkbox.js
Normal file
109
modules/system/assets/ui/js/inspector.editor.checkbox.js
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Inspector checkbox editor class.
|
||||
*
|
||||
* This editor is used in $.wn.inspector.propertyEditors.set class.
|
||||
* If updates that affect references to this.inspector and propertyDefinition are done,
|
||||
* the propertyEditors.set class implementation should be reviewed.
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
|
||||
var Base = $.wn.inspector.propertyEditors.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
var CheckboxEditor = function(inspector, propertyDefinition, containerCell, group) {
|
||||
Base.call(this, inspector, propertyDefinition, containerCell, group)
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype = Object.create(BaseProto)
|
||||
CheckboxEditor.prototype.constructor = Base
|
||||
|
||||
CheckboxEditor.prototype.dispose = function() {
|
||||
this.unregisterHandlers()
|
||||
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype.build = function() {
|
||||
var editor = document.createElement('input'),
|
||||
container = document.createElement('div'),
|
||||
value = this.inspector.getPropertyValue(this.propertyDefinition.property),
|
||||
label = document.createElement('label'),
|
||||
isChecked = false,
|
||||
id = this.inspector.generateSequencedId()
|
||||
|
||||
container.setAttribute('tabindex', 0)
|
||||
container.setAttribute('class', 'custom-checkbox nolabel')
|
||||
|
||||
editor.setAttribute('type', 'checkbox')
|
||||
editor.setAttribute('value', '1')
|
||||
editor.setAttribute('placeholder', 'placeholder')
|
||||
editor.setAttribute('id', id)
|
||||
|
||||
label.setAttribute('for', id)
|
||||
label.textContent = this.propertyDefinition.title
|
||||
|
||||
container.appendChild(editor)
|
||||
container.appendChild(label)
|
||||
|
||||
if (value === undefined) {
|
||||
if (this.propertyDefinition.default !== undefined) {
|
||||
isChecked = this.normalizeCheckedValue(this.propertyDefinition.default)
|
||||
}
|
||||
}
|
||||
else {
|
||||
isChecked = this.normalizeCheckedValue(value)
|
||||
}
|
||||
|
||||
editor.checked = isChecked
|
||||
|
||||
this.containerCell.appendChild(container)
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype.normalizeCheckedValue = function(value) {
|
||||
if (value == '0' || value == 'false') {
|
||||
return false
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype.getInput = function() {
|
||||
return this.containerCell.querySelector('input')
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype.focus = function() {
|
||||
this.getInput().parentNode.focus()
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype.updateDisplayedValue = function(value) {
|
||||
this.getInput().checked = this.normalizeCheckedValue(value)
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype.isEmptyValue = function(value) {
|
||||
if (value === 0 || value === '0' || value === 'false') {
|
||||
return true
|
||||
}
|
||||
|
||||
return BaseProto.isEmptyValue.call(this, value)
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype.registerHandlers = function() {
|
||||
var input = this.getInput()
|
||||
|
||||
input.addEventListener('change', this.proxy(this.onInputChange))
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype.unregisterHandlers = function() {
|
||||
var input = this.getInput()
|
||||
|
||||
input.removeEventListener('change', this.proxy(this.onInputChange))
|
||||
}
|
||||
|
||||
CheckboxEditor.prototype.onInputChange = function() {
|
||||
var isChecked = this.getInput().checked
|
||||
|
||||
this.inspector.setPropertyValue(this.propertyDefinition.property, isChecked ? 1 : 0)
|
||||
}
|
||||
|
||||
$.wn.inspector.propertyEditors.checkbox = CheckboxEditor
|
||||
}(window.jQuery);
|
||||
Reference in New Issue
Block a user