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:
133
modules/backend/assets/js/winter.treelist.js
Normal file
133
modules/backend/assets/js/winter.treelist.js
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* TreeList Widget
|
||||
*
|
||||
* Supported options:
|
||||
* - handle - class name to use as a handle
|
||||
* - nested - set to false if sorting should be kept within each OL container, if using
|
||||
* a handle it should be focused enough to exclude nested handles.
|
||||
*
|
||||
* Events:
|
||||
* - move.oc.treelist - triggered when a node on the tree is moved.
|
||||
*
|
||||
* Dependences:
|
||||
* - Sortable Plugin (winter.sortable.js)
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
var Base = $.wn.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
var TreeListWidget = function (element, options) {
|
||||
this.$el = $(element)
|
||||
this.options = options || {};
|
||||
|
||||
Base.call(this)
|
||||
|
||||
$.wn.foundation.controlUtils.markDisposable(element)
|
||||
this.init()
|
||||
}
|
||||
|
||||
TreeListWidget.prototype = Object.create(BaseProto)
|
||||
TreeListWidget.prototype.constructor = TreeListWidget
|
||||
|
||||
TreeListWidget.prototype.init = function() {
|
||||
var sortableOptions = {
|
||||
handle: this.options.handle,
|
||||
nested: this.options.nested,
|
||||
onDrop: this.proxy(this.onDrop),
|
||||
afterMove: this.proxy(this.onAfterMove)
|
||||
}
|
||||
|
||||
this.$el.find('> ol').sortable($.extend(sortableOptions, this.options))
|
||||
|
||||
if (!this.options.nested)
|
||||
this.$el.find('> ol ol').sortable($.extend(sortableOptions, this.options))
|
||||
|
||||
this.$el.one('dispose-control', this.proxy(this.dispose))
|
||||
}
|
||||
|
||||
TreeListWidget.prototype.dispose = function() {
|
||||
this.unbind()
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
TreeListWidget.prototype.unbind = function() {
|
||||
this.$el.off('dispose-control', this.proxy(this.dispose))
|
||||
|
||||
this.$el.find('> ol').sortable('destroy')
|
||||
|
||||
if (!this.options.nested) {
|
||||
this.$el.find('> ol ol').sortable('destroy')
|
||||
}
|
||||
|
||||
this.$el.removeData('oc.treelist')
|
||||
|
||||
this.$el = null
|
||||
this.options = null
|
||||
}
|
||||
|
||||
TreeListWidget.DEFAULTS = {
|
||||
handle: null,
|
||||
nested: true
|
||||
}
|
||||
|
||||
// TREELIST EVENT HANDLERS
|
||||
// ============================
|
||||
|
||||
TreeListWidget.prototype.onDrop = function($item, container, _super) {
|
||||
// The event handler could be registered after the
|
||||
// sortable is destroyed. This should be fixed later.
|
||||
if (!this.$el) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.trigger('move.oc.treelist', { item: $item, container: container })
|
||||
_super($item, container)
|
||||
}
|
||||
|
||||
TreeListWidget.prototype.onAfterMove = function($placeholder, container, $closestEl) {
|
||||
if (!this.$el) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.trigger('aftermove.oc.treelist', { placeholder: $placeholder, container: container, closestEl: $closestEl })
|
||||
}
|
||||
|
||||
// TREELIST WIDGET PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.treeListWidget
|
||||
|
||||
$.fn.treeListWidget = function (option) {
|
||||
var args = arguments,
|
||||
result
|
||||
|
||||
this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.treelist')
|
||||
var options = $.extend({}, TreeListWidget.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.treelist', (data = new TreeListWidget(this, options)))
|
||||
if (typeof option == 'string') result = data[option].call(data)
|
||||
if (typeof result != 'undefined') return false
|
||||
})
|
||||
|
||||
return result ? result : this
|
||||
}
|
||||
|
||||
$.fn.treeListWidget.Constructor = TreeListWidget
|
||||
|
||||
// TREELIST WIDGET NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.treeListWidget.noConflict = function () {
|
||||
$.fn.treeListWidget = old
|
||||
return this
|
||||
}
|
||||
|
||||
// TREELIST WIDGET DATA-API
|
||||
// ==============
|
||||
|
||||
$(document).render(function(){
|
||||
$('[data-control="treelist"]').treeListWidget();
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
Reference in New Issue
Block a user