style-guide 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/Gemfile.lock +6 -4
- data/README.md +1 -1
- data/app/assets/javascripts/style_guide/docs.js +7 -152
- data/app/assets/javascripts/style_guide/sidebar.js +18 -0
- data/app/assets/stylesheets/docs.css +153 -0
- data/app/assets/stylesheets/responsive.css +164 -0
- data/app/assets/stylesheets/style_guide/ars-maquette-web.css +35 -0
- data/app/assets/stylesheets/style_guide/example.css +20 -0
- data/app/assets/stylesheets/style_guide/footer.css +23 -0
- data/app/assets/stylesheets/style_guide/header.css +31 -0
- data/app/assets/stylesheets/style_guide/layout.css +69 -0
- data/app/assets/stylesheets/style_guide/navbar.css +141 -0
- data/app/assets/stylesheets/style_guide/sidebar.css +48 -0
- data/app/controllers/style_guide/style_controller.rb +8 -0
- data/app/views/layouts/style_guide/application.html.erb +14 -25
- data/app/views/style_guide/partials/_button_disabled_state.erb +2 -0
- data/app/views/style_guide/partials/_button_element.erb +2 -0
- data/app/views/style_guide/partials/_button_sizes.erb +16 -0
- data/app/views/style_guide/partials/_buttons.erb +51 -167
- data/app/views/style_guide/partials/_code_blocks.erb +12 -0
- data/app/views/style_guide/partials/_code_inline.erb +1 -0
- data/app/views/style_guide/style/_header.erb +3 -0
- data/app/views/style_guide/style/_sidebar.erb +2 -2
- data/app/views/style_guide/style/show.html.erb +18 -0
- data/config/routes.rb +1 -1
- data/lib/style_guide/section.rb +2 -2
- data/lib/style_guide/version.rb +1 -1
- data/spec/controllers/style_guide/style_controller_spec.rb +27 -0
- data/spec/dummy/app/assets/stylesheets/application.css +38 -2
- data/spec/dummy/app/assets/stylesheets/swatches.css +16 -0
- data/spec/dummy/app/views/styles/_00swatches.erb +8 -0
- data/spec/spec_helper.rb +4 -6
- data/style-guide.gemspec +1 -0
- metadata +39 -5
- data/app/assets/stylesheets/style_guide/docs.css +0 -1015
- data/app/views/style_guide/partials/_code.erb +0 -31
- data/app/views/style_guide/style/index.html.erb +0 -23
@@ -0,0 +1,16 @@
|
|
1
|
+
<p>
|
2
|
+
<button type="button" class="btn btn-large btn-primary">Large button</button>
|
3
|
+
<button type="button" class="btn btn-large">Large button</button>
|
4
|
+
</p>
|
5
|
+
<p>
|
6
|
+
<button type="button" class="btn btn-primary">Default button</button>
|
7
|
+
<button type="button" class="btn">Default button</button>
|
8
|
+
</p>
|
9
|
+
<p>
|
10
|
+
<button type="button" class="btn btn-small btn-primary">Small button</button>
|
11
|
+
<button type="button" class="btn btn-small">Small button</button>
|
12
|
+
</p>
|
13
|
+
<p>
|
14
|
+
<button type="button" class="btn btn-mini btn-primary">Mini button</button>
|
15
|
+
<button type="button" class="btn btn-mini">Mini button</button>
|
16
|
+
</p>
|
@@ -1,167 +1,51 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
<tr>
|
53
|
-
<td><button type="button" class="btn btn-inverse">Inverse</button></td>
|
54
|
-
<td><code>btn btn-inverse</code></td>
|
55
|
-
<td>Alternate dark gray button, not tied to a semantic action or use</td>
|
56
|
-
</tr>
|
57
|
-
<tr>
|
58
|
-
<td><button type="button" class="btn btn-link">Link</button></td>
|
59
|
-
<td><code>btn btn-link</code></td>
|
60
|
-
<td>Deemphasize a button by making it look like a link while maintaining button behavior</td>
|
61
|
-
</tr>
|
62
|
-
</tbody>
|
63
|
-
</table>
|
64
|
-
|
65
|
-
<h4>Cross browser compatibility</h4>
|
66
|
-
<p>IE9 doesn't crop background gradients on rounded corners, so we remove it. Related, IE9 jankifies disabled <code>button</code> elements, rendering text gray with a nasty text-shadow that we cannot fix.</p>
|
67
|
-
|
68
|
-
|
69
|
-
<h2>Button sizes</h2>
|
70
|
-
<p>Fancy larger or smaller buttons? Add <code>.btn-large</code>, <code>.btn-small</code>, or <code>.btn-mini</code> for additional sizes.</p>
|
71
|
-
<div class="bs-docs-example">
|
72
|
-
<p>
|
73
|
-
<button type="button" class="btn btn-large btn-primary">Large button</button>
|
74
|
-
<button type="button" class="btn btn-large">Large button</button>
|
75
|
-
</p>
|
76
|
-
<p>
|
77
|
-
<button type="button" class="btn btn-primary">Default button</button>
|
78
|
-
<button type="button" class="btn">Default button</button>
|
79
|
-
</p>
|
80
|
-
<p>
|
81
|
-
<button type="button" class="btn btn-small btn-primary">Small button</button>
|
82
|
-
<button type="button" class="btn btn-small">Small button</button>
|
83
|
-
</p>
|
84
|
-
<p>
|
85
|
-
<button type="button" class="btn btn-mini btn-primary">Mini button</button>
|
86
|
-
<button type="button" class="btn btn-mini">Mini button</button>
|
87
|
-
</p>
|
88
|
-
</div>
|
89
|
-
<pre class="prettyprint linenums">
|
90
|
-
<p>
|
91
|
-
<button class="btn btn-large btn-primary" type="button">Large button</button>
|
92
|
-
<button class="btn btn-large" type="button">Large button</button>
|
93
|
-
</p>
|
94
|
-
<p>
|
95
|
-
<button class="btn btn-primary" type="button">Default button</button>
|
96
|
-
<button class="btn" type="button">Default button</button>
|
97
|
-
</p>
|
98
|
-
<p>
|
99
|
-
<button class="btn btn-small btn-primary" type="button">Small button</button>
|
100
|
-
<button class="btn btn-small" type="button">Small button</button>
|
101
|
-
</p>
|
102
|
-
<p>
|
103
|
-
<button class="btn btn-mini btn-primary" type="button">Mini button</button>
|
104
|
-
<button class="btn btn-mini" type="button">Mini button</button>
|
105
|
-
</p>
|
106
|
-
</pre>
|
107
|
-
<p>Create block level buttons—those that span the full width of a parent— by adding <code>.btn-block</code>.</p>
|
108
|
-
<div class="bs-docs-example">
|
109
|
-
<div class="well" style="max-width: 400px; margin: 0 auto 10px;">
|
110
|
-
<button type="button" class="btn btn-large btn-block btn-primary">Block level button</button>
|
111
|
-
<button type="button" class="btn btn-large btn-block">Block level button</button>
|
112
|
-
</div>
|
113
|
-
</div>
|
114
|
-
<pre class="prettyprint linenums">
|
115
|
-
<button class="btn btn-large btn-block btn-primary" type="button">Block level button</button>
|
116
|
-
<button class="btn btn-large btn-block" type="button">Block level button</button>
|
117
|
-
</pre>
|
118
|
-
|
119
|
-
|
120
|
-
<h2>Disabled state</h2>
|
121
|
-
<p>Make buttons look unclickable by fading them back 50%.</p>
|
122
|
-
|
123
|
-
<h3>Anchor element</h3>
|
124
|
-
<p>Add the <code>.disabled</code> class to <code><a></code> buttons.</p>
|
125
|
-
<p class="bs-docs-example">
|
126
|
-
<a href="#" class="btn btn-large btn-primary disabled">Primary link</a>
|
127
|
-
<a href="#" class="btn btn-large disabled">Link</a>
|
128
|
-
</p>
|
129
|
-
<pre class="prettyprint linenums">
|
130
|
-
<a href="#" class="btn btn-large btn-primary disabled">Primary link</a>
|
131
|
-
<a href="#" class="btn btn-large disabled">Link</a>
|
132
|
-
</pre>
|
133
|
-
<p>
|
134
|
-
<span class="label label-info">Heads up!</span>
|
135
|
-
We use <code>.disabled</code> as a utility class here, similar to the common <code>.active</code> class, so no prefix is required. Also, this class is only for aesthetic; you must use custom JavaScript to disable links here.
|
136
|
-
</p>
|
137
|
-
|
138
|
-
<h3>Button element</h3>
|
139
|
-
<p>Add the <code>disabled</code> attribute to <code><button></code> buttons.</p>
|
140
|
-
<p class="bs-docs-example">
|
141
|
-
<button type="button" class="btn btn-large btn-primary disabled" disabled="disabled">Primary button</button>
|
142
|
-
<button type="button" class="btn btn-large" disabled>Button</button>
|
143
|
-
</p>
|
144
|
-
<pre class="prettyprint linenums">
|
145
|
-
<button type="button" class="btn btn-large btn-primary disabled" disabled="disabled">Primary button</button>
|
146
|
-
<button type="button" class="btn btn-large" disabled>Button</button>
|
147
|
-
</pre>
|
148
|
-
|
149
|
-
|
150
|
-
<h2>One class, multiple tags</h2>
|
151
|
-
<p>Use the <code>.btn</code> class on an <code><a></code>, <code><button></code>, or <code><input></code> element.</p>
|
152
|
-
<form class="bs-docs-example">
|
153
|
-
<a class="btn" href="">Link</a>
|
154
|
-
<button class="btn" type="submit">Button</button>
|
155
|
-
<input class="btn" type="button" value="Input">
|
156
|
-
<input class="btn" type="submit" value="Submit">
|
157
|
-
</form>
|
158
|
-
<pre class="prettyprint linenums">
|
159
|
-
<a class="btn" href="">Link</a>
|
160
|
-
<button class="btn" type="submit">Button</button>
|
161
|
-
<input class="btn" type="button" value="Input">
|
162
|
-
<input class="btn" type="submit" value="Submit">
|
163
|
-
</pre>
|
164
|
-
<p>As a best practice, try to match the element for your context to ensure matching cross-browser rendering. If you have an <code>input</code>, use an <code><input type="submit"></code> for your button.</p>
|
165
|
-
|
166
|
-
</section>
|
167
|
-
|
1
|
+
<table class="table table-bordered table-striped">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>Button</th>
|
5
|
+
<th>class=""</th>
|
6
|
+
<th>Description</th>
|
7
|
+
</tr>
|
8
|
+
</thead>
|
9
|
+
<tbody>
|
10
|
+
<tr>
|
11
|
+
<td><button type="button" class="btn">Default</button></td>
|
12
|
+
<td><code>btn</code></td>
|
13
|
+
<td>Standard gray button with gradient</td>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<td><button type="button" class="btn btn-primary">Primary</button></td>
|
17
|
+
<td><code>btn btn-primary</code></td>
|
18
|
+
<td>Provides extra visual weight and identifies the primary action in a set of buttons</td>
|
19
|
+
</tr>
|
20
|
+
<tr>
|
21
|
+
<td><button type="button" class="btn btn-info">Info</button></td>
|
22
|
+
<td><code>btn btn-info</code></td>
|
23
|
+
<td>Used as an alternative to the default styles</td>
|
24
|
+
</tr>
|
25
|
+
<tr>
|
26
|
+
<td><button type="button" class="btn btn-success">Success</button></td>
|
27
|
+
<td><code>btn btn-success</code></td>
|
28
|
+
<td>Indicates a successful or positive action</td>
|
29
|
+
</tr>
|
30
|
+
<tr>
|
31
|
+
<td><button type="button" class="btn btn-warning">Warning</button></td>
|
32
|
+
<td><code>btn btn-warning</code></td>
|
33
|
+
<td>Indicates caution should be taken with this action</td>
|
34
|
+
</tr>
|
35
|
+
<tr>
|
36
|
+
<td><button type="button" class="btn btn-danger">Danger</button></td>
|
37
|
+
<td><code>btn btn-danger</code></td>
|
38
|
+
<td>Indicates a dangerous or potentially negative action</td>
|
39
|
+
</tr>
|
40
|
+
<tr>
|
41
|
+
<td><button type="button" class="btn btn-inverse">Inverse</button></td>
|
42
|
+
<td><code>btn btn-inverse</code></td>
|
43
|
+
<td>Alternate dark gray button, not tied to a semantic action or use</td>
|
44
|
+
</tr>
|
45
|
+
<tr>
|
46
|
+
<td><button type="button" class="btn btn-link">Link</button></td>
|
47
|
+
<td><code>btn btn-link</code></td>
|
48
|
+
<td>Deemphasize a button by making it look like a link while maintaining button behavior</td>
|
49
|
+
</tr>
|
50
|
+
</tbody>
|
51
|
+
</table>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<p>
|
2
|
+
Use <code><pre></code> for multiple lines of code. Be sure to escape any angle brackets in the code for proper rendering.
|
3
|
+
</p>
|
4
|
+
|
5
|
+
<pre>
|
6
|
+
def find(*file_names)
|
7
|
+
pathname.ascend do |path|
|
8
|
+
file_name = file_names.detect { |fn| path.join(fn).file? }
|
9
|
+
break path.join(file_name) if file_name
|
10
|
+
end
|
11
|
+
end
|
12
|
+
</pre>
|
@@ -0,0 +1 @@
|
|
1
|
+
Wrap inline snippets of code with <code><code></code>.
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<ul
|
1
|
+
<ul>
|
2
2
|
<% @active.partials.each do |partial| %>
|
3
|
-
<li><a href="#<%= partial.id %>"><i
|
3
|
+
<li><a href="#<%= partial.id %>"><i>›</i> <%= partial.title %></a></li>
|
4
4
|
<% end %>
|
5
5
|
</ul>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= render :partial => "header" %>
|
2
|
+
|
3
|
+
<div class="style-guide-content">
|
4
|
+
<div class="style-guide-sidebar">
|
5
|
+
<%= render :partial => "sidebar" %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="style-guide-sections">
|
9
|
+
<% @active.partials.each do |partial| %>
|
10
|
+
<section id="<%= partial.id %>">
|
11
|
+
<h1><%= partial.title %></h1>
|
12
|
+
<div class="style-guide-partial">
|
13
|
+
<%= render :file => partial.path %>
|
14
|
+
</div>
|
15
|
+
</section>
|
16
|
+
<% end %>
|
17
|
+
</div>
|
18
|
+
</div>
|
data/config/routes.rb
CHANGED
data/lib/style_guide/section.rb
CHANGED
@@ -9,7 +9,7 @@ module StyleGuide
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def id
|
12
|
-
@id ||= path.gsub(/[^a-zA-Z0-9]/, " ").strip.gsub(/\s+/, "_")
|
12
|
+
@id ||= path.to_s.downcase.gsub(/[^a-zA-Z0-9]/, " ").strip.gsub(/\s+/, "_")
|
13
13
|
end
|
14
14
|
|
15
15
|
def title
|
@@ -17,7 +17,7 @@ module StyleGuide
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def partials
|
20
|
-
partial_paths.map { |path| StyleGuide::Partial.new(path) }
|
20
|
+
partial_paths.map { |path| StyleGuide::Partial.new(path) }.sort_by { |p| p.title }
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
data/lib/style_guide/version.rb
CHANGED
@@ -1,16 +1,43 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe StyleGuide::StyleController do
|
4
|
+
let(:temp_path) { Dir.mktmpdir }
|
5
|
+
let(:partial_path) { File.join(temp_path, "monkey_hammer") }
|
6
|
+
|
7
|
+
before do
|
8
|
+
FileUtils.mkdir_p(partial_path)
|
9
|
+
StyleGuide::Engine.config.style_guide.stub(:partial_paths => [partial_path])
|
10
|
+
end
|
11
|
+
|
4
12
|
describe "#index" do
|
5
13
|
it "assigns sections" do
|
6
14
|
get :index, use_route: :styles
|
7
15
|
assigns(:sections).should be
|
16
|
+
assigns(:sections).should have(1).section
|
8
17
|
assigns(:sections).first.should be_a StyleGuide::Section
|
9
18
|
end
|
10
19
|
|
11
20
|
it "sets the active section to the first one" do
|
12
21
|
get :index, use_route: :styles
|
13
22
|
assigns(:active).should == assigns(:sections).first
|
23
|
+
assigns(:active).title.should == "Monkey Hammer"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#show" do
|
28
|
+
let(:fake_section) { StyleGuide::Section.new(partial_path) }
|
29
|
+
|
30
|
+
it "assigns sections" do
|
31
|
+
get :show, id: fake_section.id, use_route: :styles
|
32
|
+
assigns(:sections).should be
|
33
|
+
assigns(:sections).should have(1).section
|
34
|
+
assigns(:sections).first.should be_a StyleGuide::Section
|
35
|
+
end
|
36
|
+
|
37
|
+
it "assigns the section" do
|
38
|
+
get :show, id: fake_section.id, use_route: :styles
|
39
|
+
assigns(:active).should be_a StyleGuide::Section
|
40
|
+
assigns(:active).title.should == "Monkey Hammer"
|
14
41
|
end
|
15
42
|
end
|
16
43
|
end
|
@@ -9,6 +9,42 @@
|
|
9
9
|
* compiled file, but it's generally better to create a new file per style scope.
|
10
10
|
*
|
11
11
|
*= require_self
|
12
|
-
*=
|
13
|
-
*= require bootstrap-responsive
|
12
|
+
*= require_tree .
|
14
13
|
*/
|
14
|
+
|
15
|
+
|
16
|
+
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
|
17
|
+
margin: 0;
|
18
|
+
padding: 0;
|
19
|
+
border: 0;
|
20
|
+
font-size: 100%;
|
21
|
+
font: inherit;
|
22
|
+
vertical-align: baseline;
|
23
|
+
}
|
24
|
+
|
25
|
+
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
|
26
|
+
display: block;
|
27
|
+
}
|
28
|
+
|
29
|
+
body {
|
30
|
+
line-height: 1;
|
31
|
+
}
|
32
|
+
|
33
|
+
ol, ul {
|
34
|
+
list-style: none;
|
35
|
+
}
|
36
|
+
|
37
|
+
blockquote, q {
|
38
|
+
quotes: none;
|
39
|
+
}
|
40
|
+
|
41
|
+
blockquote:before, blockquote:after, q:before, q:after {
|
42
|
+
content: '';
|
43
|
+
content: none;
|
44
|
+
}
|
45
|
+
|
46
|
+
table {
|
47
|
+
border-collapse: collapse;
|
48
|
+
border-spacing: 0;
|
49
|
+
}
|
50
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.swatch {
|
2
|
+
display: inline-block;
|
3
|
+
height: 50px;
|
4
|
+
width: 50px;
|
5
|
+
margin:10px;
|
6
|
+
}
|
7
|
+
|
8
|
+
.freshBlue { background-color: #6D99D3; }
|
9
|
+
.freshRed { background-color: #B90020; }
|
10
|
+
.freshGold { background-color: #C59E16; }
|
11
|
+
.freshBlack { background-color: #5D5C5C; }
|
12
|
+
.freshDarkGray { background-color: #5D5C5C; }
|
13
|
+
.freshGray { background-color: #888; }
|
14
|
+
.freshLightGray { background-color: #ddd; }
|
15
|
+
.freshLighterGray { background-color: #f5f5f5; }
|
16
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div class="swatch freshBlue "></div>
|
2
|
+
<div class="swatch freshRed "></div>
|
3
|
+
<div class="swatch freshGold "></div>
|
4
|
+
<div class="swatch freshBlack "></div>
|
5
|
+
<div class="swatch freshDarkGray "></div>
|
6
|
+
<div class="swatch freshGray "></div>
|
7
|
+
<div class="swatch freshLightGray "></div>
|
8
|
+
<div class="swatch freshLighterGray "></div>
|