styleus 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/stylesheets/styleus/themes/base/components/_article.css.scss +2 -1
- data/app/assets/stylesheets/styleus/themes/base/components/_index_documnentation.css.scss +7 -0
- data/app/helpers/external_helper.rb +1 -1
- data/app/helpers/styleus_helper.rb +47 -2
- data/app/helpers/styleus_representer_helper.rb +2 -2
- data/app/views/components/index.html.erb +0 -2
- data/app/views/styleus/_component.html.erb +4 -2
- data/app/views/styleus/_styleus_partials.html.erb +1 -2
- data/lib/styleus/version.rb +1 -1
- metadata +2 -2
@@ -22,6 +22,7 @@
|
|
22
22
|
@include text-content-padding;
|
23
23
|
color: #222;
|
24
24
|
line-height: 1.8em;
|
25
|
+
width: 80%;
|
25
26
|
}
|
26
27
|
}
|
27
28
|
|
@@ -29,6 +30,7 @@
|
|
29
30
|
@include floating-text-font;
|
30
31
|
@include text-content-padding;
|
31
32
|
margin-bottom: 0.5em;
|
33
|
+
width: 80%;
|
32
34
|
}
|
33
35
|
|
34
36
|
.__code_partials {
|
@@ -36,7 +38,6 @@
|
|
36
38
|
@include box-shadow(0 2px 3px 0 #cdcdcd);
|
37
39
|
position: relative;
|
38
40
|
top: 0; left: 0;
|
39
|
-
|
40
41
|
background: $content_background;
|
41
42
|
margin-bottom: 1em;
|
42
43
|
min-height: 3em;
|
@@ -1,6 +1,50 @@
|
|
1
1
|
require 'styleus_representer_helper'
|
2
2
|
|
3
3
|
module StyleusHelper
|
4
|
+
def _application_context(&block)
|
5
|
+
captured_block = capture(&block)
|
6
|
+
|
7
|
+
layout_name = 'styleus_context'
|
8
|
+
file_name = "_#{layout_name}.html.erb"
|
9
|
+
|
10
|
+
if _layout_exists?(file_name)
|
11
|
+
render(layout: File.join('layouts', layout_name)) { captured_block }
|
12
|
+
else
|
13
|
+
captured_block
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def _component_context(file_path, &block)
|
18
|
+
captured_block = capture(&block)
|
19
|
+
|
20
|
+
view_path = _folder_path(file_path)
|
21
|
+
|
22
|
+
partial_name = 'component_context'
|
23
|
+
partial_path = File.join view_path, 'component_context'
|
24
|
+
file_path = File.join view_path, "_#{partial_name}.html.erb"
|
25
|
+
|
26
|
+
if _partial_exists?(file_path)
|
27
|
+
render(layout: partial_path) { captured_block }
|
28
|
+
else
|
29
|
+
captured_block
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def _folder_path(path)
|
34
|
+
path = path.split(File::SEPARATOR)
|
35
|
+
path.pop
|
36
|
+
path.join(File::SEPARATOR)
|
37
|
+
end
|
38
|
+
|
39
|
+
def _partial_exists?(view_path)
|
40
|
+
file_path = Rails.root.join('app', 'views', view_path)
|
41
|
+
File.exists? file_path
|
42
|
+
end
|
43
|
+
|
44
|
+
def _layout_exists?(file_name)
|
45
|
+
file_path = Rails.root.join('app', 'views', 'layouts', file_name)
|
46
|
+
File.exists? file_path
|
47
|
+
end
|
4
48
|
|
5
49
|
# this heart of gold function renders the app component partials
|
6
50
|
# and enables the configured content_for blocks for the target
|
@@ -8,7 +52,7 @@ module StyleusHelper
|
|
8
52
|
def _styleus_partials(component, options = { })
|
9
53
|
# execute application partial without responding it directly,
|
10
54
|
# so only the given content_for methods will help.
|
11
|
-
render partial: "#{component.partial_path}"
|
55
|
+
render partial: "#{component.partial_path}", locals: { component: component }
|
12
56
|
|
13
57
|
# returning concatenating responder partial, which consists of content_for blocks only.
|
14
58
|
render(layout: 'styleus/styleus_partials', locals: { component: component }) { }
|
@@ -60,9 +104,10 @@ module StyleusHelper
|
|
60
104
|
def _styleus_component_wrap(options = { }, &block)
|
61
105
|
captured_block = capture(&block)
|
62
106
|
classes = %W{__sg_component #{options[:class]}}.join(' ')
|
63
|
-
_component(classes) { captured_block }
|
107
|
+
_component(classes, options[:partial_path]) { captured_block }
|
64
108
|
end
|
65
109
|
|
110
|
+
# TODO: what does this method do?
|
66
111
|
def _styleus_documentation_wrap(options = { }, &block)
|
67
112
|
captured_block = capture(&block)
|
68
113
|
end
|
@@ -11,8 +11,8 @@ module StyleusRepresenterHelper
|
|
11
11
|
_render_styleus('article', locals: { headline: component.headline, id: component.id, component: component }, &block)
|
12
12
|
end
|
13
13
|
|
14
|
-
def _component(classes, &block)
|
15
|
-
_render_styleus('component', locals: { classes: classes }, &block)
|
14
|
+
def _component(classes, partial_path, &block)
|
15
|
+
_render_styleus('component', locals: { classes: classes, partial_path: partial_path }, &block)
|
16
16
|
end
|
17
17
|
|
18
18
|
def _code_note(note)
|
@@ -2,8 +2,6 @@
|
|
2
2
|
<nav class="__component_index">
|
3
3
|
<h3>Components</h3>
|
4
4
|
<ul>
|
5
|
-
<!--<li><a href="/components/containers">Container Components</a></li>-->
|
6
|
-
<!--<li><a href="/components/forms">Form Components</a></li>-->
|
7
5
|
<% Styleus::Component.spaces.each do |space| %>
|
8
6
|
<li><%= link_to space.to_s.camelcase, send(:"#{space}_path") %></li>
|
9
7
|
<% end %>
|
@@ -6,8 +6,7 @@
|
|
6
6
|
|
7
7
|
<section class="__code_partials">
|
8
8
|
<%= _option_bar(component) %>
|
9
|
-
|
10
|
-
<%= content_for(:representation).html_safe %>
|
9
|
+
<%= _styleus_component_wrap(partial_path: component.partial_path) { content_for(:representation).html_safe } %>
|
11
10
|
<%= content_for(:html).html_safe %>
|
12
11
|
<%= content_for(:helper).html_safe %>
|
13
12
|
</section>
|
data/lib/styleus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: styleus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|