cytoplasm 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/images/cytoplasm/actions-circle-add-1.png +0 -0
- data/app/assets/images/cytoplasm/actions-circle-remove-1.png +0 -0
- data/app/assets/images/cytoplasm/artwork-paintroll.png +0 -0
- data/app/assets/images/cytoplasm/edition-delete-1.png +0 -0
- data/app/assets/images/cytoplasm/transparent_bg.jpg +0 -0
- data/app/assets/javascripts/cytoplasm/cytoColorPicker.js.erb +39 -29
- data/app/assets/javascripts/cytoplasm/cytoMenu.js.erb +173 -0
- data/app/assets/javascripts/cytoplasm/cytoSlider.js.erb +2 -0
- data/app/assets/javascripts/cytoplasm/cytoTable.js.erb +90 -7
- data/app/assets/javascripts/cytoplasm/cytoplasm.js.erb +36 -9
- data/app/assets/javascripts/cytoplasm/jquery.color-2.1.0.min.js +2 -0
- data/app/controllers/cytoplasm/settings_controller.rb +3 -2
- data/app/views/cytoplasm/fonts/_li.html.erb +39 -8
- data/app/views/cytoplasm/fonts/_style_list.html.erb +76 -37
- data/app/views/cytoplasm/settings/_colors.html.erb +78 -43
- data/app/views/cytoplasm/settings/colors.html.erb +5 -1
- data/app/views/cytoplasm/settings/general.html.erb +2 -5
- data/app/views/cytoplasm/settings/layout.html.erb +1 -1
- data/lib/cytoplasm.rb +23 -8
- data/lib/cytoplasm/version.rb +1 -1
- data/test/dummy/app/views/layouts/application.html.erb +16 -14
- data/test/dummy/config/cytoplasm-config.yml +33 -15
- data/test/dummy/log/development.log +82949 -0
- data/test/dummy/public/cytoplasm/cytoplasm.vars.less +23 -15
- data/test/dummy/public/fonts/enabled.yml +7 -1
- data/test/dummy/public/fonts/googlewebfonts.yml +1 -0
- data/test/dummy/tmp/cache/assets/C26/8F0/sprockets%2F3b5053120e76678a259691793a539bb4 +0 -0
- data/test/dummy/tmp/cache/assets/C80/300/sprockets%2F0097f55cbf6b44214787f422f41291d3 +0 -0
- data/test/dummy/tmp/cache/assets/C8F/0F0/sprockets%2F369f11075c8c5f939359cb5cb0569281 +0 -0
- data/test/dummy/tmp/cache/assets/CA8/E70/sprockets%2F5b16b7419ca6425b68262503ac627e4d +0 -0
- data/test/dummy/tmp/cache/assets/CB5/A90/sprockets%2F595675d0d782f6212f20570d6e4a42ff +0 -0
- data/test/dummy/tmp/cache/assets/CD4/490/sprockets%2F5609c0966d710286dad06a9ea4b42c11 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/900/sprockets%2Fc68606f026190266d8099ada290bbaa4 +0 -0
- data/test/dummy/tmp/cache/assets/CF3/120/sprockets%2Fe2b304b015ce82a222d634e7e544b0b3 +0 -0
- data/test/dummy/tmp/cache/assets/D03/6B0/sprockets%2Fd3cfc780201b87a3439e35c5236bb71a +0 -0
- data/test/dummy/tmp/cache/assets/D04/CC0/sprockets%2F1c7e3330365910fa51cb5f8a4a841c7e +0 -0
- data/test/dummy/tmp/cache/assets/D0E/7D0/sprockets%2F89200785fe2710582a6c1b8d04ae7fbe +0 -0
- data/test/dummy/tmp/cache/assets/D14/170/sprockets%2F40a7b83bb067eea7ce2c8394e1529287 +0 -0
- data/test/dummy/tmp/cache/assets/D15/CE0/sprockets%2Fa1310379a19df3c1796f2f67dcd5915d +0 -0
- data/test/dummy/tmp/cache/assets/D19/600/sprockets%2F345fa0a7855237e1a82e64874af9d7cc +0 -0
- data/test/dummy/tmp/cache/assets/D26/750/sprockets%2Fb70b009a7a0d9e252ef0b082d5029be0 +0 -0
- data/test/dummy/tmp/cache/assets/D48/1C0/sprockets%2F7853aece2d8335fce33830d0b774ed68 +0 -0
- data/test/dummy/tmp/cache/assets/D66/290/sprockets%2Fe0bc90b225127451839ed2d6eca6ecb6 +0 -0
- data/test/dummy/tmp/cache/assets/D69/0A0/sprockets%2Fe6c078d521b528e004f5dd673ddb2a6d +0 -0
- data/test/dummy/tmp/cache/assets/D78/840/sprockets%2F326ec6387a9d1b45ec2cdf7093b79f0e +0 -0
- data/test/dummy/tmp/cache/assets/D83/C70/sprockets%2Ff536f7a68e692747fca1d2fcd5c07f57 +0 -0
- data/test/dummy/tmp/cache/assets/D87/200/sprockets%2Fe0c1351fbd86032af3fd4b32c408acd4 +0 -0
- data/test/dummy/tmp/cache/assets/D8D/930/sprockets%2Ff9a03a5e1622ce69a7d82ab0be00e6c3 +0 -0
- data/test/dummy/tmp/cache/assets/D91/130/sprockets%2F928ea21100ee49aa47c9ef50fa17dc1a +0 -0
- data/test/dummy/tmp/cache/assets/D94/9D0/sprockets%2F9cda9ba002e091c71087d8dba7aca098 +0 -0
- data/test/dummy/tmp/cache/assets/D97/1C0/sprockets%2Faa0ccf8e63f048456ade02a39fa8571a +0 -0
- data/test/dummy/tmp/cache/assets/E00/880/sprockets%2Fecb876bb310c1a3e6fd534ece45c9ed9 +0 -0
- data/test/dummy/tmp/cache/assets/E00/9A0/sprockets%2Ff1ece46dc13852f9cb8d4ed0fcf1640e +0 -0
- data/test/dummy/tmp/cache/assets/E8C/480/sprockets%2Fdacb331ac961cf7b7cbc69abe8fb74dd +0 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- metadata +45 -5
- data/app/assets/javascripts/cytoplasm/jquery.color.js +0 -663
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -9,12 +9,21 @@
|
|
|
9
9
|
widget:{
|
|
10
10
|
previewer:{
|
|
11
11
|
css:{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"border-radius":10,
|
|
15
|
-
"
|
|
12
|
+
width:'100%',
|
|
13
|
+
height:'100%',
|
|
14
|
+
"border-top-left-radius":10,
|
|
15
|
+
"border-bottom-left-radius":10
|
|
16
16
|
},
|
|
17
|
-
element:null
|
|
17
|
+
element:null,
|
|
18
|
+
wrapper:{
|
|
19
|
+
css:{
|
|
20
|
+
display:'inline-block',
|
|
21
|
+
"border-top-left-radius":10,
|
|
22
|
+
"border-bottom-left-radius":10,
|
|
23
|
+
background:"url(/assets/cytoplasm/transparent_bg.jpg)",
|
|
24
|
+
"box-shadow":"0px 0px 10px rgba(0,0,0,0.5)"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
18
27
|
},
|
|
19
28
|
slider_table:{
|
|
20
29
|
attrs:{
|
|
@@ -36,8 +45,7 @@
|
|
|
36
45
|
},
|
|
37
46
|
css:{
|
|
38
47
|
display:'inline-block',
|
|
39
|
-
'vertical-align':'top'
|
|
40
|
-
'border-width':1
|
|
48
|
+
'vertical-align':'top'
|
|
41
49
|
},
|
|
42
50
|
element:null,
|
|
43
51
|
sliders:{
|
|
@@ -61,7 +69,7 @@
|
|
|
61
69
|
element:null
|
|
62
70
|
}
|
|
63
71
|
},
|
|
64
|
-
default_value:"hlsa(0,0%,
|
|
72
|
+
default_value:"hlsa(0,0%,50%,0)"
|
|
65
73
|
};
|
|
66
74
|
var attrs = ['hue','saturation','lightness','alpha'];
|
|
67
75
|
var methods = {
|
|
@@ -76,68 +84,70 @@
|
|
|
76
84
|
// Generate widget
|
|
77
85
|
$this.addClass('cytoColorPicker').css({display:'none'});
|
|
78
86
|
settings.widget.wrapper.element = $this.wrap("<div class='cytoColorPicker-wrapper' />").parent().css(settings.widget.wrapper.css);
|
|
79
|
-
settings.widget.previewer.element = $('<div />').addClass('cytoColorPicker-previewer').css(settings.widget.previewer.css).appendTo(settings.widget.wrapper.element)
|
|
87
|
+
settings.widget.previewer.wrapper.element = $('<div />').addClass('cytoColorPicker-previewer-wrapper').css(settings.widget.previewer.wrapper.css).appendTo(settings.widget.wrapper.element);
|
|
88
|
+
settings.widget.previewer.element = $('<div />').addClass('cytoColorPicker-previewer').css(settings.widget.previewer.css).appendTo(settings.widget.previewer.wrapper.element).click(function(e){
|
|
80
89
|
|
|
81
90
|
});
|
|
82
91
|
|
|
83
92
|
// Generate slider table
|
|
84
|
-
var slider_table = $('<table />').
|
|
85
|
-
|
|
86
|
-
var letter =
|
|
93
|
+
var slider_table = $('<table />').cytoTable().css(settings.widget.slider_table.css).appendTo(settings.widget.wrapper.element);
|
|
94
|
+
$.each(attrs,function(i,attr){
|
|
95
|
+
var letter = attr.charAt(0);
|
|
87
96
|
var tr = $('<tr />').appendTo(slider_table);
|
|
88
97
|
var lc = $('<td />').addClass('labelcell').html(letter.toUpperCase()+": ").append($('<span />').addClass('num').html(0)).appendTo(tr);
|
|
89
98
|
var sc = $('<td />').addClass('cytoColorPicker-sliderCell').appendTo(tr);
|
|
90
|
-
var slider = $('<div data-attr="'+
|
|
99
|
+
var slider = $('<div data-attr="'+attr+'" />').appendTo(sc).slider($.extend(true,{},settings.widget.slider_table.sliders.settings,settings.widget.slider_table.attrs[attr]));
|
|
91
100
|
settings.widget.slider_table.sliders.elements.push(slider);
|
|
92
|
-
}
|
|
101
|
+
});
|
|
93
102
|
slider_table.find('td').css({'padding':"5px 10px"}).filter('.labelcell').width(50);
|
|
94
103
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
$this.data('cytoColorPicker',settings);
|
|
104
|
+
// Set dimensions of previewer
|
|
105
|
+
settings.widget.previewer.wrapper.element.width(slider_table.outerHeight()+5).height(slider_table.outerHeight()+5);
|
|
98
106
|
|
|
99
107
|
// Get initial value as color
|
|
100
|
-
|
|
101
|
-
if (wasSet) settings.default_value = $this.val();
|
|
102
|
-
settings.value = $.Color(settings.default_value);
|
|
108
|
+
settings.value = $.Color(($this.val()!=null && $this.val()!="") ? $this.val() : settings.default_value);
|
|
103
109
|
|
|
104
110
|
// Commit settings to data-cytoColorPicker attribute
|
|
105
111
|
$this.data('cytoColorPicker',settings);
|
|
106
112
|
methods.resize.apply($this);
|
|
107
|
-
|
|
108
|
-
else methods.update.apply($this);
|
|
113
|
+
methods.value.apply($this,[settings.value]);
|
|
109
114
|
});
|
|
110
115
|
},
|
|
111
116
|
update:function(){
|
|
112
117
|
return this.each(function(){
|
|
113
118
|
var $this = $(this);
|
|
114
119
|
var settings = $this.data('cytoColorPicker');
|
|
115
|
-
if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling
|
|
120
|
+
if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the update method!");
|
|
116
121
|
|
|
117
122
|
var wrapper = $this.parent();
|
|
118
123
|
var previewer = wrapper.find(".cytoColorPicker-previewer");
|
|
119
124
|
var sliders = wrapper.find('.ui-slider');
|
|
120
125
|
var color = {};
|
|
121
126
|
sliders.each(function(i){color[attrs[i]] = sliders.filter("[data-attr="+attrs[i]+"]").slider("value");});
|
|
122
|
-
color = $.Color(color);
|
|
123
|
-
previewer.css({"background
|
|
127
|
+
color = $.Color().hsla(color);
|
|
128
|
+
previewer.css({"background":color.toHslaString()});
|
|
124
129
|
|
|
125
130
|
$this.val(color.toHslaString());
|
|
126
131
|
settings.events.change.apply($this,[color]);
|
|
127
132
|
});
|
|
128
133
|
},
|
|
129
134
|
value:function(color){
|
|
135
|
+
if (color == null) return $.Color(this.val()).toHslaString();
|
|
136
|
+
if (typeof color != "object") color = $.Color(color);
|
|
130
137
|
return this.each(function(){
|
|
131
138
|
var $this = $(this);
|
|
132
139
|
var settings = $this.data('cytoColorPicker');
|
|
133
|
-
if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the
|
|
140
|
+
if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the value method!");
|
|
134
141
|
|
|
135
142
|
var wrapper = $this.parent();
|
|
136
|
-
color = $.Color(color);
|
|
137
143
|
var sliders = wrapper.find('.ui-slider');
|
|
138
|
-
sliders.each(function(i){
|
|
144
|
+
sliders.each(function(i){
|
|
145
|
+
var c = color.hsla()[i];
|
|
146
|
+
if (c==null) c = 0;
|
|
147
|
+
sliders.filter("[data-attr="+attrs[i]+"]").slider("value",c);
|
|
148
|
+
});
|
|
139
149
|
|
|
140
|
-
methods.update.apply($this
|
|
150
|
+
methods.update.apply($this);
|
|
141
151
|
});
|
|
142
152
|
},
|
|
143
153
|
resize:function(){
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
(function($){
|
|
2
|
+
|
|
3
|
+
var defaults = {
|
|
4
|
+
autoOpen:true,
|
|
5
|
+
events:{
|
|
6
|
+
onCreate:function(){},
|
|
7
|
+
onDestroy:function(){},
|
|
8
|
+
onOpen:function(){},
|
|
9
|
+
onShut:function(){}
|
|
10
|
+
},
|
|
11
|
+
options:{}, // Hash of options for the menu. Syntax: {html:click}
|
|
12
|
+
positioning:{
|
|
13
|
+
to:'bottom left',
|
|
14
|
+
offset:{
|
|
15
|
+
top:0,
|
|
16
|
+
left:0,
|
|
17
|
+
bottom:0,
|
|
18
|
+
right:0
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
transition:{
|
|
22
|
+
effect:"blind",
|
|
23
|
+
options:{
|
|
24
|
+
open:{},
|
|
25
|
+
shut:{}
|
|
26
|
+
},
|
|
27
|
+
speed:250
|
|
28
|
+
},
|
|
29
|
+
widget:{
|
|
30
|
+
list:{
|
|
31
|
+
css:{
|
|
32
|
+
margin:0,
|
|
33
|
+
padding:0,
|
|
34
|
+
overflow:'hidden'
|
|
35
|
+
},
|
|
36
|
+
element:false,
|
|
37
|
+
li:{
|
|
38
|
+
css:{
|
|
39
|
+
'list-style':'none',
|
|
40
|
+
'margin':0,
|
|
41
|
+
'padding':10,
|
|
42
|
+
'background':'#555',
|
|
43
|
+
'border':'1px solid #444',
|
|
44
|
+
'color':'white',
|
|
45
|
+
'cursor':'pointer',
|
|
46
|
+
'font':'<%=Cytoplasm.vars()[:fonts][:sizes][:small]+" "+Cytoplasm.vars()[:fonts][:faces][:light]%>'
|
|
47
|
+
},
|
|
48
|
+
hover:{
|
|
49
|
+
background:"<%=Cytoplasm.vars()[:colors][:global][:accent]%>",
|
|
50
|
+
color:'black'
|
|
51
|
+
},
|
|
52
|
+
elements:[]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
wrapper:{
|
|
56
|
+
css:{
|
|
57
|
+
position:'absolute',
|
|
58
|
+
'box-shadow':'0px 0px 10px rgba(0,0,0,0.5)'
|
|
59
|
+
},
|
|
60
|
+
element:false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var methods = {
|
|
66
|
+
init:function(options){
|
|
67
|
+
return this.each(function(){
|
|
68
|
+
// Initialize
|
|
69
|
+
var $this = $(this).addClass('CytoMenu-parent');
|
|
70
|
+
var settings = $.extend(true,{},defaults,options);
|
|
71
|
+
|
|
72
|
+
// Generate Widget
|
|
73
|
+
settings.widget.wrapper.element = $('<div />').addClass('CytoMenu-wrapper').css(settings.widget.wrapper.css).appendTo('body').hide();
|
|
74
|
+
settings.widget.list.element = $('<ul />').addClass('CytoMenu-list').css(settings.widget.list.css).appendTo(settings.widget.wrapper.element);
|
|
75
|
+
|
|
76
|
+
// Generate Options
|
|
77
|
+
$.each(settings.options,function(html,click){
|
|
78
|
+
var li = $('<li />').html(html).css(settings.widget.list.li.css).appendTo(settings.widget.wrapper.element).click(click).hover(function(){
|
|
79
|
+
$(this).css(settings.widget.list.li.hover);
|
|
80
|
+
},function(){
|
|
81
|
+
$(this).css(settings.widget.list.li.css);
|
|
82
|
+
});
|
|
83
|
+
settings.widget.list.li.elements.push(li);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Save settings
|
|
87
|
+
$this.data("CytoMenu",settings).data("CytoMenu-state","shut");
|
|
88
|
+
|
|
89
|
+
// Positioning
|
|
90
|
+
methods.reposition.apply($this);
|
|
91
|
+
|
|
92
|
+
// Finalize
|
|
93
|
+
settings.events.onCreate.apply($this);
|
|
94
|
+
if (settings.autoOpen) methods.open.apply($this);
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
destroy:function(){
|
|
98
|
+
return this.each(function(){
|
|
99
|
+
var $this = $(this);
|
|
100
|
+
var settings = $this.data('CytoMenu');
|
|
101
|
+
if (settings==null) return console.warn("You must instantiate $.CytoMenu before calling the destroy method!");
|
|
102
|
+
|
|
103
|
+
settings.events.onDestroy.apply($this);
|
|
104
|
+
})
|
|
105
|
+
},
|
|
106
|
+
reposition:function(){
|
|
107
|
+
return this.each(function(){
|
|
108
|
+
var $this = $(this);
|
|
109
|
+
var settings = $this.data('CytoMenu');
|
|
110
|
+
if (settings==null) return console.warn("You must instantiate $.CytoMenu before calling the reposition method!");
|
|
111
|
+
|
|
112
|
+
// Position to
|
|
113
|
+
var to = settings.positioning.to;
|
|
114
|
+
if (to.indexOf("top")>-1) settings.widget.wrapper.element.css("top",$this.offset().top);
|
|
115
|
+
else if (to.indexOf("bottom")>-1) settings.widget.wrapper.element.css("top",$this.offset().top+$this.outerHeight());
|
|
116
|
+
if (to.indexOf("left")>-1) settings.widget.wrapper.element.css("left",$this.offset().left);
|
|
117
|
+
else if (to.indexOf("right")>-1) settings.widget.wrapper.element.css("right",$this.offset().left+$this.outerWidth()-settings.widget.wrapper.element.outerWidth());
|
|
118
|
+
|
|
119
|
+
// Apply offsets
|
|
120
|
+
settings.widget.wrapper.element.css({
|
|
121
|
+
top:parseInt(settings.widget.wrapper.element.css("top")) + settings.positioning.offset.top - settings.positioning.offset.bottom,
|
|
122
|
+
left:parseInt(settings.widget.wrapper.element.css("left")) + settings.positioning.offset.left - settings.positioning.offset.right
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
open:function(){
|
|
127
|
+
return this.each(function(){
|
|
128
|
+
var $this = $(this);
|
|
129
|
+
var settings = $this.data('CytoMenu');
|
|
130
|
+
if (settings==null) return console.warn("You must instantiate $.CytoMenu before calling the open method!");
|
|
131
|
+
|
|
132
|
+
settings.widget.wrapper.element.show(settings.transition.effect,settings.transition.options.open,400,function(){
|
|
133
|
+
$this.data("CytoMenu",settings).data("CytoMenu-state","open");
|
|
134
|
+
settings.events.onOpen.apply($this);
|
|
135
|
+
$(document).bind("click.CytoMenu-open",function(e){
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
$(document).unbind(e);
|
|
138
|
+
methods.shut.apply($this);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
shut:function(){
|
|
144
|
+
return this.each(function(){
|
|
145
|
+
var $this = $(this);
|
|
146
|
+
var settings = $this.data('CytoMenu');
|
|
147
|
+
if (settings==null) return console.warn("You must instantiate $.CytoMenu before calling the shut method!");
|
|
148
|
+
|
|
149
|
+
settings.widget.wrapper.element.hide(settings.transition.effect,settings.transition.options.shut,400,function(){
|
|
150
|
+
$this.data("CytoMenu",settings).data("CytoMenu-state","shut");
|
|
151
|
+
settings.events.onShut.apply($this);
|
|
152
|
+
$(document).unbind("click.CytoMenu-open");
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
toggle:function(){
|
|
157
|
+
return this.each(function(){
|
|
158
|
+
var $this = $(this);
|
|
159
|
+
var settings = $this.data('CytoMenu');
|
|
160
|
+
if (settings==null) return console.warn("You must instantiate $.CytoMenu before calling the toggle method!");
|
|
161
|
+
|
|
162
|
+
methods[(($this.data('CytoMenu-state')=="open")?'shut':'open')].apply($this);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
$.fn.CytoMenu = function(method){
|
|
168
|
+
if (methods[method]) return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
|
|
169
|
+
else if (typeof method == 'object' || !method) return methods[((this.hasClass('CytoMenu-parent'))?'toggle':'init')].apply(this,arguments);
|
|
170
|
+
else $.error('Method ' + method + ' does not exist on $.CytoMenu!');
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
})(jQuery);
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
min:0,
|
|
20
20
|
max:100,
|
|
21
21
|
value:0,
|
|
22
|
+
step:1,
|
|
22
23
|
slide:function(e,ui){},
|
|
23
24
|
change:function(e,ui){}
|
|
24
25
|
}
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
if ($this.data('unit')!=null) settings.widget.label.readout.unit = $this.data('unit');
|
|
53
54
|
if ($this.data('min')!=null) settings.widget.slider.options.min = $this.data('min');
|
|
54
55
|
if ($this.data('max')!=null) settings.widget.slider.options.max = $this.data('max');
|
|
56
|
+
if ($this.data('step')!=null) settings.widget.slider.options.step = $this.data('step');
|
|
55
57
|
if ($this.val()!=null && $this.val()!="") settings.widget.slider.options.value = parseInt($this.val());
|
|
56
58
|
} else settings = options;
|
|
57
59
|
|
|
@@ -6,14 +6,51 @@
|
|
|
6
6
|
table:{
|
|
7
7
|
cell:{
|
|
8
8
|
padding:0,
|
|
9
|
-
spacing:0
|
|
9
|
+
spacing:0,
|
|
10
|
+
},
|
|
11
|
+
css:{
|
|
12
|
+
width:"100%",
|
|
13
|
+
"margin-bottom":15,
|
|
14
|
+
"box-shadow":"0px 0px 10px rgba(0,0,0,0.5)"
|
|
15
|
+
},
|
|
16
|
+
element:false,
|
|
17
|
+
tr:{
|
|
18
|
+
css:{},
|
|
19
|
+
elements:[],
|
|
20
|
+
td:{
|
|
21
|
+
css:{
|
|
22
|
+
padding:10
|
|
23
|
+
},
|
|
24
|
+
elements:[],
|
|
25
|
+
types:{
|
|
26
|
+
header:{
|
|
27
|
+
css:{},
|
|
28
|
+
tag:"h3"
|
|
29
|
+
},
|
|
30
|
+
icon:{
|
|
31
|
+
css:{
|
|
32
|
+
width:16,
|
|
33
|
+
cursor:'pointer'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
info:{
|
|
37
|
+
css:{}
|
|
38
|
+
},
|
|
39
|
+
label:{
|
|
40
|
+
css:{
|
|
41
|
+
width:100,
|
|
42
|
+
font:"<%=Cytoplasm.vars()[:fonts][:sizes][:small]+" "+Cytoplasm.vars()[:fonts][:faces][:light]%>",
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
10
47
|
}
|
|
11
48
|
}
|
|
12
49
|
},
|
|
13
50
|
events:{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
51
|
+
onCreate:function(cy){},
|
|
52
|
+
onChange:function(cy,event){},
|
|
53
|
+
onDestroy:function(cy){}
|
|
17
54
|
}
|
|
18
55
|
};
|
|
19
56
|
|
|
@@ -21,19 +58,65 @@
|
|
|
21
58
|
init:function(options){
|
|
22
59
|
return this.each(function(){
|
|
23
60
|
var $this = $(this);
|
|
61
|
+
if (!$this.is('table')) return console.warn("$.cytoTable expects a table!");
|
|
24
62
|
var settings = $.extend(true,{},defaults,options);
|
|
25
63
|
|
|
26
64
|
// Setup table
|
|
27
|
-
$this.
|
|
65
|
+
settings.widget.table.element = $(this).addClass('cytoTable')
|
|
66
|
+
.attr({cellpadding:settings.widget.table.cell.padding,cellspacing:settings.widget.table.cell.spacing})
|
|
67
|
+
.css(settings.widget.table.css);
|
|
68
|
+
// Setup tr
|
|
69
|
+
var colspan = 0;
|
|
70
|
+
settings.widget.table.tr.elements = settings.widget.table.element.find("tr").each(function(){
|
|
71
|
+
var tds = $(this).css(settings.widget.table.tr.css).find("td");
|
|
72
|
+
if (tds.length > colspan) colspan = tds.length;
|
|
73
|
+
tds.each(function(){settings.widget.table.tr.td.elements.push($(this));});
|
|
74
|
+
});
|
|
75
|
+
// Setup td
|
|
76
|
+
$.each(settings.widget.table.tr.td.elements,function(i,td){
|
|
77
|
+
td.css(settings.widget.table.tr.td.css);
|
|
78
|
+
$.each(settings.widget.table.tr.td.types,function(type,opts){if (td.hasClass(type+'cell')) td.attr('data-type',type);});
|
|
79
|
+
if (td.data("type")!=null) {
|
|
80
|
+
var type = td.data('type');
|
|
81
|
+
td.css(settings.widget.table.tr.td.types[type].css);
|
|
82
|
+
switch (type) {
|
|
83
|
+
case "header":
|
|
84
|
+
td.attr('colspan',colspan);
|
|
85
|
+
var tag = settings.widget.table.tr.td.types.header.tag;
|
|
86
|
+
if (td.data('tag')!=null) tag = td.data('tag');
|
|
87
|
+
if (!td.children(tag).length) {
|
|
88
|
+
tag = $('<'+tag+'>').html(td.html())
|
|
89
|
+
td.html("").append(tag);
|
|
90
|
+
} else {
|
|
91
|
+
tag = td.children(tag);
|
|
92
|
+
tag.css("margin",0);
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
case "icon":
|
|
96
|
+
|
|
97
|
+
break;
|
|
98
|
+
case "info":
|
|
99
|
+
td.attr('colspan',colspan);
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case "label":
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
28
107
|
|
|
29
108
|
$this.data('cytoTable',settings);
|
|
30
109
|
});
|
|
31
110
|
},
|
|
32
111
|
resize:function(){
|
|
33
|
-
|
|
112
|
+
return this.each(function(){
|
|
113
|
+
|
|
114
|
+
});
|
|
34
115
|
},
|
|
35
116
|
destroy:function(){
|
|
36
|
-
|
|
117
|
+
return this.each(function(){
|
|
118
|
+
|
|
119
|
+
});
|
|
37
120
|
}
|
|
38
121
|
};
|
|
39
122
|
|