cytoplasm 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/cytoplasm/settings-dashboard.png +0 -0
- data/app/assets/images/cytoplasm/settings-settings-3.png +0 -0
- data/app/assets/images/cytoplasm/text-underline-color.png +0 -0
- data/app/assets/images/cytoplasm/transition.png +0 -0
- data/app/assets/javascripts/cytoplasm/cytoAjax.js.erb +31 -0
- data/app/assets/javascripts/cytoplasm/cytoTable.js.erb +17 -8
- data/app/assets/javascripts/cytoplasm/cytoplasm.js.erb +42 -38
- data/app/controllers/cytoplasm/settings_controller.rb +7 -0
- data/app/views/cytoplasm/settings/index.html.erb +56 -19
- data/app/views/cytoplasm/settings/precompile.html.erb +13 -0
- data/config/routes.rb +21 -13
- data/lib/cytoplasm.rb +21 -16
- data/lib/cytoplasm/version.rb +1 -1
- data/test/dummy/Gemfile.lock +2 -2
- data/test/dummy/log/development.log +44852 -0
- data/test/dummy/public/css/cytoplasm-styles.css +34 -0
- data/test/dummy/tmp/cache/assets/C9E/E40/sprockets%2Fe392208661e1ea61dd1a0394844aa810 +0 -0
- data/test/dummy/tmp/cache/assets/CB5/C10/sprockets%2Fb32690c2fc7483055b68f074912c7ae8 +0 -0
- data/test/dummy/tmp/cache/assets/CF3/120/sprockets%2Fe2b304b015ce82a222d634e7e544b0b3 +0 -0
- data/test/dummy/tmp/cache/assets/CF9/F80/sprockets%2F5e355e406bc2006a0f291b7c07d13bb8 +0 -0
- data/test/dummy/tmp/cache/assets/CFC/3B0/sprockets%2F745251d124911f1abe215c1b098ac8dd +0 -0
- data/test/dummy/tmp/cache/assets/D03/6B0/sprockets%2Fd3cfc780201b87a3439e35c5236bb71a +0 -0
- data/test/dummy/tmp/cache/assets/D06/7A0/sprockets%2Fa46b76e739460d2691f4121ffa8a0ca0 +0 -0
- data/test/dummy/tmp/cache/assets/D0A/230/sprockets%2F85ada73dac21b2d7ef7230f656393073 +0 -0
- data/test/dummy/tmp/cache/assets/D0E/4A0/sprockets%2F6b27287928ba630c1b25dfa80ee18b48 +0 -0
- data/test/dummy/tmp/cache/assets/D0E/7D0/sprockets%2F89200785fe2710582a6c1b8d04ae7fbe +0 -0
- data/test/dummy/tmp/cache/assets/D13/F70/sprockets%2Fbc94408277f1930765ca09f44b6f2abf +0 -0
- data/test/dummy/tmp/cache/assets/D14/170/sprockets%2F40a7b83bb067eea7ce2c8394e1529287 +0 -0
- data/test/dummy/tmp/cache/assets/D16/040/sprockets%2F714d179ac5ce93605980d5c56cf29aa3 +0 -0
- data/test/dummy/tmp/cache/assets/D21/A00/sprockets%2Ff9387309cc44d4c90c377ff9421bff26 +0 -0
- data/test/dummy/tmp/cache/assets/D26/1E0/sprockets%2Fe5dae19c52fa793785f7fa7c95326472 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D83/C70/sprockets%2Ff536f7a68e692747fca1d2fcd5c07f57 +0 -0
- data/test/dummy/tmp/cache/assets/D87/C40/sprockets%2F9dcd7a6999affe28e91e514cee079016 +0 -0
- data/test/dummy/tmp/cache/assets/D93/690/sprockets%2F5cdf0adad3725045e651c97be81b2e3a +0 -0
- data/test/dummy/tmp/cache/assets/D9A/650/sprockets%2Fdcb422396f52c2fb755dad9b54a1b92d +0 -0
- data/test/dummy/tmp/cache/assets/DCC/980/sprockets%2Fd726e7bc1527db031cd5fa89cda0e98a +0 -0
- data/test/dummy/tmp/cache/assets/DD5/880/sprockets%2F48940ad0983c4dea6dfa0a19e99acec7 +0 -0
- data/test/dummy/tmp/cache/assets/DD7/B30/sprockets%2F985cd8fcea888bb6b9de7b4cd1c23103 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E8C/480/sprockets%2Fdacb331ac961cf7b7cbc69abe8fb74dd +0 -0
- data/test/dummy/tmp/cache/assets/E8E/EF0/sprockets%2F24ff3ab0d28d6edc3fcfbf9ba643e6ec +0 -0
- metadata +41 -6
- data/test/dummy/public/cytoplasm/cytoplasm.vars.less +0 -54
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -51,6 +51,37 @@
|
|
51
51
|
};
|
52
52
|
$.CytoAjax = $.cytoAjax;
|
53
53
|
$.Cytoplasm("ready",function(){
|
54
|
+
|
55
|
+
// Set styles
|
56
|
+
var vars = $.Cytoplasm("vars");
|
57
|
+
$.Cytoplasm("addStyles","cytoajax_styles",{
|
58
|
+
'.cytoResponseMessage':{
|
59
|
+
display:'none',
|
60
|
+
padding:"10px",
|
61
|
+
'margin-bottom':"10px",
|
62
|
+
"border-radius":"5px",
|
63
|
+
font:vars.fonts.sizes.small+" "+vars.fonts.faces.light,
|
64
|
+
'&:first-line':{
|
65
|
+
font:vars.fonts.sizes.normal+" "+vars.fonts.faces.bold
|
66
|
+
},
|
67
|
+
'&[data-type=success]':{
|
68
|
+
"border-color":"green",
|
69
|
+
color:"green",
|
70
|
+
background:"linear-gradient(top, white, #a4ffa4)"
|
71
|
+
},
|
72
|
+
'&[data-type=loading]':{
|
73
|
+
"border-color":"yellow",
|
74
|
+
color:"#777700",
|
75
|
+
background:"linear-gradient(top, white, #000077)"
|
76
|
+
},
|
77
|
+
'&[data-type=error]':{
|
78
|
+
"border-color":"red",
|
79
|
+
color:"red",
|
80
|
+
background:"linear-gradient(top, white, rgb(255,170,170))"
|
81
|
+
}
|
82
|
+
}
|
83
|
+
});
|
84
|
+
|
54
85
|
// Setup callback messages
|
55
86
|
$.each(["success","sending","error"],function(i,type){
|
56
87
|
var $this = $('.cytoResponseMessage[data-type="'+type+'"]');
|
@@ -39,14 +39,15 @@
|
|
39
39
|
cursor:'pointer'
|
40
40
|
},
|
41
41
|
hover:{
|
42
|
-
|
42
|
+
backgroundOffset:"-=0.1",
|
43
|
+
css:{}
|
43
44
|
},
|
44
45
|
img:{
|
45
46
|
css:{
|
46
47
|
opacity:0.5
|
47
48
|
},
|
48
49
|
hover:{
|
49
|
-
opacity:0.8
|
50
|
+
css:{opacity:0.8}
|
50
51
|
}
|
51
52
|
}
|
52
53
|
},
|
@@ -113,14 +114,22 @@
|
|
113
114
|
break;
|
114
115
|
case "icon":
|
115
116
|
var img = td.children("img").css(settings.widget.table.tr.td.types.icon.img.css);
|
116
|
-
|
117
|
-
|
118
|
-
|
117
|
+
|
118
|
+
// Calculate darkened background color
|
119
|
+
var oBg, currentParent = td;
|
120
|
+
while (true) {
|
121
|
+
oBg = currentParent.css("background-color");
|
122
|
+
if (oBg!="transparent") break;
|
123
|
+
currentParent = currentParent.parent();
|
124
|
+
}
|
125
|
+
oBg = $.Color(oBg);
|
126
|
+
var dBg = oBg.lightness(settings.widget.table.tr.td.types.icon.hover.backgroundOffset);
|
127
|
+
|
119
128
|
td.hover(function(e){
|
120
|
-
td.css("background-color",
|
121
|
-
img.css(settings.widget.table.tr.td.types.icon.img.hover);
|
129
|
+
td.css("background-color",dBg).css(settings.widget.table.tr.td.types.icon.hover.css);
|
130
|
+
img.css(settings.widget.table.tr.td.types.icon.img.hover.css);
|
122
131
|
},function(e){
|
123
|
-
td.css("background-color",
|
132
|
+
td.css("background-color",oBg).css(settings.widget.table.tr.td.types.icon.css);
|
124
133
|
img.css(settings.widget.table.tr.td.types.icon.img.css);
|
125
134
|
});
|
126
135
|
break;
|
@@ -31,6 +31,9 @@ var Cytoplasm;
|
|
31
31
|
}
|
32
32
|
];
|
33
33
|
|
34
|
+
// Default styles
|
35
|
+
var static_styles = "body{margin:0;height:100%;overflow-y:scroll}h1,h2,h3,h4,h5,h6{margin:20px 0}header{overflow:hidden;h1{margin:0;white-space:nowrap;cursor:pointer;display:inline;text-shadow:0 0 10px rgba(0,0,0,0.5)}#logo{z-index:1000}}nav{ul{padding:0;list-style:none;li{display:inline-block}}}section{min-height:400px;background:white;overflow:hidden;box-shadow:0 0 10px rgba(0,0,0,0.8);clear:both;&>:first-child{margin-top:0;padding-top:0}&>:last-child{margin-bottom:0;padding-bottom:0}}footer{overflow:hidden}.cytoField{width:100%;border:1px solid #aaa;border-radius:5px;font-size:14px;box-shadow:inset 0 0 5px rgba(0,0,0,0.25);&[type=text],&[type=password],&[type=email]{height:28px;padding:0 7px}}textarea.cytoField{resize:none;height:200px;padding:7px}button,input[type=submit]{&.cytoButton{border-radius:5px;cursor:pointer;&.large{width:100%;height:50px}}}";
|
36
|
+
|
34
37
|
// Gradient manipulation library
|
35
38
|
var parseGradient = function(grad,reverse){
|
36
39
|
// Return untouched if not gradient
|
@@ -140,22 +143,19 @@ var Cytoplasm;
|
|
140
143
|
vars = data.vars;
|
141
144
|
$(document).ready(function(){
|
142
145
|
$('body').data('cytoplasm',settings);
|
143
|
-
methods.
|
146
|
+
methods.initStyles.apply();
|
144
147
|
ready = true;
|
145
148
|
$.each(readyFunctions,function(i,f){f.apply();});
|
146
149
|
});
|
147
150
|
}
|
148
151
|
});
|
149
152
|
},
|
150
|
-
|
153
|
+
initStyles:function(userstyles){
|
151
154
|
if (typeof userstyles != "object") userstyles = {};
|
152
|
-
// Remove existing cytoplasm styles
|
153
|
-
if ($('#cytoplasm_dynamic_styles').is("*")) $('#cytoplasm_dynamic_styles').remove();
|
154
155
|
|
155
156
|
// Set variables
|
156
157
|
var boldweight = (vars.fonts.faces.bold==vars.fonts.faces.regular)?"bold":"normal";
|
157
158
|
var lightweight = (vars.fonts.faces.light==vars.fonts.faces.regular)?"lighter":"normal";
|
158
|
-
var styletag = "body{margin:0;height:100%;overflow-y:scroll}h1,h2,h3,h4,h5,h6{margin:20px 0}header{overflow:hidden;h1{margin:0;white-space:nowrap;cursor:pointer;display:inline;text-shadow:0 0 10px rgba(0,0,0,0.5)}#logo{z-index:1000}}nav{ul{padding:0;list-style:none;li{display:inline-block}}}section{min-height:400px;background:white;overflow:hidden;box-shadow:0 0 10px rgba(0,0,0,0.8);clear:both;&>:first-child{margin-top:0;padding-top:0}&>:last-child{margin-bottom:0;padding-bottom:0}}footer{overflow:hidden}.cytoField{width:100%;border:1px solid #aaa;border-radius:5px;font-size:14px;box-shadow:inset 0 0 5px rgba(0,0,0,0.25);&[type=text],&[type=password],&[type=email]{height:28px;padding:0 7px}}textarea.cytoField{resize:none;height:200px;padding:7px}button,input[type=submit]{&.cytoButton{border-radius:5px;cursor:pointer;&.large{width:100%;height:50px}}}";
|
159
159
|
var styles = $.extend(true,{},{
|
160
160
|
body:{
|
161
161
|
background:vars.colors.global.background,
|
@@ -251,31 +251,6 @@ var Cytoplasm;
|
|
251
251
|
background:"linear-gradient(to right,#ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",
|
252
252
|
"box-shadow":"inset 0px 0px 5px hsla(0,0%,0%,0.5)"
|
253
253
|
}
|
254
|
-
},
|
255
|
-
'.cytoResponseMessage':{
|
256
|
-
display:'none',
|
257
|
-
padding:"10px",
|
258
|
-
'margin-bottom':"10px",
|
259
|
-
"border-radius":"5px",
|
260
|
-
font:vars.fonts.sizes.small+" "+vars.fonts.faces.light,
|
261
|
-
'&:first-line':{
|
262
|
-
font:vars.fonts.sizes.normal+" "+vars.fonts.faces.bold
|
263
|
-
},
|
264
|
-
'&[data-type=success]':{
|
265
|
-
"border-color":"green",
|
266
|
-
color:"green",
|
267
|
-
background:"linear-gradient(top, white, #a4ffa4)"
|
268
|
-
},
|
269
|
-
'&[data-type=loading]':{
|
270
|
-
"border-color":"yellow",
|
271
|
-
color:"#777700",
|
272
|
-
background:"linear-gradient(top, white, #000077)"
|
273
|
-
},
|
274
|
-
'&[data-type=error]':{
|
275
|
-
"border-color":"red",
|
276
|
-
color:"red",
|
277
|
-
background:"linear-gradient(top, white, rgb(255,170,170))"
|
278
|
-
}
|
279
254
|
}
|
280
255
|
},userstyles);
|
281
256
|
|
@@ -298,9 +273,44 @@ var Cytoplasm;
|
|
298
273
|
else styles.header["#logo"][vars.layout.header.logo.align] = vars.layout.header.logo.x+10;
|
299
274
|
|
300
275
|
// Compile the styles for HTML and add to <head>
|
301
|
-
|
276
|
+
methods.addStyles.apply(this,["cytoplasm_static_styles",static_styles]);
|
277
|
+
methods.addStyles.apply(this,["cytoplasm_dynamic_styles",styles]);
|
278
|
+
},
|
279
|
+
addStyles:function(id,styles){
|
280
|
+
if (typeof id != "string") return console.warn("$.Cytoplasm's addStyles method requires an id string as the first parameter!");
|
281
|
+
|
282
|
+
// Compile the styles for HTML and add to <head>
|
283
|
+
var styletag = "";
|
284
|
+
switch (typeof styles) {
|
285
|
+
case "object":
|
286
|
+
$.each(styles,function(e,s){styletag += compileStyles(e,s);});
|
287
|
+
break;
|
288
|
+
case "string":
|
289
|
+
styletag += styles;
|
290
|
+
break;
|
291
|
+
default:
|
292
|
+
return console.warn("$.Cytoplasm's addStyles method requires either an object containing JSON-formatted LESS CSS or a string containing LESS CSS as its second parameter!");
|
293
|
+
}
|
294
|
+
|
295
|
+
// Set styles
|
296
|
+
methods.removeStyles.apply(this,[id]);
|
302
297
|
var parser = new(less.Parser)({});
|
303
|
-
parser.parse(styletag,function(e,tree){$("<style type='text/css' rel='stylesheet' media='screen' id='
|
298
|
+
parser.parse(styletag,function(e,tree){$("<style type='text/css' rel='stylesheet' media='screen' id='"+id+"' class='cytoplasm-dynamic-stylesheet'>"+tree.toCSS({compress:true})+"</style>").appendTo("head");});
|
299
|
+
},
|
300
|
+
removeStyles:function(id){
|
301
|
+
if (typeof id != "string") return console.warn("$.Cytoplasm's addStyles method requires an id string as the first parameter!");
|
302
|
+
if ($('style#'+id).is("*")) $('style#'+id).remove();
|
303
|
+
},
|
304
|
+
resetStyles:function(){
|
305
|
+
$('style.cytoplasm-dynamic-stylesheet').remove();
|
306
|
+
methods.initStyles.apply(this);
|
307
|
+
},
|
308
|
+
saveStyles:function(){
|
309
|
+
var styletag = "";
|
310
|
+
$('.cytoplasm-dynamic-stylesheet').each(function(){styletag += $(this).text();});
|
311
|
+
$.post("/cytoplasm/precompile",{styles:styletag},function(data){
|
312
|
+
$.cytoAjaxResponse("Styles saved successfully!");
|
313
|
+
});
|
304
314
|
},
|
305
315
|
vars:function(which,value){
|
306
316
|
var returnvar;
|
@@ -324,12 +334,6 @@ var Cytoplasm;
|
|
324
334
|
exp += " = "+value.toString();
|
325
335
|
return eval(exp);
|
326
336
|
}
|
327
|
-
},
|
328
|
-
style:function(){
|
329
|
-
|
330
|
-
},
|
331
|
-
refresh:function(){
|
332
|
-
|
333
337
|
},
|
334
338
|
destroy:function(){
|
335
339
|
$('body').data('cytoplasm',null);
|
@@ -27,6 +27,13 @@ module Cytoplasm
|
|
27
27
|
redirect_to cytoplasm_settings_url
|
28
28
|
end
|
29
29
|
|
30
|
+
def precompile
|
31
|
+
if request.post?
|
32
|
+
Cytoplasm.precompile_styles(params[:styles])
|
33
|
+
render :text => Cytoplasm::Ajax.success()
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
30
37
|
def fetch_vars
|
31
38
|
Cytoplasm.load_vars_from("config/cytoplasm-config.yml")
|
32
39
|
return Cytoplasm.vars()
|
@@ -1,28 +1,65 @@
|
|
1
1
|
<h2 style="margin:0px;">Cytoplasm Backstage</h2>
|
2
2
|
<hr />
|
3
3
|
|
4
|
-
<
|
5
|
-
<
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
<li
|
16
|
-
|
17
|
-
|
18
|
-
<
|
19
|
-
<
|
20
|
-
|
21
|
-
|
4
|
+
<ul class="tile_list">
|
5
|
+
<li>
|
6
|
+
<%=image_tag("cytoplasm/settings-settings-3.png",:width => 256)%>
|
7
|
+
<h3><%=link_to("Settings",cytoplasm_general_settings_url)%></h3>
|
8
|
+
<ul>
|
9
|
+
<li><%=link_to("Layout Settings",cytoplasm_layout_settings_url)%></li>
|
10
|
+
<li><%=link_to("Colors Settings",cytoplasm_colors_settings_url)%></li>
|
11
|
+
<li><%=link_to("Advanced Configuration Tool",cytoplasm_advanced_config_url)%></li>
|
12
|
+
</ul>
|
13
|
+
</li>
|
14
|
+
|
15
|
+
<li>
|
16
|
+
<%=image_tag("cytoplasm/text-underline-color.png",:width => 256)%>
|
17
|
+
<h3><%=link_to("Fonts",cytoplasm_fonts_url)%></h3>
|
18
|
+
<ul>
|
19
|
+
<li><%=link_to("Install New Fonts","#")%></li>
|
20
|
+
<li><%=link_to("Manage Installed Fonts",cytoplasm_fonts_url)%></li>
|
21
|
+
<li><%=link_to("Layout Font Settings","#")%></li>
|
22
|
+
</ul>
|
23
|
+
</li>
|
24
|
+
|
25
|
+
<li>
|
26
|
+
<%=image_tag("cytoplasm/transition.png",:width => 256)%>
|
27
|
+
<h3><%=link_to("Transitions","#")%></h3>
|
28
|
+
<ul>
|
29
|
+
<li><%=link_to("Layout Transition Settings","#")%></li>
|
30
|
+
<li><%=link_to("Create a Transition","#")%></li>
|
31
|
+
</ul>
|
32
|
+
</li>
|
33
|
+
|
34
|
+
<li>
|
35
|
+
<%=image_tag("cytoplasm/settings-dashboard.png",:width => 256)%>
|
36
|
+
<h3><%=link_to("Performance","#")%></h3>
|
37
|
+
<ul>
|
38
|
+
<li><%=link_to("Precompile CSS",cytoplasm_precompile_url)%></li>
|
39
|
+
</ul>
|
40
|
+
</li>
|
22
41
|
</ul>
|
23
42
|
|
24
43
|
<script type="text/javascript">
|
44
|
+
(function($){
|
25
45
|
$.Cytoplasm("ready",function(){
|
26
|
-
|
46
|
+
$('.tile_list').css({
|
47
|
+
'list-style':'none',
|
48
|
+
margin:0,
|
49
|
+
padding:"25px 0px"
|
50
|
+
}).children('li').css({
|
51
|
+
float:'left',
|
52
|
+
width:'25%',
|
53
|
+
'text-align':'center'
|
54
|
+
}).children('img').click(function(e){
|
55
|
+
window.location = $(this).siblings("h3").find("a").attr("href");
|
56
|
+
}).end().children('ul').css({
|
57
|
+
'list-style':'none',
|
58
|
+
padding:0,
|
59
|
+
margin:0
|
60
|
+
}).children('li').css({
|
61
|
+
|
62
|
+
});
|
27
63
|
});
|
64
|
+
})(jQuery);
|
28
65
|
</script>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<h2>Precompile Cytoplasm's Dynamic CSS</h2>
|
2
|
+
<p>This will save your current dynamic CSS settings to a minified CSS file at public/css/cytoplasm-styles.css. Use this once you're satisfied with the layout you've created to eliminate preprocessing and speed up loading times.</p>
|
3
|
+
<button id="go_button" class="cytoButton large">Precompile Dynamic CSS!</button>
|
4
|
+
|
5
|
+
<script type="text/javascript">
|
6
|
+
(function($){
|
7
|
+
$.Cytoplasm("ready",function(){
|
8
|
+
$('#go_button').click(function(e){
|
9
|
+
$.Cytoplasm("saveStyles");
|
10
|
+
});
|
11
|
+
});
|
12
|
+
})(jQuery);
|
13
|
+
</script>
|
data/config/routes.rb
CHANGED
@@ -1,21 +1,29 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
+
# Development environment only
|
3
|
+
if Rails.env.development?
|
4
|
+
# Settings
|
5
|
+
get "/cytoplasm" => "Cytoplasm/settings#index", :as => :cytoplasm_settings
|
6
|
+
get "/cytoplasm/general" => "Cytoplasm/settings#general", :as => :cytoplasm_general_settings
|
7
|
+
get "/cytoplasm/layout" => "Cytoplasm/settings#layout", :as => :cytoplasm_layout_settings
|
8
|
+
get "/cytoplasm/colors" => "Cytoplasm/settings#colors", :as => :cytoplasm_colors_settings
|
9
|
+
get "/cytoplasm/advanced" => "Cytoplasm/settings#advanced", :as => :cytoplasm_advanced_config
|
10
|
+
post "/cytoplasm/update" => "Cytoplasm/settings#update", :as => :cytoplasm_update
|
11
|
+
|
12
|
+
# Fonts
|
13
|
+
get "/cytoplasm/fonts" => "Cytoplasm/fonts#index", :controller => Cytoplasm::FontsController, :action => :index, :as => :cytoplasm_fonts
|
14
|
+
get "/cytoplasm/fonts/:directory/:family" => "Cytoplasm/fonts#show", :controller => Cytoplasm::FontsController, :action => :show, :as => :cytoplasm_show_font
|
15
|
+
post "/cytoplasm/fonts/import" => "Cytoplasm/fonts#import"
|
16
|
+
post "/cytoplasm/fonts/remove" => "Cytoplasm/fonts#remove"
|
17
|
+
post "/cytoplasm/fonts/enable" => "Cytoplasm/fonts#enable"
|
18
|
+
post "/cytoplasm/fonts/disable" => "Cytoplasm/fonts#disable"
|
19
|
+
end
|
2
20
|
|
21
|
+
# All environments
|
3
22
|
# Settings
|
4
|
-
get "/cytoplasm" => "Cytoplasm/settings#
|
5
|
-
|
6
|
-
get "/cytoplasm/layout" => "Cytoplasm/settings#layout", :as => :cytoplasm_layout_settings
|
7
|
-
get "/cytoplasm/colors" => "Cytoplasm/settings#colors", :as => :cytoplasm_colors_settings
|
8
|
-
get "/cytoplasm/advanced" => "Cytoplasm/settings#advanced", :as => :cytoplasm_advanced_config
|
23
|
+
get "/cytoplasm/precompile" => "Cytoplasm/settings#precompile", :as => :cytoplasm_precompile
|
24
|
+
post "/cytoplasm/precompile" => "Cytoplasm/settings#precompile"
|
9
25
|
post "/cytoplasm/settings/fetch" => "Cytoplasm/settings#fetch"
|
10
|
-
post "/cytoplasm/update" => "Cytoplasm/settings#update", :as => :cytoplasm_update
|
11
26
|
|
12
27
|
# Fonts
|
13
|
-
get "/cytoplasm/fonts" => "Cytoplasm/fonts#index", :controller => Cytoplasm::FontsController, :action => :index, :as => :cytoplasm_fonts
|
14
|
-
get "/cytoplasm/fonts/:directory/:family" => "Cytoplasm/fonts#show", :controller => Cytoplasm::FontsController, :action => :show, :as => :cytoplasm_show_font
|
15
28
|
post "/cytoplasm/fonts/fetch_all" => "Cytoplasm/fonts#fetch_all"
|
16
|
-
post "/cytoplasm/fonts/import" => "Cytoplasm/fonts#import"
|
17
|
-
post "/cytoplasm/fonts/remove" => "Cytoplasm/fonts#remove"
|
18
|
-
post "/cytoplasm/fonts/enable" => "Cytoplasm/fonts#enable"
|
19
|
-
post "/cytoplasm/fonts/disable" => "Cytoplasm/fonts#disable"
|
20
|
-
|
21
29
|
end
|
data/lib/cytoplasm.rb
CHANGED
@@ -175,7 +175,6 @@ module Cytoplasm
|
|
175
175
|
puts "YAML configuration file contains invalid syntax. Using defaults."; return
|
176
176
|
end
|
177
177
|
load_vars(vars)
|
178
|
-
compile_css()
|
179
178
|
end
|
180
179
|
|
181
180
|
def self.save_config(opts={})
|
@@ -184,6 +183,27 @@ module Cytoplasm
|
|
184
183
|
File.open("config/cytoplasm-config.yml", 'w+') {|f| f.write(@vars.to_yaml) }
|
185
184
|
end
|
186
185
|
|
186
|
+
def self.precompile_styles(styles)
|
187
|
+
puts "PRECOMPILING CSS TO FILE"
|
188
|
+
File.open(create_path_unless_exists("public/css")+"/cytoplasm-styles.css", 'w+') {|f| f.write(styles)} if styles.is_a? String and styles!=""
|
189
|
+
end
|
190
|
+
|
191
|
+
def self.create_path_unless_exists(path)
|
192
|
+
unless File.exists?(path)
|
193
|
+
count = 0
|
194
|
+
path.split("/").each do |dir|
|
195
|
+
Dir.mkdir(dir) unless File.exists?(dir)
|
196
|
+
Dir.chdir(dir)
|
197
|
+
count += 1
|
198
|
+
end
|
199
|
+
while count > 0 do
|
200
|
+
Dir.chdir("../")
|
201
|
+
count -= 1
|
202
|
+
end
|
203
|
+
end
|
204
|
+
return path
|
205
|
+
end
|
206
|
+
|
187
207
|
# Getters and setters
|
188
208
|
def self.traverse_hash(hash,which=nil,value=nil)
|
189
209
|
return hash if which.nil?
|
@@ -246,21 +266,6 @@ module Cytoplasm
|
|
246
266
|
def self.js()
|
247
267
|
return dependencies("js")
|
248
268
|
end
|
249
|
-
def self.compile_css()
|
250
|
-
varfile = ::Rails.root+"public/cytoplasm/cytoplasm.vars.less"
|
251
|
-
# Check for varfile, create one if it doesn't exist
|
252
|
-
unless File.exists?("public/cytoplasm")
|
253
|
-
Dir.chdir("public")
|
254
|
-
Dir.mkdir("cytoplasm")
|
255
|
-
Dir.chdir("../")
|
256
|
-
end
|
257
|
-
|
258
|
-
File.open(varfile,"wb") do |f|
|
259
|
-
css = ""
|
260
|
-
@vars.each {|k,v| css += hash_to_css(k,v)}
|
261
|
-
f.write(css)
|
262
|
-
end
|
263
|
-
end
|
264
269
|
|
265
270
|
def self.hash_to_css(k,v,parent="")
|
266
271
|
output = ""
|
data/lib/cytoplasm/version.rb
CHANGED
data/test/dummy/Gemfile.lock
CHANGED
@@ -37,7 +37,7 @@ GEM
|
|
37
37
|
coffee-script-source
|
38
38
|
execjs
|
39
39
|
coffee-script-source (1.4.0)
|
40
|
-
cytoplasm (0.3.
|
40
|
+
cytoplasm (0.3.2)
|
41
41
|
jquery-rails
|
42
42
|
jquery-ui-rails
|
43
43
|
rails (~> 3.2.9)
|
@@ -59,7 +59,7 @@ GEM
|
|
59
59
|
i18n (>= 0.4.0)
|
60
60
|
mime-types (~> 1.16)
|
61
61
|
treetop (~> 1.4.8)
|
62
|
-
mime-types (1.
|
62
|
+
mime-types (1.21)
|
63
63
|
multi_json (1.5.0)
|
64
64
|
polyglot (0.3.3)
|
65
65
|
rack (1.4.5)
|