styleus 0.0.7 → 0.0.8
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/javascripts/styleus/behaviors/sampleContent.js.coffee +0 -2
- data/app/assets/stylesheets/styleus/themes/base.css.scss +1 -0
- data/app/assets/stylesheets/styleus/themes/base/behaviors/_text.css.scss +5 -1
- data/app/assets/stylesheets/styleus/themes/base/components/_article.css.scss +53 -31
- data/app/assets/stylesheets/styleus/themes/base/components/_index_documnentation.css.scss +5 -0
- data/app/assets/stylesheets/styleus/themes/base/components/_option_bar.css.scss +3 -3
- data/app/assets/stylesheets/styleus/themes/base/layout/main.css.scss +1 -1
- data/app/helpers/external_helper.rb +14 -9
- data/app/helpers/styleus_helper.rb +47 -26
- data/app/helpers/styleus_representer_helper.rb +2 -2
- data/app/views/components/index.html.erb +5 -2
- data/app/views/styleus/_article.html.erb +3 -1
- data/app/views/styleus/_styleus_partials.html.erb +13 -3
- data/lib/styleus/version.rb +1 -1
- metadata +3 -2
@@ -10,7 +10,6 @@ namespace 'styleus.sampleContent', (exports) ->
|
|
10
10
|
|
11
11
|
render: => @view
|
12
12
|
|
13
|
-
|
14
13
|
class Diagonal extends Shape
|
15
14
|
constructor: (@width, @height, @direction) ->
|
16
15
|
super()
|
@@ -68,7 +67,6 @@ namespace 'styleus.sampleContent', (exports) ->
|
|
68
67
|
@view.css('width', @boxWidth)
|
69
68
|
@view.css('height', @boxHeight)
|
70
69
|
|
71
|
-
|
72
70
|
addDiagonals: =>
|
73
71
|
diagonals = [new Diagonal(@boxWidth, @boxHeight), new Diagonal(@boxWidth, @boxHeight, 'inverted')]
|
74
72
|
diagonal.expand() and @view.append(diagonal.render()) for diagonal in diagonals
|
@@ -4,46 +4,68 @@
|
|
4
4
|
padding-right: 1em;
|
5
5
|
}
|
6
6
|
|
7
|
+
@mixin text-content-padding {
|
8
|
+
padding-left: 0.5em;
|
9
|
+
}
|
10
|
+
|
7
11
|
.__sg_article {
|
8
|
-
@include border-radius(3px);
|
9
|
-
@include box-shadow(0 2px 3px 0 #cdcdcd);
|
10
12
|
@include component;
|
11
13
|
@include default-side-margin;
|
12
|
-
background: $content_background;
|
13
|
-
margin-bottom: 1em;
|
14
|
-
min-height: 3em;
|
15
|
-
padding-top: 1em;
|
16
|
-
|
17
|
-
> h3 {
|
18
|
-
@include ambient-headline;
|
19
|
-
@include article-side-padding;
|
20
|
-
margin-bottom: 0.5em;
|
21
|
-
text-align: right;
|
22
|
-
color: #ccc;
|
23
|
-
}
|
24
14
|
|
25
|
-
|
26
|
-
@include
|
27
|
-
|
15
|
+
header {
|
16
|
+
@include component;
|
17
|
+
margin-top: 1.5em;
|
18
|
+
margin-bottom: 0.3em;
|
28
19
|
|
29
|
-
|
30
|
-
|
31
|
-
|
20
|
+
> h3 {
|
21
|
+
@include ambient-headline;
|
22
|
+
@include text-content-padding;
|
23
|
+
color: #222;
|
24
|
+
line-height: 1.8em;
|
25
|
+
}
|
32
26
|
}
|
33
27
|
|
34
|
-
.
|
35
|
-
@include
|
36
|
-
@include
|
37
|
-
|
38
|
-
border-top: 1px solid #cacaca;
|
39
|
-
border-bottom: 1px solid #999;
|
40
|
-
text-align: center;
|
41
|
-
//margin-top: 0.5em;
|
42
|
-
line-height: 1.5em;
|
28
|
+
.__documentation {
|
29
|
+
@include floating-text-font;
|
30
|
+
@include text-content-padding;
|
31
|
+
margin-bottom: 0.5em;
|
43
32
|
}
|
44
33
|
|
45
|
-
.
|
46
|
-
@include border-radius(
|
34
|
+
.__code_partials {
|
35
|
+
@include border-radius(3px);
|
36
|
+
@include box-shadow(0 2px 3px 0 #cdcdcd);
|
37
|
+
position: relative;
|
38
|
+
top: 0; left: 0;
|
39
|
+
|
40
|
+
background: $content_background;
|
41
|
+
margin-bottom: 1em;
|
42
|
+
min-height: 3em;
|
43
|
+
padding-top: 1em;
|
44
|
+
|
45
|
+
.__sg_component, .CodeRay, .__code_note {
|
46
|
+
@include article-side-padding;
|
47
|
+
}
|
48
|
+
|
49
|
+
.__sg_component {
|
50
|
+
padding-top: 0.3em;
|
51
|
+
padding-bottom: 1em;
|
52
|
+
}
|
53
|
+
|
54
|
+
.__code_note {
|
55
|
+
@include background(linear-gradient(bottom, #b5b5b5, #e4e4e4));
|
56
|
+
@include border-radius(6px 0 0 0);
|
57
|
+
@include ambient-font;
|
58
|
+
border-top: 1px solid #cacaca;
|
59
|
+
border-bottom: 1px solid #999;
|
60
|
+
text-align: center;
|
61
|
+
//margin-top: 0.5em;
|
62
|
+
line-height: 1.5em;
|
63
|
+
}
|
64
|
+
|
65
|
+
.CodeRay {
|
66
|
+
@include border-radius(0 0 3px 3px);
|
67
|
+
}
|
68
|
+
|
47
69
|
}
|
48
70
|
}
|
49
71
|
|
@@ -1,19 +1,24 @@
|
|
1
1
|
require 'styleus_helper'
|
2
2
|
|
3
3
|
module ExternalHelper
|
4
|
+
def index_documentation(&block)
|
5
|
+
content_tag 'section', class: '__index_documentation', &block
|
6
|
+
end
|
7
|
+
|
8
|
+
def documentation(&block)
|
9
|
+
_cleared_content_for :documentation, _styleus_documentation_wrap(&block)
|
10
|
+
end
|
11
|
+
|
4
12
|
def display(&block)
|
5
|
-
|
6
|
-
content_for :representation, _styleus_component_wrap(&block)
|
13
|
+
_cleared_content_for :representation, _styleus_component_wrap(&block)
|
7
14
|
end
|
8
15
|
|
9
16
|
def html(&block)
|
10
|
-
|
11
|
-
content_for :html, _html_representation(&block)
|
17
|
+
_cleared_content_for :html, _html_representation(&block)
|
12
18
|
end
|
13
19
|
|
14
20
|
def helper(&block)
|
15
|
-
|
16
|
-
content_for :helper, _helper_representation(&block)
|
21
|
+
_cleared_content_for :helper, _helper_representation(&block)
|
17
22
|
end
|
18
23
|
|
19
24
|
def styleus_page(comp_list = [])
|
@@ -24,15 +29,15 @@ module ExternalHelper
|
|
24
29
|
end
|
25
30
|
|
26
31
|
def styleus_components(comp_list)
|
27
|
-
|
32
|
+
_build_view_components(comp_list)
|
28
33
|
|
29
|
-
@component_list = @components.map { |component|
|
34
|
+
@component_list = @components.map { |component| _wrap_component component }
|
30
35
|
|
31
36
|
@component_list.join.html_safe
|
32
37
|
end
|
33
38
|
|
34
39
|
def styleus_index(comp_list)
|
35
|
-
|
40
|
+
_build_view_components(comp_list)
|
36
41
|
_component_index(components_category, @components)
|
37
42
|
end
|
38
43
|
end
|
@@ -1,42 +1,60 @@
|
|
1
1
|
require 'styleus_representer_helper'
|
2
2
|
|
3
3
|
module StyleusHelper
|
4
|
-
def build_view_components(comp_list)
|
5
|
-
@components ||= Styleus::ViewComponent.from_hashes(comp_list)
|
6
|
-
end
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
# this heart of gold function renders the app component partials
|
6
|
+
# and enables the configured content_for blocks for the target
|
7
|
+
# partial called styleus_partials.
|
8
|
+
def _styleus_partials(component, options = { })
|
9
|
+
# execute application partial without responding it directly,
|
10
|
+
# so only the given content_for methods will help.
|
11
|
+
render partial: "#{component.partial_path}"
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
#plain_template = _html_representation("#{partial_path}.html.erb") { render partial: "#{partial_path}" }
|
19
|
-
#
|
20
|
-
#helper_template = _helper_representation { render partial: "#{partial_path}_helper" } if options[:helper]
|
13
|
+
# returning concatenating responder partial, which consists of content_for blocks only.
|
14
|
+
render(layout: 'styleus/styleus_partials', locals: { component: component }) { }
|
15
|
+
end
|
21
16
|
|
22
|
-
|
17
|
+
# To use the render layout: '...' method multiple times
|
18
|
+
# for the several components, including the same content_for
|
19
|
+
# blocks each time, we have to clean up them before registering
|
20
|
+
# the next blocks.
|
21
|
+
#
|
22
|
+
# So this function wraps the content_for function with
|
23
|
+
# a prepended clearing for the specific content_for attribute,
|
24
|
+
# so that earlier defined content_for areas are not
|
25
|
+
# rendered again.
|
26
|
+
def _cleared_content_for(content_name, content)
|
27
|
+
# clear content_for calls for this name
|
28
|
+
@view_flow.set(content_name, '')
|
29
|
+
|
30
|
+
# set new content_for for this name
|
31
|
+
content_for content_name, content
|
32
|
+
end
|
23
33
|
|
24
34
|
|
25
|
-
|
26
|
-
|
27
|
-
|
35
|
+
# converts the list of component hashes configured in the
|
36
|
+
# app to a list of ViewComponent instances.
|
37
|
+
def _build_view_components(comp_list)
|
38
|
+
@components ||= Styleus::ViewComponent.from_hashes(comp_list)
|
39
|
+
end
|
28
40
|
|
29
|
-
|
30
|
-
|
41
|
+
# wraps a component in an article and combines it with
|
42
|
+
# a depending optionbar, that enables the user to show
|
43
|
+
# and hide the different partials.
|
44
|
+
def _wrap_component(component)
|
45
|
+
_styleus_article_wrap(component) do
|
46
|
+
_styleus_partials(component, helper: component.helper?)
|
47
|
+
end
|
31
48
|
end
|
32
49
|
|
33
|
-
def
|
50
|
+
def _option_bar(component)
|
34
51
|
_option_bar(component)
|
35
52
|
end
|
36
53
|
|
37
|
-
|
54
|
+
# renders an article attribute wrap for a component
|
55
|
+
def _styleus_article_wrap(component, &block)
|
38
56
|
captured_block = capture(&block)
|
39
|
-
_article(
|
57
|
+
_article(component) { captured_block }
|
40
58
|
end
|
41
59
|
|
42
60
|
def _styleus_component_wrap(options = { }, &block)
|
@@ -45,9 +63,12 @@ module StyleusHelper
|
|
45
63
|
_component(classes) { captured_block }
|
46
64
|
end
|
47
65
|
|
66
|
+
def _styleus_documentation_wrap(options = { }, &block)
|
67
|
+
captured_block = capture(&block)
|
68
|
+
end
|
48
69
|
|
49
|
-
def _html_representation(
|
50
|
-
_coderay_highlight_wrap(
|
70
|
+
def _html_representation(&block)
|
71
|
+
_coderay_highlight_wrap('HTML Snippet', &block)
|
51
72
|
end
|
52
73
|
|
53
74
|
def _helper_representation(&block)
|
@@ -7,8 +7,8 @@ module StyleusRepresenterHelper
|
|
7
7
|
_render_styleus('component_index', locals: { headline: headline, components: components })
|
8
8
|
end
|
9
9
|
|
10
|
-
def _article(
|
11
|
-
_render_styleus('article', locals: { headline:
|
10
|
+
def _article(component, &block)
|
11
|
+
_render_styleus('article', locals: { headline: component.headline, id: component.id, component: component }, &block)
|
12
12
|
end
|
13
13
|
|
14
14
|
def _component(classes, &block)
|
@@ -2,8 +2,11 @@
|
|
2
2
|
<nav class="__component_index">
|
3
3
|
<h3>Components</h3>
|
4
4
|
<ul>
|
5
|
-
|
6
|
-
|
5
|
+
<!--<li><a href="/components/containers">Container Components</a></li>-->
|
6
|
+
<!--<li><a href="/components/forms">Form Components</a></li>-->
|
7
|
+
<% Styleus::Component.spaces.each do |space| %>
|
8
|
+
<li><%= link_to space.to_s.camelcase, send(:"#{space}_path") %></li>
|
9
|
+
<% end %>
|
7
10
|
</ul>
|
8
11
|
</nav>
|
9
12
|
</div>
|
@@ -1,3 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%= content_for
|
1
|
+
<% if content_for? :documentation %>
|
2
|
+
<section class="__documentation">
|
3
|
+
<%= content_for :documentation %>
|
4
|
+
</section>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<section class="__code_partials">
|
8
|
+
<%= _option_bar(component) %>
|
9
|
+
|
10
|
+
<%= content_for(:representation).html_safe %>
|
11
|
+
<%= content_for(:html).html_safe %>
|
12
|
+
<%= content_for(:helper).html_safe %>
|
13
|
+
</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.8
|
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-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- app/assets/stylesheets/styleus/themes/base/components/_article.css.scss
|
91
91
|
- app/assets/stylesheets/styleus/themes/base/components/_component_index.css.scss
|
92
92
|
- app/assets/stylesheets/styleus/themes/base/components/_dummy_content.css.scss
|
93
|
+
- app/assets/stylesheets/styleus/themes/base/components/_index_documnentation.css.scss
|
93
94
|
- app/assets/stylesheets/styleus/themes/base/components/_option_bar.css.scss
|
94
95
|
- app/assets/stylesheets/styleus/themes/base/fonts/raphael.css.scss
|
95
96
|
- app/assets/stylesheets/styleus/themes/base/layout/main.css.scss
|