style-guide 0.3.0 → 0.4.0
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/.env +1 -0
- data/.travis.yml +1 -0
- data/Guardfile +2 -0
- data/Procfile +1 -0
- data/app/assets/stylesheets/style_guide/example.css +39 -11
- data/app/assets/stylesheets/style_guide/header.css +8 -2
- data/app/assets/stylesheets/style_guide/layout.css +34 -9
- data/app/assets/stylesheets/style_guide/navbar.css +2 -1
- data/app/assets/stylesheets/style_guide/sidebar.css +6 -1
- data/app/views/style_guide/buttons/_disabled_anchor.erb +2 -0
- data/app/views/style_guide/buttons/_disabled_element.erb +2 -0
- data/app/views/style_guide/buttons/_sizes.erb +4 -0
- data/app/views/style_guide/buttons/_types.erb +8 -0
- data/app/views/style_guide/{bootstrap_base/_form_controls:_checkbox_and_radio.erb → forms/_controls:_checkbox_and_radio.erb} +0 -0
- data/app/views/style_guide/{bootstrap_base/_form_controls:_input.erb → forms/_controls:_input.erb} +0 -0
- data/app/views/style_guide/{bootstrap_base/_form_controls:_select.erb → forms/_controls:_select.erb} +0 -0
- data/app/views/style_guide/{bootstrap_base/_form_controls:_textarea.erb → forms/_controls:_textarea.erb} +0 -0
- data/app/views/style_guide/{bootstrap_base/_forms:_default_styles.erb → forms/_default_styles.erb} +0 -0
- data/app/views/style_guide/{bootstrap_base/_forms:_horizontal.erb → forms/_horizontal.erb} +0 -0
- data/app/views/style_guide/{bootstrap_base/_forms:_inline.erb → forms/_inline.erb} +0 -0
- data/app/views/style_guide/{bootstrap_base/_forms:_search.erb → forms/_search.erb} +0 -0
- data/app/views/style_guide/images/_dropdown_icons.erb +9 -0
- data/app/views/style_guide/images/_form_fields.erb +10 -0
- data/app/views/style_guide/images/_icon_buttons.erb +4 -0
- data/app/views/style_guide/images/_navigation.erb +8 -0
- data/app/views/style_guide/images/_placeholders.erb +3 -0
- data/app/views/style_guide/images/_small_button.erb +1 -0
- data/app/views/style_guide/style/_example.erb +12 -5
- data/app/views/style_guide/style/_sidebar.erb +7 -5
- data/app/views/style_guide/style/show.html.erb +1 -3
- data/app/views/style_guide/tables/_bordered.erb +34 -0
- data/app/views/style_guide/tables/_condensed.erb +29 -0
- data/app/views/style_guide/tables/_default_style.erb +24 -0
- data/app/views/style_guide/tables/_hover.erb +29 -0
- data/app/views/style_guide/tables/_row_classes.erb +36 -0
- data/app/views/style_guide/tables/_striped.erb +30 -0
- data/app/views/style_guide/typography/_abbreviation.erb +4 -0
- data/app/views/style_guide/typography/_address.erb +10 -0
- data/app/views/style_guide/typography/_blockquote.erb +14 -0
- data/app/views/style_guide/typography/_body_copy.erb +12 -0
- data/app/views/style_guide/{bootstrap_base/_code:_blocks.erb → typography/_code.erb} +3 -0
- data/app/views/style_guide/typography/_description_list.erb +17 -0
- data/app/views/style_guide/typography/_emphasis.erb +5 -0
- data/app/views/style_guide/typography/_emphasis_classes.erb +5 -0
- data/app/views/style_guide/typography/_headings.erb +6 -0
- data/app/views/style_guide/typography/_ordered_list.erb +4 -0
- data/app/views/style_guide/typography/_unordered_list.erb +15 -0
- data/config/locales/en.yml +88 -36
- data/lib/style_guide/config.rb +18 -2
- data/lib/style_guide/partial.rb +40 -3
- data/lib/style_guide/section.rb +1 -1
- data/lib/style_guide/version.rb +1 -1
- data/spec/dummy/app/assets/stylesheets/swatches.css +0 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/environments/development.rb +2 -0
- data/spec/lib/style_guide/config_spec.rb +18 -3
- data/spec/lib/style_guide/partial_spec.rb +49 -1
- data/style-guide.gemspec +5 -7
- metadata +58 -56
- data/Gemfile.lock +0 -159
- data/app/views/style_guide/bootstrap_base/_button:_disabled_anchor.erb +0 -2
- data/app/views/style_guide/bootstrap_base/_button:_disabled_element.erb +0 -2
- data/app/views/style_guide/bootstrap_base/_button_sizes.erb +0 -16
- data/app/views/style_guide/bootstrap_base/_button_types.erb +0 -51
- data/app/views/style_guide/bootstrap_base/_code:_inline.erb +0 -1
- data/app/views/style_guide/bootstrap_base/_images.erb +0 -136
- data/app/views/style_guide/bootstrap_base/_tables.erb +0 -409
- data/app/views/style_guide/bootstrap_base/_typography.erb +0 -331
@@ -0,0 +1,24 @@
|
|
1
|
+
<table class="table">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>#</th>
|
5
|
+
<th>First Name</th>
|
6
|
+
<th>Last Name</th>
|
7
|
+
<th>Username</th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<tr>
|
12
|
+
<td>1</td>
|
13
|
+
<td>Mark</td>
|
14
|
+
<td>Otto</td>
|
15
|
+
<td>@mdo</td>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td>2</td>
|
19
|
+
<td>Jacob</td>
|
20
|
+
<td>Thornton</td>
|
21
|
+
<td>@fat</td>
|
22
|
+
</tr>
|
23
|
+
</tbody>
|
24
|
+
</table>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<table class="table table-hover">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>#</th>
|
5
|
+
<th>First Name</th>
|
6
|
+
<th>Last Name</th>
|
7
|
+
<th>Username</th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<tr>
|
12
|
+
<td>1</td>
|
13
|
+
<td>Mark</td>
|
14
|
+
<td>Otto</td>
|
15
|
+
<td>@mdo</td>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td>2</td>
|
19
|
+
<td>Jacob</td>
|
20
|
+
<td>Thornton</td>
|
21
|
+
<td>@fat</td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td>3</td>
|
25
|
+
<td colspan="2">Larry the Bird</td>
|
26
|
+
<td>@twitter</td>
|
27
|
+
</tr>
|
28
|
+
</tbody>
|
29
|
+
</table>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<table class="table">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>#</th>
|
5
|
+
<th>Product</th>
|
6
|
+
<th>Payment Taken</th>
|
7
|
+
<th>Status</th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<tr class="success">
|
12
|
+
<td>1</td>
|
13
|
+
<td>TB - Monthly</td>
|
14
|
+
<td>01/04/2012</td>
|
15
|
+
<td>Approved</td>
|
16
|
+
</tr>
|
17
|
+
<tr class="error">
|
18
|
+
<td>2</td>
|
19
|
+
<td>TB - Monthly</td>
|
20
|
+
<td>02/04/2012</td>
|
21
|
+
<td>Declined</td>
|
22
|
+
</tr>
|
23
|
+
<tr class="warning">
|
24
|
+
<td>3</td>
|
25
|
+
<td>TB - Monthly</td>
|
26
|
+
<td>03/04/2012</td>
|
27
|
+
<td>Pending</td>
|
28
|
+
</tr>
|
29
|
+
<tr class="info">
|
30
|
+
<td>4</td>
|
31
|
+
<td>TB - Monthly</td>
|
32
|
+
<td>04/04/2012</td>
|
33
|
+
<td>Call in to confirm</td>
|
34
|
+
</tr>
|
35
|
+
</tbody>
|
36
|
+
</table>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<table class="table table-striped">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>#</th>
|
5
|
+
<th>First Name</th>
|
6
|
+
<th>Last Name</th>
|
7
|
+
<th>Username</th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<tr>
|
12
|
+
<td>1</td>
|
13
|
+
<td>Mark</td>
|
14
|
+
<td>Otto</td>
|
15
|
+
<td>@mdo</td>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td>2</td>
|
19
|
+
<td>Jacob</td>
|
20
|
+
<td>Thornton</td>
|
21
|
+
<td>@fat</td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td>3</td>
|
25
|
+
<td>Larry</td>
|
26
|
+
<td>the Bird</td>
|
27
|
+
<td>@twitter</td>
|
28
|
+
</tr>
|
29
|
+
</tbody>
|
30
|
+
</table>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<address>
|
2
|
+
<strong>Twitter, Inc.</strong><br>
|
3
|
+
795 Folsom Ave, Suite 600<br>
|
4
|
+
San Francisco, CA 94107<br>
|
5
|
+
<abbr title="Phone">P:</abbr> (123) 456-7890
|
6
|
+
</address>
|
7
|
+
<address>
|
8
|
+
<strong>Full Name</strong><br>
|
9
|
+
<a href="mailto:#">first.last@gmail.com</a>
|
10
|
+
</address>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<blockquote>
|
2
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
3
|
+
<p>Integer posuere erat a ante.</p>
|
4
|
+
</blockquote>
|
5
|
+
|
6
|
+
<blockquote>
|
7
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
8
|
+
<small>Someone in <cite title="Source Title">Title</cite></small>
|
9
|
+
</blockquote>
|
10
|
+
|
11
|
+
<blockquote class="pull-right">
|
12
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
13
|
+
<small>Someone in <cite title="Title">Title</cite></small>
|
14
|
+
</blockquote>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<p class="lead">
|
2
|
+
Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
|
3
|
+
</p>
|
4
|
+
<p>
|
5
|
+
Maecenas sed diam eget risus varius blandit sit amet
|
6
|
+
non magna. Donec id elit non mi porta gravida at eget
|
7
|
+
metus.
|
8
|
+
</p>
|
9
|
+
<p>
|
10
|
+
Duis mollis, est non commodo luctus, nisi erat
|
11
|
+
porttitor ligula, eget lacinia odio sem nec elit.
|
12
|
+
</p>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<dl>
|
2
|
+
<dt>Description lists</dt>
|
3
|
+
<dd>A description list is perfect for defining terms.</dd>
|
4
|
+
<dt>Euismod</dt>
|
5
|
+
<dd>Vestibulum id ligula porta odio sem nec elit.</dd>
|
6
|
+
<dd>Donec id elit non mi porta gravida at eget metus.</dd>
|
7
|
+
<dt>Malesuada porta</dt>
|
8
|
+
<dd>Etiam porta sem malesuada magna mollis euismod.</dd>
|
9
|
+
</dl>
|
10
|
+
|
11
|
+
<dl class="dl-horizontal">
|
12
|
+
<dt>Horizontal lists</dt>
|
13
|
+
<dd>They do such a great job at saving vertical space!</dd>
|
14
|
+
<dt>Euismod</dt>
|
15
|
+
<dd>Vestibulum id ligula porta odio sem nec elit.</dd>
|
16
|
+
<dd>Donec id elit non mi porta gravida at eget metus.</dd>
|
17
|
+
</dl>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<p class="muted">Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.</p>
|
2
|
+
<p class="text-warning">Etiam porta sem malesuada magna mollis euismod.</p>
|
3
|
+
<p class="text-error">Donec ullamcorper nulla non metus auctor fringilla.</p>
|
4
|
+
<p class="text-info">Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis.</p>
|
5
|
+
<p class="text-success">Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<ul>
|
2
|
+
<li>Lorem ipsum dolor sit amet</li>
|
3
|
+
<li>Nulla volutpat aliquam velit
|
4
|
+
<ul>
|
5
|
+
<li>Phasellus iaculis neque</li>
|
6
|
+
<li>Ac tristique libero volutpat at</li>
|
7
|
+
</ul>
|
8
|
+
</li>
|
9
|
+
<li>Eget porttitor lorem</li>
|
10
|
+
</ul>
|
11
|
+
|
12
|
+
<ul class="unstyled">
|
13
|
+
<li>Lorem ipsum dolor sit amet</li>
|
14
|
+
<li>Eget porttitor lorem</li>
|
15
|
+
</ul>
|
data/config/locales/en.yml
CHANGED
@@ -1,34 +1,45 @@
|
|
1
1
|
en:
|
2
2
|
style_guide:
|
3
|
-
|
4
|
-
|
3
|
+
buttons:
|
4
|
+
disabled_anchor: >
|
5
5
|
Make <code><a></code> buttons look unclickable by adding
|
6
6
|
the <code>.disabled</code> class
|
7
|
-
|
7
|
+
disabled_element: >
|
8
8
|
Make <code><button></code> buttons look unclickable by adding
|
9
9
|
the <code>.disabled</code> class
|
10
|
-
|
10
|
+
sizes: >
|
11
11
|
Fancy larger or smaller buttons?
|
12
12
|
Add <code>.btn-large</code>, <code>.btn-small</code>, or
|
13
13
|
<code>.btn-mini</code> for additional sizes.
|
14
|
-
|
15
|
-
Need different buttons for different occasions? Add
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
types: >
|
15
|
+
Need different buttons for different occasions? Add some class!
|
16
|
+
|
17
|
+
forms:
|
18
|
+
# controls
|
19
|
+
controls_checkbox_and_radio: >
|
20
|
+
Checkboxes are for selecting one or several options in a list while
|
21
|
+
radios are for selecting one option from many.
|
22
|
+
Add the <code>.inline</code> class to a series of checkboxes or radios
|
23
|
+
for controls to appear on the same line.
|
24
|
+
controls_input: >
|
25
|
+
Most common form control, text-based input fields.
|
26
|
+
Includes support for all HTML5 types:
|
27
|
+
text, password, datetime, datetime-local, date, month, time, week,
|
28
|
+
number, email, url, search, tel, and color.
|
29
|
+
Requires the use of a specified <code>type</code> at all times.
|
30
|
+
controls_select: >
|
31
|
+
Use the default option or specify a <code>multiple="multiple"</code>
|
32
|
+
to show multiple options at once.
|
33
|
+
controls_textarea: >
|
34
|
+
Form control which supports multiple lines of text.
|
35
|
+
Change <code>rows</code> attribute as necessary.
|
36
|
+
|
37
|
+
# layouts
|
38
|
+
default_styles: >
|
22
39
|
Individual form controls receive styling, but without any required base
|
23
40
|
class on the <code><form></code> or large changes in markup.
|
24
41
|
Results in stacked, left-aligned labels on top of form controls.
|
25
|
-
|
26
|
-
Add <code>.form-search</code> to the form and <code>.search-query</code>
|
27
|
-
to the <code><input></code> for an extra-rounded text input.
|
28
|
-
forms_inline: >
|
29
|
-
Add <code>.form-inline</code> for left-aligned labels and inline-block
|
30
|
-
controls for a compact layout.
|
31
|
-
forms_horizontal: >
|
42
|
+
horizontal: >
|
32
43
|
Right align labels and float them to the left to make them appear on
|
33
44
|
the same line as controls.
|
34
45
|
Requires the most markup changes from a default form:
|
@@ -38,20 +49,61 @@ en:
|
|
38
49
|
<li>Add <code>.control-label</code> to the label</li>
|
39
50
|
<li>Wrap any associated controls in <code>.controls</code> for proper alignment</li>
|
40
51
|
</ul>
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
inline: >
|
53
|
+
Add <code>.form-inline</code> for left-aligned labels and inline-block
|
54
|
+
controls for a compact layout.
|
55
|
+
search: >
|
56
|
+
Add <code>.form-search</code> to the form and <code>.search-query</code>
|
57
|
+
to the <code><input></code> for an extra-rounded text input.
|
58
|
+
|
59
|
+
images:
|
60
|
+
dropdown_icons: Dropdown in a button group.
|
61
|
+
form_fields: Icons in a form field.
|
62
|
+
icon_buttons: Button group in a button toolbar.
|
63
|
+
small_button: Small button with an icon.
|
64
|
+
placeholders: Default shapes for placeholder images.
|
65
|
+
navigation: Icons inside of navigation lists.
|
66
|
+
|
67
|
+
tables:
|
68
|
+
default_style: >
|
69
|
+
For basic styling—light padding and only horizontal
|
70
|
+
dividers—add the base class <code>.table</code> to
|
71
|
+
any <code><table></code>.
|
72
|
+
striped: >
|
73
|
+
<code>.table-striped</code>
|
74
|
+
adds zebra-striping to any table row within the
|
75
|
+
<code><tbody></code> via the <code>:nth-child</code> CSS selector
|
76
|
+
(not available in IE7-IE8).
|
77
|
+
bordered: >
|
78
|
+
<code>.table-bordered</code>
|
79
|
+
adds borders and rounded corners to the table.
|
80
|
+
hover: >
|
81
|
+
<code>.table-hover</code>
|
82
|
+
enables a hover state on table rows within a <code><tbody></code>.
|
83
|
+
condensed: >
|
84
|
+
<code>.table-condensed</code>
|
85
|
+
makes tables more compact by cutting cell padding in half.
|
86
|
+
row_classes: >
|
87
|
+
Use contextual classes to color table rows.
|
88
|
+
|
89
|
+
typography:
|
90
|
+
body_copy: >
|
91
|
+
Bootstrap's global default <code>font-size</code> is
|
92
|
+
<strong>14px</strong>, with a <code>line-height</code> of
|
93
|
+
<strong>20px</strong>. This is applied to the <code><body></code>
|
94
|
+
and all paragraphs. In addition, <code><p></code> (paragraphs)
|
95
|
+
receive a bottom margin of half their line-height (10px by default).
|
96
|
+
Make a paragraph stand out by adding <code>.lead</code>.
|
97
|
+
|
98
|
+
headings: >
|
99
|
+
All HTML headings, <code><h1></code> through
|
100
|
+
<code><h6></code> are available.
|
101
|
+
|
102
|
+
code_inline: >
|
103
|
+
Use <code><code></code> for inline snippets of code.
|
104
|
+
code_blocks: >
|
105
|
+
Use <code><pre></code> for multiple lines of code.
|
106
|
+
Be sure to escape any angle brackets in the code for proper rendering.
|
107
|
+
images_placeholders: >
|
108
|
+
Add classes to an <code><img></code> element to easily
|
109
|
+
style images in any project.
|
data/lib/style_guide/config.rb
CHANGED
@@ -1,9 +1,25 @@
|
|
1
1
|
module StyleGuide
|
2
2
|
class Config
|
3
|
-
|
3
|
+
attr_reader :partial_paths
|
4
|
+
|
5
|
+
def self.style_guide_views_path
|
6
|
+
StyleGuide::Engine.root.join("app", "views", "style_guide")
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.style_guide_views_directories
|
10
|
+
style_guide_views_path.children.select(&:directory?).reject { |d| d.basename.to_s == "style" }
|
11
|
+
end
|
4
12
|
|
5
13
|
def initialize(options = {})
|
6
|
-
@partial_paths = options[:partial_paths] ||
|
14
|
+
@partial_paths = options[:partial_paths] || self.class.style_guide_views_directories
|
15
|
+
end
|
16
|
+
|
17
|
+
def partial_paths=(paths)
|
18
|
+
if paths.is_a?(Array)
|
19
|
+
@partial_paths = paths
|
20
|
+
else
|
21
|
+
@partial_paths = [paths]
|
22
|
+
end
|
7
23
|
end
|
8
24
|
end
|
9
25
|
end
|
data/lib/style_guide/partial.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
require "nokogiri"
|
2
|
+
|
1
3
|
module StyleGuide
|
2
4
|
class Partial
|
3
|
-
attr_reader :path
|
5
|
+
attr_reader :path, :section
|
4
6
|
|
5
|
-
def initialize(path)
|
7
|
+
def initialize(path, section)
|
6
8
|
@path = path
|
9
|
+
@section = section
|
7
10
|
end
|
8
11
|
|
9
12
|
def id
|
@@ -15,7 +18,41 @@ module StyleGuide
|
|
15
18
|
end
|
16
19
|
|
17
20
|
def content
|
18
|
-
@content
|
21
|
+
@content ||= File.read(path)
|
22
|
+
end
|
23
|
+
|
24
|
+
def description
|
25
|
+
@description ||= begin
|
26
|
+
I18n.translate!(id, :scope => [:style_guide, section.id.to_sym])
|
27
|
+
rescue I18n::MissingTranslationData
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def classes
|
33
|
+
@classes ||= begin
|
34
|
+
parsed.css("[class]").reduce({}) do |output, tag|
|
35
|
+
output.tap do |tags|
|
36
|
+
tag["class"].split.each do |class_name|
|
37
|
+
tags[".#{class_name}"] = true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end.keys
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def ids
|
45
|
+
@ids ||= parsed.css("[id]").map { |tag| %(##{tag["id"]}) }
|
46
|
+
end
|
47
|
+
|
48
|
+
def identifiers
|
49
|
+
ids + classes
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def parsed
|
55
|
+
@parsed ||= Nokogiri::HTML.parse(content)
|
19
56
|
end
|
20
57
|
end
|
21
58
|
end
|