- auto iterated tab/widget unique ids if not set in session file
- docs, wip
This commit is contained in:
parent
a93e8dc9c8
commit
60967e0e89
8 changed files with 124 additions and 53 deletions
File diff suppressed because one or more lines are too long
|
|
@ -1,3 +1,16 @@
|
|||
__widgets__ = {}
|
||||
__widgetsIds__ = {}
|
||||
|
||||
var iterator = {
|
||||
tab: 0,
|
||||
widget: 0
|
||||
},
|
||||
getIterator = function(type){
|
||||
iterator[type] += 1
|
||||
return iterator[type]
|
||||
}
|
||||
|
||||
|
||||
parsetabs = function(tabs,parent,sub){
|
||||
if (!sub) {
|
||||
var nav = $(document.createElement('div')).addClass('main navigation'),
|
||||
|
|
@ -15,16 +28,18 @@ parsetabs = function(tabs,parent,sub){
|
|||
}
|
||||
|
||||
for (i in tabs) {
|
||||
var tabData = tabs[i];
|
||||
tabData.id = tabData.id.replace(' ','_')
|
||||
var id = parent?parent.attr('id')+tabData.id:tabData.id
|
||||
label= tabData.label||tabData.id
|
||||
var tabData = tabs[i]
|
||||
|
||||
tabData.id = tabData.id?tabData.id.replace(' ','_'):'tab_'+getIterator('tab')
|
||||
|
||||
var id = tabData.id,
|
||||
label= tabData.label||id
|
||||
|
||||
navtabs.append('<li><a data-tab="#'+id+'"><span>'+label+'</span></a></li>');
|
||||
|
||||
var tabContent = $(document.createElement('div')).addClass('tab').attr('id',id);
|
||||
var tabContent = $('<div></div>').addClass('tab').attr('id',id);
|
||||
|
||||
if (tabData.mode=='stack') tabContent.addClass('stack')
|
||||
if (tabData.stack) tabContent.addClass('stack')
|
||||
|
||||
if (tabData.tabs) {
|
||||
parsetabs(tabData.tabs,parent=tabContent,sub=true);
|
||||
|
|
@ -37,14 +52,16 @@ parsetabs = function(tabs,parent,sub){
|
|||
}
|
||||
}
|
||||
|
||||
__widgets__ = {}
|
||||
__widgetsIds__ = {}
|
||||
|
||||
|
||||
parsewidgets = function(widgets,parent) {
|
||||
|
||||
for (i in widgets) {
|
||||
var widgetData = widgets[i],
|
||||
id = widgetData.id,
|
||||
var widgetData = widgets[i]
|
||||
|
||||
widgetData.id = widgetData.id?widgetData.id.replace(' ','_'):'widget_'+getIterator('widget')
|
||||
|
||||
var id = widgetData.id,
|
||||
label = widgetData.label || id,
|
||||
type = widgetData.type || 'fader',
|
||||
path = widgetData.path || '/' + id,
|
||||
|
|
@ -53,12 +70,6 @@ parsewidgets = function(widgets,parent) {
|
|||
|
||||
widgetData.path = path
|
||||
|
||||
if (widgetData.color && widgetData.color=='accent') {
|
||||
accentclass = 'accent'
|
||||
} else if (widgetData.color) {
|
||||
color = 'style="color:'+widgetData.color+'"'
|
||||
}
|
||||
|
||||
var widgetContainer = $('\
|
||||
<div class="widget '+type+'-container" widgetType="'+type+'" widgetId="'+id+'" path="'+path+'">\
|
||||
<div class="label">'+label+'</div>\
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ createWidget.strip = function(widgetData) {
|
|||
<div class="strip">\
|
||||
</div>\
|
||||
');
|
||||
if (widgetData.mode=='horizontal') widget.addClass('horizontal')
|
||||
if (widgetData.horizontal) widget.addClass('horizontal')
|
||||
parsewidgets(widgetData.widgets,widget)
|
||||
widget.getValue = function(){return}
|
||||
widget.setValue = function(){return}
|
||||
|
|
@ -86,8 +86,6 @@ createWidget.toggle = createWidget.button = function(widgetData) {
|
|||
|
||||
|
||||
createWidget.switch = function(widgetData) {
|
||||
widgetData.on = widgetData.on || 1
|
||||
widgetData.off = widgetData.off || 0
|
||||
|
||||
var widget = $('\
|
||||
<div class="switch">\
|
||||
|
|
@ -402,9 +400,9 @@ createWidget.fader = function(widgetData,container){
|
|||
pips = widget.find('.pips'),
|
||||
input = widget.find('input'),
|
||||
unit = widgetData.unit?' '+widgetData.unit.trim(): '',
|
||||
dimension = widgetData.mode=='horizontal'?'width':'height';
|
||||
dimension = widgetData.horizontal?'width':'height';
|
||||
|
||||
if (widgetData.mode=='horizontal') container.addClass('horizontal')
|
||||
if (widgetData.horizontal) container.addClass('horizontal')
|
||||
|
||||
handle.size = 0
|
||||
fader.size = dimension=='height'?fader.height():fader.width()
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ a {
|
|||
&.main {
|
||||
padding-right:55rem;
|
||||
right:0;
|
||||
background: linear-gradient($color-border,$color-bg);
|
||||
// background: linear-gradient($color-border,$color-bg);
|
||||
}
|
||||
ul {
|
||||
|
||||
|
|
@ -643,7 +643,8 @@ form {
|
|||
&.horizontal {
|
||||
flex-direction: row;
|
||||
> .widget {
|
||||
border-bottom: 0;
|
||||
border-bottom-width: 0;
|
||||
border-right-width:6rem;
|
||||
}
|
||||
}
|
||||
height: 100%;
|
||||
|
|
@ -652,10 +653,10 @@ form {
|
|||
|
||||
> .widget {
|
||||
display: block;
|
||||
border-left:0;
|
||||
border-right:0;
|
||||
border-left-width:0;
|
||||
border-right-width:0;
|
||||
&:not(:last-child) {
|
||||
border-bottom:0;
|
||||
border-bottom-width:0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue