misc ... refactoring

pull/25/head
Steve Nyemba 1 month ago
parent ec3b8680df
commit cbf63d3f56

@ -0,0 +1,60 @@
/***
*
* This file build forms from a given set of specifications (in JSON) format
*/
var _form =function(_id,_data) {
this._data = _data // {input,defaults,choices}
this._id = _id
//
// let's clean up the data :
this._data.defaults = (this._data.defaults == null)? {}:this._data.defaults
this._data.choices = (this._data.choices == null)?{}: this._data.choices
this.render = function (){
_title = $('<div></div>').html(this._id).addClass(this._id)
var _input = this._data.input
var _defaults = this._data.defaults
var _choices = this._data.choices
_input.forEach (_label=>{
_value = _defaults[_label]
if (_choices[_label]){
}else{
//
// This
_input = this.get.input(_label,_value)
}
})
}
this.get = {}
this.get.input = function (label,value){
_frame = $('<div></div>')
_label = $('<div></div>').html(label)
_input = $('<input type="text"/>').attr('placeholder',label.0.replace(/_/,' ').trim()).addClass("input-"+label)
$(_input)[0].data = label
if (value){
$(_input).val(value)
}
_frame.append(_label,_input)
return _frame
}
this.get.choice= function (label,_default,choices) {
var _input = this.get.input(label,_default)
$(input).addClass("hidden-input")
$(_input).on('click',function (){
})
_pane = $('<div class="choices"></div>')
choices.forEach(_value=>{
_option = $('<div><div>').addClass("option").addClass("option-"+_value)
$(_pane).append(_option)
})
_pane.append(_input,choices)
_frame = $('<div></div>').append(_pane)
return _frame
}
}

@ -299,7 +299,7 @@ var QCMSBasic= function(_layout,_context,_clickEvent) {
} }
} }
var QCMSTabs = function(_layout,_context,_clickEvent){ var QCMSTabs = function(_layout,_context,_id){
// //
// This object will make tabs in the area of the menu // This object will make tabs in the area of the menu
// @TODO: we can parameterize where the menu is made to improve flexibility // @TODO: we can parameterize where the menu is made to improve flexibility
@ -308,6 +308,7 @@ var QCMSTabs = function(_layout,_context,_clickEvent){
this.tabs.className = 'tabs' this.tabs.className = 'tabs'
this._context = _context this._context = _context
this._layout = _layout this._layout = _layout
this._target = (_id == null)?'.main .menu':_id
this._make = function (text,_item,_event){ this._make = function (text,_item,_event){
var text = text.trim().replace(/(_|-)/ig,' ').trim() var text = text.trim().replace(/(_|-)/ig,' ').trim()
var _context = this._context; var _context = this._context;
@ -364,9 +365,9 @@ var QCMSTabs = function(_layout,_context,_clickEvent){
}) })
this.tabs.className = 'tabs' this.tabs.className = 'tabs'
$('.main .menu').append(this.tabs) $(this._target).append(this.tabs)
$('.main .menu').css({'border':'1px solid transparent'}) $(this._target).css({'border':'1px solid transparent'})
$('.main .menu').css({'grid-template-columns':'64px auto'}) $(this._target).css({'grid-template-columns':'64px auto'})
} }
// //
// We need to load the pages here ... // We need to load the pages here ...

@ -38,6 +38,7 @@ The content is created in ./qcms-demo/www/html
Things to update with qcms runner : Things to update with qcms runner :
- system.icon location, when creating a project - system.icon location, when creating a project
- applying themes - applying themes
- upgrade all plugins to return data-type ? - upgrade all plugins to return data-type ?

Loading…
Cancel
Save