styleus 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -18,3 +18,4 @@
18
18
  @import 'base/components/option_bar';
19
19
  @import 'base/components/component_index';
20
20
  @import 'base/components/dummy_content';
21
+ @import 'base/components/index_documnentation';
@@ -1,5 +1,9 @@
1
- @mixin ambient-font {
1
+ @mixin floating-text-font {
2
2
  font-family: 'Source Sans Pro';
3
+ }
4
+
5
+ @mixin ambient-font {
6
+ @include floating-text-font;
3
7
  color: $soft-text;
4
8
  }
5
9
 
@@ -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
- .__sg_component, .CodeRay, .__code_note {
26
- @include article-side-padding;
27
- }
15
+ header {
16
+ @include component;
17
+ margin-top: 1.5em;
18
+ margin-bottom: 0.3em;
28
19
 
29
- .__sg_component {
30
- padding-top: 0.3em;
31
- padding-bottom: 1em;
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
- .__code_note {
35
- @include background(linear-gradient(bottom, #b5b5b5, #e4e4e4));
36
- @include border-radius(6px 0 0 0);
37
- @include ambient-font;
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
- .CodeRay {
46
- @include border-radius(0 0 3px 3px);
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
 
@@ -0,0 +1,5 @@
1
+ .__index_documentation {
2
+ @include default-side-margin;
3
+ margin-top: 2em;
4
+ padding-left: 0.5em;
5
+ }
@@ -3,9 +3,9 @@
3
3
  // each article.
4
4
  nav.__option_bar {
5
5
  @include component;
6
- @include default-side-margin;
7
- margin-top: 1em;
8
- margin-bottom: 0.2em;
6
+ position: absolute;
7
+ top: -2.25em;
8
+ right: 0;
9
9
 
10
10
  ul {
11
11
  li {
@@ -13,7 +13,7 @@ body { background: $main_background asset-url('styleus/themes/base/noise.png', i
13
13
  .__styleus_wrapper {
14
14
  @include box-sizing(border-box);
15
15
  @include component;
16
-
16
+ margin-bottom: 10em;
17
17
  > header {
18
18
  @include default-side-padding;
19
19
  padding-top: 2em;
@@ -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
- @view_flow.set(:representation, '')
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
- @view_flow.set(:html, '')
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
- @view_flow.set(:helper, '')
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
- build_view_components(comp_list)
32
+ _build_view_components(comp_list)
28
33
 
29
- @component_list = @components.map { |component| wrap_component 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
- build_view_components(comp_list)
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
- def wrap_component(component)
9
- article = _styleus_article_wrap(headline: component.headline, id: component.id) do
10
- styleus_partials(component.partial_path, helper: component.helper?)
11
- end
12
- option_bar(component).concat article
13
- end
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
- def styleus_partials(partial_path, options = { })
16
- #sample_template = _styleus_component_wrap(class: '__boxed') { render partial: "#{partial_path}_sample" }
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
- #sample_template.concat(plain_template).concat(helper_template || _safe_empty)
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
- # execute application partial without responding it directly,
26
- # so only the given content_for methods will help.
27
- render partial: "#{partial_path}"
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
- # returning concatenating responder partial, which consists of content_for blocks only.
30
- render(layout: 'styleus/styleus_partials') { ''.html_safe }
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 option_bar(component)
50
+ def _option_bar(component)
34
51
  _option_bar(component)
35
52
  end
36
53
 
37
- def _styleus_article_wrap(options = { }, &block)
54
+ # renders an article attribute wrap for a component
55
+ def _styleus_article_wrap(component, &block)
38
56
  captured_block = capture(&block)
39
- _article(options) { captured_block }
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(note = nil, &block)
50
- _coderay_highlight_wrap(note, &block)
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(options, &block)
11
- _render_styleus('article', locals: { headline: options[:headline], id: options[:id] }, &block)
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
- <li><a href="/components/containers">Container Components</a></li>
6
- <li><a href="/components/forms">Form Components</a></li>
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,4 +1,6 @@
1
1
  <article class="__sg_article" id="<%= id %>">
2
- <%= content_tag 'h3', headline if headline %>
2
+ <header>
3
+ <%= content_tag 'h3', headline if headline %>
4
+ </header>
3
5
  <%= yield %>
4
6
  </article>
@@ -1,3 +1,13 @@
1
- <%= content_for(:representation).html_safe %>
2
- <%= content_for(:html).html_safe %>
3
- <%= content_for(:helper).html_safe %>
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>
@@ -1,3 +1,3 @@
1
1
  module Styleus
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
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.7
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-11 00:00:00.000000000 Z
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