styleus 0.0.5 → 0.0.6
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/stylesheets/styleus/themes/base.css.scss +1 -2
- data/app/assets/stylesheets/styleus/themes/base/behaviors/_text.css.scss +1 -1
- data/app/assets/stylesheets/styleus/themes/base/coderay.css.scss +1 -1
- data/app/assets/stylesheets/styleus/themes/base/components/_component_index.css.scss +5 -4
- data/app/assets/stylesheets/styleus/themes/base/layout/main.css.scss +1 -1
- data/app/helpers/styleus_helper.rb +18 -47
- data/app/helpers/styleus_representer_helper.rb +37 -0
- data/app/views/styleus/_article.html.erb +4 -0
- data/app/views/styleus/_code.html.erb +3 -0
- data/app/views/styleus/_code_note.html.erb +1 -0
- data/app/views/styleus/_component.html.erb +5 -0
- data/app/views/styleus/_component_index.html.erb +10 -0
- data/app/views/styleus/_option_bar.html.erb +14 -0
- data/lib/styleus/version.rb +1 -1
- metadata +9 -7
- data/app/assets/fonts/calluna_license.txt +0 -26
- data/app/assets/fonts/calluna_regular.eot +0 -0
- data/app/assets/fonts/calluna_regular.ttf +0 -0
- data/app/assets/fonts/calluna_regular.woff +0 -0
- data/app/assets/stylesheets/styleus/themes/base/fonts/calluna.css.scss +0 -26
@@ -1,4 +1,4 @@
|
|
1
|
-
@import url(http://fonts.googleapis.com/css?family=Oleo+Script:700);
|
1
|
+
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700|Oleo+Script:400,700|Source+Code+Pro:400,700);
|
2
2
|
|
3
3
|
@import "compass";
|
4
4
|
@import "compass/reset";
|
@@ -6,7 +6,6 @@
|
|
6
6
|
@import "compass/css3/user-interface";
|
7
7
|
|
8
8
|
@import "base/fonts/raphael";
|
9
|
-
@import "base/fonts/calluna";
|
10
9
|
|
11
10
|
@import 'base/settings/colors';
|
12
11
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
h3 {
|
14
14
|
@include default-index-alignment;
|
15
|
-
font-family: '
|
15
|
+
font-family: 'Source Sans Pro';
|
16
16
|
color: #bb9b1d;
|
17
17
|
font-size: 1.2em;
|
18
18
|
letter-spacing: 0.12em;
|
@@ -23,14 +23,15 @@
|
|
23
23
|
}
|
24
24
|
|
25
25
|
ul {
|
26
|
-
@include
|
26
|
+
@include component;
|
27
27
|
|
28
28
|
li {
|
29
|
+
@include default-index-alignment;
|
29
30
|
text-align: right;
|
30
31
|
margin-bottom: 0.3em;
|
31
32
|
|
32
33
|
a:link, a:visited, a:hover, a:active {
|
33
|
-
font-family: '
|
34
|
+
font-family: 'Source Sans Pro';
|
34
35
|
letter-spacing: 0.12em;
|
35
36
|
color: #ccc;
|
36
37
|
text-decoration: none;
|
@@ -44,7 +45,7 @@
|
|
44
45
|
height: 0.8em;
|
45
46
|
position: absolute;
|
46
47
|
right: -9999px - 5;
|
47
|
-
top: 0;
|
48
|
+
top: 0.15em;
|
48
49
|
border-bottom: 1px dashed #bb9b1d;
|
49
50
|
}
|
50
51
|
}
|
@@ -31,7 +31,7 @@ body { background: $main_background asset-url('styleus/themes/base/noise.png', i
|
|
31
31
|
float: right;
|
32
32
|
text-decoration: none;
|
33
33
|
font-size: 2em;
|
34
|
-
font-family: '
|
34
|
+
font-family: 'Source Sans Pro';
|
35
35
|
text-transform: none;
|
36
36
|
font-weight: bold;
|
37
37
|
opacity: 0.4;
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'styleus_representer_helper'
|
2
|
+
|
1
3
|
module StyleusHelper
|
2
4
|
def styleus(comp_list = [])
|
3
5
|
@components = Styleus::ViewComponent.from_hashes(comp_list)
|
@@ -17,89 +19,58 @@ module StyleusHelper
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def styleus_partials(partial_path, options = { })
|
20
|
-
sample_template =
|
22
|
+
sample_template = _styleus_component_wrap(class: '__boxed') { render partial: "#{partial_path}_sample" }
|
21
23
|
|
22
24
|
plain_template = _html_representation("#{partial_path}.html.erb") { render partial: "#{partial_path}" }
|
23
25
|
|
24
26
|
helper_template = _helper_representation { render partial: "#{partial_path}_helper" } if options[:helper]
|
25
27
|
|
26
|
-
sample_template.concat(plain_template).concat(helper_template ||
|
28
|
+
sample_template.concat(plain_template).concat(helper_template || _safe_empty)
|
27
29
|
end
|
28
30
|
|
29
31
|
def option_bar(component)
|
30
|
-
|
31
|
-
content_tag 'ul' do
|
32
|
-
html_area = content_tag('li') { link_to t('icons.html'), component_path(component), title: t('links.titles.html'), class: 'icon', data: { toggle: "##{component.id} [data-subject=html-representation]" } }
|
33
|
-
helper_area = content_tag('li') { link_to t('icons.helper'), component_path(component), title: t('links.titles.helper'), class: 'icon', data: { toggle: "##{component.id} [data-subject=ruby-representation]" } } if component.helper?
|
34
|
-
presentation_area = content_tag('li') { link_to t('icons.expand_all'), component_path(component), title: t('links.titles.expand_all'), class: 'icon', data: { toggle: "##{component.id} [data-subject*=representation]" } }
|
35
|
-
|
36
|
-
html_area.concat(helper_area || safe_empty).concat(presentation_area)
|
37
|
-
end
|
38
|
-
end
|
32
|
+
_option_bar(component)
|
39
33
|
end
|
40
34
|
|
41
35
|
def component_index(headline)
|
42
|
-
|
43
|
-
content_tag 'nav', class: "__component_index" do
|
44
|
-
menu_entries = content_tag 'ul' do
|
45
|
-
content_tag_for(:li, @components) do |component|
|
46
|
-
link_to component.headline, anchor: component.id
|
47
|
-
end
|
48
|
-
end
|
49
|
-
content_tag('h3', headline).concat menu_entries
|
50
|
-
end
|
51
|
-
|
36
|
+
_component_index(headline, @components)
|
52
37
|
end
|
53
38
|
|
54
39
|
def _styleus_article_wrap(options = { }, &block)
|
55
40
|
captured_block = capture(&block)
|
56
|
-
|
57
|
-
content_tag('article', class: '__sg_article', id: options[:id]) do
|
58
|
-
content = safe_empty
|
59
|
-
headline = options[:headline]
|
60
|
-
content.concat(content_tag('h3', headline)) if headline
|
61
|
-
content.concat(captured_block)
|
62
|
-
content
|
63
|
-
end
|
41
|
+
_article(options) { captured_block }
|
64
42
|
end
|
65
43
|
|
66
|
-
def
|
44
|
+
def _styleus_component_wrap(options = { }, &block)
|
67
45
|
captured_block = capture(&block)
|
68
|
-
|
69
|
-
classes
|
70
|
-
content_tag('section', class: classes) do
|
71
|
-
render layout: 'layouts/styleus_context' do
|
72
|
-
captured_block.to_s.html_safe
|
73
|
-
end
|
74
|
-
end
|
46
|
+
classes = %W{__sg_component #{options[:class]}}.join(' ')
|
47
|
+
_component(classes) { captured_block }
|
75
48
|
end
|
76
49
|
|
77
50
|
|
78
51
|
def _html_representation(note = nil, &block)
|
79
|
-
_coderay_highlight_wrap(note,
|
52
|
+
_coderay_highlight_wrap(note, &block)
|
80
53
|
end
|
81
54
|
|
82
55
|
def _helper_representation(&block)
|
83
56
|
_coderay_highlight_wrap('Rails Helper', type: :ruby, &block)
|
84
57
|
end
|
85
58
|
|
86
|
-
def _coderay_highlight_wrap(note = nil, options = {
|
59
|
+
def _coderay_highlight_wrap(note = nil, options = { }, &block)
|
87
60
|
captured_block = capture(&block)
|
88
|
-
|
61
|
+
type = options[:type] || :html
|
89
62
|
|
90
|
-
|
63
|
+
highlighted_code = _highlight(captured_block.to_s, type)
|
64
|
+
code_with_note = _code_note(note).concat highlighted_code
|
91
65
|
|
92
|
-
|
93
|
-
content_tag('div', data: { subject: "#{options[:type]}-representation" }) do
|
94
|
-
highlighted_code.html_safe
|
95
|
-
end
|
66
|
+
_code(code_with_note, type)
|
96
67
|
end
|
97
68
|
|
98
69
|
def _joined_component_list
|
99
70
|
@component_list.join.html_safe
|
100
71
|
end
|
101
72
|
|
102
|
-
def
|
103
|
-
|
73
|
+
def _highlight(code, type)
|
74
|
+
CodeRay.scan(code, type).div(:css => :class, line_numbers: :table).html_safe
|
104
75
|
end
|
105
76
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module StyleusRepresenterHelper
|
2
|
+
def _option_bar(component)
|
3
|
+
_render_styleus('option_bar', locals: { component: component })
|
4
|
+
end
|
5
|
+
|
6
|
+
def _component_index(headline, components)
|
7
|
+
_render_styleus('component_index', locals: { headline: headline, components: components })
|
8
|
+
end
|
9
|
+
|
10
|
+
def _article(options, &block)
|
11
|
+
_render_styleus('article', locals: { headline: options[:headline], id: options[:id] }, &block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def _component(classes, &block)
|
15
|
+
_render_styleus('component', locals: { classes: classes }, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def _code_note(note)
|
19
|
+
note ? _render_styleus('code_note', object: note) : safe_empty
|
20
|
+
end
|
21
|
+
|
22
|
+
def _code(code, type)
|
23
|
+
_render_styleus 'code', object: code, locals: { type: type }
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def _render_styleus(styleus_partial, options = { }, &block)
|
28
|
+
render_type = block_given? ? 'layout' : 'partial'
|
29
|
+
partial_path = "styleus/#{styleus_partial}"
|
30
|
+
render_options = { :"#{render_type}" => partial_path }.merge options
|
31
|
+
render render_options, &block
|
32
|
+
end
|
33
|
+
|
34
|
+
def _safe_empty
|
35
|
+
''.html_safe
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<p class="__code_note"><%= code_note %></p>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% unless components.empty? %>
|
2
|
+
<nav class="__component_index">
|
3
|
+
<%= content_tag 'h3', headline if headline %>
|
4
|
+
<ul>
|
5
|
+
<%= content_tag_for(:li, components) do |component| %>
|
6
|
+
<%= link_to component.headline, anchor: component.id %>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
</nav>
|
10
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<nav class="__option_bar">
|
2
|
+
<ul>
|
3
|
+
<li><%= link_to t('icons.html'), component_path(component),
|
4
|
+
title: t('links.titles.html'), class: 'icon', data: { toggle: "##{component.id} [data-subject=html-representation]" } %></li>
|
5
|
+
|
6
|
+
<% if component.helper? %>
|
7
|
+
<li><%= link_to t('icons.helper'), component_path(component),
|
8
|
+
title: t('links.titles.helper'), class: 'icon', data: { toggle: "##{component.id} [data-subject=ruby-representation]" } %></li>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<li><%= link_to t('icons.expand_all'), component_path(component),
|
12
|
+
title: t('links.titles.expand_all'), class: 'icon', data: { toggle: "##{component.id} [data-subject*=representation]" } %></li>
|
13
|
+
</ul>
|
14
|
+
</nav>
|
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.6
|
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-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -67,10 +67,6 @@ executables: []
|
|
67
67
|
extensions: []
|
68
68
|
extra_rdoc_files: []
|
69
69
|
files:
|
70
|
-
- app/assets/fonts/calluna_license.txt
|
71
|
-
- app/assets/fonts/calluna_regular.eot
|
72
|
-
- app/assets/fonts/calluna_regular.ttf
|
73
|
-
- app/assets/fonts/calluna_regular.woff
|
74
70
|
- app/assets/fonts/raphaelicons-webfont.eot
|
75
71
|
- app/assets/fonts/raphaelicons-webfont.svg
|
76
72
|
- app/assets/fonts/raphaelicons-webfont.ttf
|
@@ -93,7 +89,6 @@ files:
|
|
93
89
|
- app/assets/stylesheets/styleus/themes/base/components/_article.css.scss
|
94
90
|
- app/assets/stylesheets/styleus/themes/base/components/_component_index.css.scss
|
95
91
|
- app/assets/stylesheets/styleus/themes/base/components/_option_bar.css.scss
|
96
|
-
- app/assets/stylesheets/styleus/themes/base/fonts/calluna.css.scss
|
97
92
|
- app/assets/stylesheets/styleus/themes/base/fonts/raphael.css.scss
|
98
93
|
- app/assets/stylesheets/styleus/themes/base/layout/main.css.scss
|
99
94
|
- app/assets/stylesheets/styleus/themes/base/settings/_colors.css.scss
|
@@ -102,6 +97,7 @@ files:
|
|
102
97
|
- app/controllers/components_controller.rb
|
103
98
|
- app/helpers/path_helper.rb
|
104
99
|
- app/helpers/styleus_helper.rb
|
100
|
+
- app/helpers/styleus_representer_helper.rb
|
105
101
|
- app/models/styleus/base.rb
|
106
102
|
- app/models/styleus/component.rb
|
107
103
|
- app/models/styleus/view_component.rb
|
@@ -109,6 +105,12 @@ files:
|
|
109
105
|
- app/views/components/show.html.erb
|
110
106
|
- app/views/layouts/_styleus.html.erb
|
111
107
|
- app/views/layouts/_styleus_context.html.erb
|
108
|
+
- app/views/styleus/_article.html.erb
|
109
|
+
- app/views/styleus/_code.html.erb
|
110
|
+
- app/views/styleus/_code_note.html.erb
|
111
|
+
- app/views/styleus/_component.html.erb
|
112
|
+
- app/views/styleus/_component_index.html.erb
|
113
|
+
- app/views/styleus/_option_bar.html.erb
|
112
114
|
- app/views/styleus/_screen_size_viewer.html.erb
|
113
115
|
- config/initializers/01_styleus_config.rb
|
114
116
|
- config/initializers/02_init_container_routes.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/* @license
|
2
|
-
* MyFonts Webfont Build ID 2427055, 2012-12-09T11:36:08-0500
|
3
|
-
*
|
4
|
-
* The fonts listed in this notice are subject to the End User License
|
5
|
-
* Agreement(s) entered into by the website owner. All other parties are
|
6
|
-
* explicitly restricted from using the Licensed Webfonts(s).
|
7
|
-
*
|
8
|
-
* You may obtain a valid license at the URLs below.
|
9
|
-
*
|
10
|
-
* Webfont: Calluna Regular by exljbris
|
11
|
-
* URL: http://www.myfonts.com/fonts/exljbris/calluna/regular/
|
12
|
-
* Copyright: © 2009 exljbris Font Foundry. All rights reserved.
|
13
|
-
* Licensed pageviews: Unlimited
|
14
|
-
*
|
15
|
-
*
|
16
|
-
* License: http://www.myfonts.com/viewlicense?type=web&buildid=2427055
|
17
|
-
*
|
18
|
-
* © 2012 Bitstream Inc
|
19
|
-
*/
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/* @license
|
2
|
-
* MyFonts Webfont Build ID 2427055, 2012-12-09T11:36:08-0500
|
3
|
-
*
|
4
|
-
* The fonts listed in this notice are subject to the End User License
|
5
|
-
* Agreement(s) entered into by the website owner. All other parties are
|
6
|
-
* explicitly restricted from using the Licensed Webfonts(s).
|
7
|
-
*
|
8
|
-
* You may obtain a valid license at the URLs below.
|
9
|
-
*
|
10
|
-
* Webfont: Calluna Regular by exljbris
|
11
|
-
* URL: http://www.myfonts.com/fonts/exljbris/calluna/regular/
|
12
|
-
* Copyright: © 2009 exljbris Font Foundry. All rights reserved.
|
13
|
-
* Licensed pageviews: Unlimited
|
14
|
-
*
|
15
|
-
*
|
16
|
-
* License: http://www.myfonts.com/viewlicense?type=web&buildid=2427055
|
17
|
-
*
|
18
|
-
* © 2012 Bitstream Inc
|
19
|
-
*/
|
20
|
-
|
21
|
-
|
22
|
-
@font-face {
|
23
|
-
font-family: 'Calluna-Regular';
|
24
|
-
src: asset-url('calluna_regular.eot', font);
|
25
|
-
src: asset-url('calluna_regular.eot#iefix', font) format('embedded-opentype'), asset-url('calluna_regular.woff', font) format('woff'), asset-url('calluna_regular.ttf', font) format('truetype');
|
26
|
-
}
|