blot 0.0.1 → 1.0.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/blot.gemspec +6 -2
- data/lib/blot.rb +0 -1
- data/lib/blot/helpers.rb +4 -0
- data/lib/blot/helpers/button.rb +20 -0
- data/lib/blot/helpers/grid.rb +47 -20
- data/lib/blot/helpers/visibility.rb +27 -0
- data/lib/blot/version.rb +1 -1
- data/spec/blot/helpers/button_spec.rb +139 -0
- data/spec/blot/helpers/grid_spec.rb +503 -0
- data/spec/blot/helpers/visibility_spec.rb +86 -0
- data/spec/blot/helpers_spec.rb +9 -0
- data/spec/blot/railtie_spec.rb +8 -0
- data/spec/blot/version_spec.rb +9 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/support/string.rb +5 -0
- metadata +80 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c21ee62fa2e7c62c257a09573343b25fe6a37bf6
|
4
|
+
data.tar.gz: 6f2445b40e9f17fa5c012ec824da15f620ffab1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1cacba76d88fc985b9b127510819436389921a6872e8f5db0f08b882ed9c7260dbdf5f080426dc64cee4a27aea3eb83798ea285f0822c4813da9eb6a0c294c9
|
7
|
+
data.tar.gz: 19f483ea4e0105a03ae1034085879b6d2aeb5fa396c74ed82fba773745a71dbb3306afb3172b65267711c6b34822adcc07fe294a7111a11cbad2aee42c5d52aa
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/blot.gemspec
CHANGED
@@ -21,8 +21,12 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_runtime_dependency 'rails'
|
24
|
+
spec.add_runtime_dependency 'rails', '>= 1'
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.6"
|
27
|
-
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rake", '>= 0'
|
28
|
+
spec.add_development_dependency 'pry'
|
29
|
+
spec.add_development_dependency "rspec", '~> 3.1'
|
30
|
+
spec.add_development_dependency 'rspec-its', '~> 1.0'
|
31
|
+
spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0'
|
28
32
|
end
|
data/lib/blot.rb
CHANGED
data/lib/blot/helpers.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Blot
|
2
|
+
module Helpers
|
3
|
+
module Button
|
4
|
+
def button(label, path, options={})
|
5
|
+
size = options.delete(:size).to_s
|
6
|
+
size += '-button' if size != 'button'
|
7
|
+
color = options.delete :color
|
8
|
+
radius = options.delete :radius
|
9
|
+
|
10
|
+
content_tag :table, class: "#{size} #{color} #{radius}".squish do
|
11
|
+
content_tag :tr do
|
12
|
+
content_tag :td do
|
13
|
+
link_to label, path, options
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/blot/helpers/grid.rb
CHANGED
@@ -1,17 +1,24 @@
|
|
1
1
|
module Blot
|
2
2
|
module Helpers
|
3
3
|
module Grid
|
4
|
-
def
|
4
|
+
def block_grid(options={})
|
5
|
+
options[:class] = "block-grid #{options[:up]}-up #{options[:class]}".strip
|
6
|
+
content_tag :table, class: options[:class] do
|
7
|
+
content_tag :tr do
|
8
|
+
yield if block_given?
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def container(options={})
|
5
14
|
content_tag :table, class: 'container' do
|
6
15
|
content_tag :tr do
|
7
|
-
|
8
|
-
options[:class] == 'center' ? content_tag(:center, yield) : yield
|
9
|
-
end
|
16
|
+
wrapper(options) { yield if block_given? }
|
10
17
|
end
|
11
18
|
end
|
12
19
|
end
|
13
20
|
|
14
|
-
def row
|
21
|
+
def row
|
15
22
|
content_tag :table, class: 'row' do
|
16
23
|
content_tag :tr do
|
17
24
|
yield if block_given?
|
@@ -19,31 +26,51 @@ module Blot
|
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
22
|
-
def
|
23
|
-
content_tag :td,
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
29
|
+
def panel_sub_grid
|
30
|
+
content_tag :td, class: 'panel sub-grid' do
|
31
|
+
content_tag :table do
|
32
|
+
content_tag :tr do
|
33
|
+
yield if block_given?
|
34
|
+
end
|
28
35
|
end
|
29
36
|
end
|
30
37
|
end
|
31
38
|
|
32
|
-
def columns(width, options={}
|
39
|
+
def columns(width, options={})
|
33
40
|
content_tag :table, class: "#{width} columns" do
|
34
41
|
content_tag :tr do
|
35
|
-
|
36
|
-
if block_given?
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
content_tag :td, class: 'expander'
|
42
|
+
if options[:sub_columns]
|
43
|
+
"#{yield if block_given?}".html_safe
|
44
|
+
else
|
45
|
+
"#{wrapper(options) { yield if block_given? } if !options.empty? || block_given? }".html_safe
|
46
|
+
end +
|
47
|
+
"#{content_tag :td, nil, class: 'expander'}".html_safe
|
43
48
|
end
|
44
49
|
end
|
45
50
|
end
|
46
51
|
alias :column :columns
|
52
|
+
|
53
|
+
def sub_columns(width, options={})
|
54
|
+
options[:class] = "#{width} sub-columns #{options[:class]}".strip
|
55
|
+
wrapper(options) { yield if block_given? }
|
56
|
+
end
|
57
|
+
alias :sub_column :sub_columns
|
58
|
+
|
59
|
+
def wrapper(options={}, &block)
|
60
|
+
content_tag :td, options do
|
61
|
+
optional_content(options) { yield if block_given? }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def optional_content(options={}, &block)
|
68
|
+
if options[:class] && options[:class].split(' ').include?('center')
|
69
|
+
content_tag :center, block.call
|
70
|
+
else
|
71
|
+
block.call
|
72
|
+
end
|
73
|
+
end
|
47
74
|
end
|
48
75
|
end
|
49
76
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Blot
|
2
|
+
module Helpers
|
3
|
+
module Visibility
|
4
|
+
def show_for_small
|
5
|
+
('<!--[if !mso]><!-- -->' +
|
6
|
+
content_tag(:table, class: 'show-for-small') do
|
7
|
+
content_tag :tr do
|
8
|
+
content_tag :td do
|
9
|
+
yield if block_given?
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end +
|
13
|
+
'<!--<![endif]-->').html_safe
|
14
|
+
end
|
15
|
+
|
16
|
+
def hide_for_small
|
17
|
+
content_tag :table, class: 'hide-for-small' do
|
18
|
+
content_tag :tr do
|
19
|
+
content_tag :td do
|
20
|
+
yield if block_given?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/blot/version.rb
CHANGED
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Blot::Helpers::Button do
|
4
|
+
let(:view) { ActionView::Base.new.extend subject }
|
5
|
+
|
6
|
+
describe '.button' do
|
7
|
+
it 'simple button' do
|
8
|
+
expect(view.button('Button Label', '#', size: :button)).to eql <<-HTML.compress
|
9
|
+
<table class="button">
|
10
|
+
<tr>
|
11
|
+
<td>
|
12
|
+
<a href="#">Button Label</a>
|
13
|
+
</td>
|
14
|
+
</tr>
|
15
|
+
</table>
|
16
|
+
HTML
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'tiny button' do
|
20
|
+
expect(view.button('Button Label', '#', size: :tiny)).to eql <<-HTML.compress
|
21
|
+
<table class="tiny-button">
|
22
|
+
<tr>
|
23
|
+
<td>
|
24
|
+
<a href="#">Button Label</a>
|
25
|
+
</td>
|
26
|
+
</tr>
|
27
|
+
</table>
|
28
|
+
HTML
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'small button' do
|
32
|
+
expect(view.button('Button Label', '#', size: :small)).to eql <<-HTML.compress
|
33
|
+
<table class="small-button">
|
34
|
+
<tr>
|
35
|
+
<td>
|
36
|
+
<a href="#">Button Label</a>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
</table>
|
40
|
+
HTML
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'medium button' do
|
44
|
+
expect(view.button('Button Label', '#', size: :medium)).to eql <<-HTML.compress
|
45
|
+
<table class="medium-button">
|
46
|
+
<tr>
|
47
|
+
<td>
|
48
|
+
<a href="#">Button Label</a>
|
49
|
+
</td>
|
50
|
+
</tr>
|
51
|
+
</table>
|
52
|
+
HTML
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'large button' do
|
56
|
+
expect(view.button('Button Label', '#', size: :large)).to eql <<-HTML.compress
|
57
|
+
<table class="large-button">
|
58
|
+
<tr>
|
59
|
+
<td>
|
60
|
+
<a href="#">Button Label</a>
|
61
|
+
</td>
|
62
|
+
</tr>
|
63
|
+
</table>
|
64
|
+
HTML
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'primary button' do
|
68
|
+
expect(view.button('Button Label', '#', size: :button, color: :primary)).to eql <<-HTML.compress
|
69
|
+
<table class="button primary">
|
70
|
+
<tr>
|
71
|
+
<td>
|
72
|
+
<a href="#">Button Label</a>
|
73
|
+
</td>
|
74
|
+
</tr>
|
75
|
+
</table>
|
76
|
+
HTML
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'secondary button' do
|
80
|
+
expect(view.button('Button Label', '#', size: :button, color: :secondary)).to eql <<-HTML.compress
|
81
|
+
<table class="button secondary">
|
82
|
+
<tr>
|
83
|
+
<td>
|
84
|
+
<a href="#">Button Label</a>
|
85
|
+
</td>
|
86
|
+
</tr>
|
87
|
+
</table>
|
88
|
+
HTML
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'alert button' do
|
92
|
+
expect(view.button('Button Label', '#', size: :button, color: :alert)).to eql <<-HTML.compress
|
93
|
+
<table class="button alert">
|
94
|
+
<tr>
|
95
|
+
<td>
|
96
|
+
<a href="#">Button Label</a>
|
97
|
+
</td>
|
98
|
+
</tr>
|
99
|
+
</table>
|
100
|
+
HTML
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'success button' do
|
104
|
+
expect(view.button('Button Label', '#', size: :button, color: :success)).to eql <<-HTML.compress
|
105
|
+
<table class="button success">
|
106
|
+
<tr>
|
107
|
+
<td>
|
108
|
+
<a href="#">Button Label</a>
|
109
|
+
</td>
|
110
|
+
</tr>
|
111
|
+
</table>
|
112
|
+
HTML
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'radius button' do
|
116
|
+
expect(view.button('Button Label', '#', size: :button, radius: :radius)).to eql <<-HTML.compress
|
117
|
+
<table class="button radius">
|
118
|
+
<tr>
|
119
|
+
<td>
|
120
|
+
<a href="#">Button Label</a>
|
121
|
+
</td>
|
122
|
+
</tr>
|
123
|
+
</table>
|
124
|
+
HTML
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'round button' do
|
128
|
+
expect(view.button('Button Label', '#', size: :button, radius: :round)).to eql <<-HTML.compress
|
129
|
+
<table class="button round">
|
130
|
+
<tr>
|
131
|
+
<td>
|
132
|
+
<a href="#">Button Label</a>
|
133
|
+
</td>
|
134
|
+
</tr>
|
135
|
+
</table>
|
136
|
+
HTML
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,503 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include ActionView::Helpers::AssetTagHelper
|
4
|
+
|
5
|
+
describe Blot::Helpers::Grid do
|
6
|
+
let(:view) { ActionView::Base.new.extend subject }
|
7
|
+
|
8
|
+
describe '.block_grid' do
|
9
|
+
it 'can render a block-grid' do
|
10
|
+
expect(view.block_grid up: :two).to eql <<-HTML.compress
|
11
|
+
<table class="block-grid two-up">
|
12
|
+
<tr></tr>
|
13
|
+
</table>
|
14
|
+
HTML
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'can render a block-grid with classes' do
|
18
|
+
expect(view.block_grid up: :two, class: 'row').to eql <<-HTML.compress
|
19
|
+
<table class="block-grid two-up row">
|
20
|
+
<tr></tr>
|
21
|
+
</table>
|
22
|
+
HTML
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '.container' do
|
27
|
+
it 'can render a container' do
|
28
|
+
expect(view.container).to eql <<-HTML.compress
|
29
|
+
<table class="container">
|
30
|
+
<tr>
|
31
|
+
<td></td>
|
32
|
+
</tr>
|
33
|
+
</table>
|
34
|
+
HTML
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '.row' do
|
39
|
+
it 'can render a row' do
|
40
|
+
expect(view.row).to eql <<-HTML.compress
|
41
|
+
<table class="row">
|
42
|
+
<tr></tr>
|
43
|
+
</table>
|
44
|
+
HTML
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '.panel_sub_grid' do
|
49
|
+
it 'can render a panel sub-grid' do
|
50
|
+
expect(view.panel_sub_grid).to eql <<-HTML.compress
|
51
|
+
<td class="panel sub-grid">
|
52
|
+
<table>
|
53
|
+
<tr></tr>
|
54
|
+
</table>
|
55
|
+
</td>
|
56
|
+
HTML
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '.columns' do
|
61
|
+
it 'can render one column' do
|
62
|
+
expect(view.column :one).to eql <<-HTML.compress
|
63
|
+
<table class="one columns">
|
64
|
+
<tr>
|
65
|
+
<td class="expander"></td>
|
66
|
+
</tr>
|
67
|
+
</table>
|
68
|
+
HTML
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'can render multiple columns' do
|
72
|
+
expect(view.columns :two).to eql <<-HTML.compress
|
73
|
+
<table class="two columns">
|
74
|
+
<tr>
|
75
|
+
<td class="expander"></td>
|
76
|
+
</tr>
|
77
|
+
</table>
|
78
|
+
HTML
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'can have text-padding' do
|
82
|
+
expect(view.columns(:four, class: 'right-text-pad')).to eql <<-HTML.compress
|
83
|
+
<table class="four columns">
|
84
|
+
<tr>
|
85
|
+
<td class="right-text-pad"></td>
|
86
|
+
<td class="expander"></td>
|
87
|
+
</tr>
|
88
|
+
</table>
|
89
|
+
HTML
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '.sub_columns' do
|
94
|
+
it 'can render a sub-column' do
|
95
|
+
expect(view.sub_column :one).to eql <<-HTML.compress
|
96
|
+
<td class="one sub-columns"></td>
|
97
|
+
HTML
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'can render multiple sub-columns' do
|
101
|
+
expect(view.sub_columns :two).to eql <<-HTML.compress
|
102
|
+
<td class="two sub-columns"></td>
|
103
|
+
HTML
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe '.wrapper' do
|
108
|
+
it 'can be empty' do
|
109
|
+
expect(view.wrapper).to eql <<-HTML.compress
|
110
|
+
<td></td>
|
111
|
+
HTML
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'can yield content' do
|
115
|
+
expect(view.wrapper { "Content" }).to eql <<-HTML.compress
|
116
|
+
<td>Content</td>
|
117
|
+
HTML
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'can have a class' do
|
121
|
+
expect(view.wrapper(class: 'wrapper') { 'Content' }).to eql <<-HTML.compress
|
122
|
+
<td class="wrapper">Content</td>
|
123
|
+
HTML
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'can have multiple classes' do
|
127
|
+
expect(view.wrapper(class: 'wrapper last') { 'Content' }).to eql <<-HTML.compress
|
128
|
+
<td class="wrapper last">Content</td>
|
129
|
+
HTML
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context 'private' do
|
134
|
+
describe '.optional_content' do
|
135
|
+
it 'can center content' do
|
136
|
+
oc = view.send(:optional_content, class: 'center') { "Content" }
|
137
|
+
expect(oc).to eql <<-HTML.compress
|
138
|
+
<center>Content</center>
|
139
|
+
HTML
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context 'example' do
|
145
|
+
it 'can render two rows, twelve and six by six' do
|
146
|
+
example = view.container do
|
147
|
+
view.row do
|
148
|
+
view.wrapper(class: 'wrapper last') do
|
149
|
+
view.columns(:twelve, class: 'panel') { '.twelve.columns' }
|
150
|
+
end
|
151
|
+
end +
|
152
|
+
view.row do
|
153
|
+
view.wrapper(class: 'wrapper') do
|
154
|
+
view.columns(:six, class: 'panel') { '.six.columns' }
|
155
|
+
end +
|
156
|
+
view.wrapper(class: 'wrapper last') do
|
157
|
+
view.columns(:six, class: 'panel') { '.six.columns' }
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
expect(example).to eql <<-HTML.compress
|
163
|
+
<table class="container">
|
164
|
+
<tr>
|
165
|
+
<td>
|
166
|
+
|
167
|
+
<table class="row">
|
168
|
+
<tr>
|
169
|
+
<td class="wrapper last">
|
170
|
+
|
171
|
+
<table class="twelve columns">
|
172
|
+
<tr>
|
173
|
+
<td class="panel">.twelve.columns</td>
|
174
|
+
<td class="expander"></td>
|
175
|
+
</tr>
|
176
|
+
</table>
|
177
|
+
|
178
|
+
</td>
|
179
|
+
</tr>
|
180
|
+
</table>
|
181
|
+
|
182
|
+
<table class="row">
|
183
|
+
<tr>
|
184
|
+
<td class="wrapper">
|
185
|
+
|
186
|
+
<table class="six columns">
|
187
|
+
<tr>
|
188
|
+
<td class="panel">.six.columns</td>
|
189
|
+
<td class="expander"></td>
|
190
|
+
</tr>
|
191
|
+
</table>
|
192
|
+
|
193
|
+
</td>
|
194
|
+
<td class="wrapper last">
|
195
|
+
|
196
|
+
<table class="six columns">
|
197
|
+
<tr>
|
198
|
+
<td class="panel">.six.columns</td>
|
199
|
+
<td class="expander"></td>
|
200
|
+
</tr>
|
201
|
+
</table>
|
202
|
+
|
203
|
+
</td>
|
204
|
+
</tr>
|
205
|
+
</table>
|
206
|
+
|
207
|
+
</td>
|
208
|
+
</tr>
|
209
|
+
</table>
|
210
|
+
HTML
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'can render centered content' do
|
214
|
+
example = view.row do
|
215
|
+
view.wrapper(class: 'wrapper') do
|
216
|
+
view.columns(:six, class: 'center panel') { 'Centered content' }
|
217
|
+
end +
|
218
|
+
view.wrapper(class: 'wrapper last') do
|
219
|
+
view.columns(:six, class: 'center panel') do
|
220
|
+
image_tag 'http://placehold.it/125x125&text=Centered%20Image', class: 'center', alt: 'centered image'
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
expect(example).to eql <<-HTML.compress
|
226
|
+
<table class="row">
|
227
|
+
<tr>
|
228
|
+
<td class="wrapper">
|
229
|
+
|
230
|
+
<table class="six columns">
|
231
|
+
<tr>
|
232
|
+
<td class="center panel">
|
233
|
+
<center>Centered content</center>
|
234
|
+
</td>
|
235
|
+
<td class="expander"></td>
|
236
|
+
</tr>
|
237
|
+
</table>
|
238
|
+
|
239
|
+
</td>
|
240
|
+
<td class="wrapper last">
|
241
|
+
|
242
|
+
<table class="six columns">
|
243
|
+
<tr>
|
244
|
+
<td class="center panel">
|
245
|
+
<center><img alt="centered image" class="center" src="http://placehold.it/125x125&text=Centered%20Image" /></center>
|
246
|
+
</td>
|
247
|
+
<td class="expander"></td>
|
248
|
+
</tr>
|
249
|
+
</table>
|
250
|
+
|
251
|
+
</td>
|
252
|
+
</tr>
|
253
|
+
</table>
|
254
|
+
HTML
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'can render offset columns' do
|
258
|
+
example = view.row do
|
259
|
+
view.wrapper(class: 'wrapper offset-by-four') do
|
260
|
+
view.columns(:eight, class: 'panel') { 'Offset Content' }
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
expect(example).to eql <<-HTML.compress
|
265
|
+
<table class="row">
|
266
|
+
<tr>
|
267
|
+
<td class="wrapper offset-by-four">
|
268
|
+
|
269
|
+
<table class="eight columns">
|
270
|
+
<tr>
|
271
|
+
<td class="panel">Offset Content</td>
|
272
|
+
<td class="expander"></td>
|
273
|
+
</tr>
|
274
|
+
</table>
|
275
|
+
|
276
|
+
</td>
|
277
|
+
</tr>
|
278
|
+
</table>
|
279
|
+
HTML
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'can render text-padding' do
|
283
|
+
example = view.row do
|
284
|
+
view.wrapper(class: 'wrapper') do
|
285
|
+
view.columns(:four, class: 'left-text-pad') { 'Text' }
|
286
|
+
end +
|
287
|
+
view.wrapper(class: 'wrapper') do
|
288
|
+
view.columns(:four) { 'Text' }
|
289
|
+
end +
|
290
|
+
view.wrapper(class: 'wrapper last') do
|
291
|
+
view.columns(:four, class: 'right-text-pad') { 'Text' }
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
expect(example).to eql <<-HTML.compress
|
296
|
+
<table class="row">
|
297
|
+
<tr>
|
298
|
+
<td class="wrapper">
|
299
|
+
|
300
|
+
<table class="four columns">
|
301
|
+
<tr>
|
302
|
+
<td class="left-text-pad">Text</td>
|
303
|
+
<td class="expander"></td>
|
304
|
+
</tr>
|
305
|
+
</table>
|
306
|
+
|
307
|
+
</td>
|
308
|
+
<td class="wrapper">
|
309
|
+
|
310
|
+
<table class="four columns">
|
311
|
+
<tr>
|
312
|
+
<td>Text</td>
|
313
|
+
<td class="expander"></td>
|
314
|
+
</tr>
|
315
|
+
</table>
|
316
|
+
|
317
|
+
</td>
|
318
|
+
<td class="wrapper last">
|
319
|
+
|
320
|
+
<table class="four columns">
|
321
|
+
<tr>
|
322
|
+
<td class="right-text-pad">Text</td>
|
323
|
+
<td class="expander"></td>
|
324
|
+
</tr>
|
325
|
+
</table>
|
326
|
+
|
327
|
+
</td>
|
328
|
+
</tr>
|
329
|
+
</table>
|
330
|
+
HTML
|
331
|
+
end
|
332
|
+
|
333
|
+
it 'can render full-width rows' do
|
334
|
+
example = view.row do
|
335
|
+
view.wrapper(class: 'center', align: 'center') do
|
336
|
+
view.container(class: 'wrapper last') do
|
337
|
+
view.columns(:twelve) { 'Content' }
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
expect(example).to eql <<-HTML.compress
|
343
|
+
<table class="row">
|
344
|
+
<tr>
|
345
|
+
<td align="center" class="center">
|
346
|
+
<center>
|
347
|
+
|
348
|
+
<table class="container">
|
349
|
+
<tr>
|
350
|
+
<td class="wrapper last">
|
351
|
+
|
352
|
+
<table class="twelve columns">
|
353
|
+
<tr>
|
354
|
+
<td>Content</td>
|
355
|
+
<td class="expander"></td>
|
356
|
+
</tr>
|
357
|
+
</table>
|
358
|
+
|
359
|
+
</td>
|
360
|
+
</tr>
|
361
|
+
</table>
|
362
|
+
|
363
|
+
</center>
|
364
|
+
</td>
|
365
|
+
</tr>
|
366
|
+
</table>
|
367
|
+
HTML
|
368
|
+
end
|
369
|
+
|
370
|
+
it 'can render a sub-grid' do
|
371
|
+
example = view.row do
|
372
|
+
view.wrapper(class: 'wrapper') do
|
373
|
+
view.columns(:eight, sub_columns: true) do
|
374
|
+
view.sub_columns(:eight) { '.eight.sub-columns' } +
|
375
|
+
view.sub_columns(:four, class: 'last') { '.four.sub-columns' }
|
376
|
+
end
|
377
|
+
end +
|
378
|
+
view.wrapper(class: 'wrapper last') do
|
379
|
+
view.columns(:four) { '.four.columns' }
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
expect(example).to eql <<-HTML.compress
|
384
|
+
<table class="row">
|
385
|
+
<tr>
|
386
|
+
<td class="wrapper">
|
387
|
+
|
388
|
+
<table class="eight columns">
|
389
|
+
<tr>
|
390
|
+
<td class="eight sub-columns">.eight.sub-columns</td>
|
391
|
+
<td class="four sub-columns last">.four.sub-columns</td>
|
392
|
+
<td class="expander"></td>
|
393
|
+
</tr>
|
394
|
+
</table>
|
395
|
+
|
396
|
+
</td>
|
397
|
+
<td class="wrapper last">
|
398
|
+
|
399
|
+
<table class="four columns">
|
400
|
+
<tr>
|
401
|
+
<td>.four.columns</td>
|
402
|
+
<td class="expander"></td>
|
403
|
+
</tr>
|
404
|
+
</table>
|
405
|
+
|
406
|
+
</td>
|
407
|
+
</tr>
|
408
|
+
</table>
|
409
|
+
HTML
|
410
|
+
end
|
411
|
+
|
412
|
+
it 'can render a block-grid' do
|
413
|
+
example = view.container do
|
414
|
+
view.block_grid(up: :two) do
|
415
|
+
view.wrapper { 'Column #1' } +
|
416
|
+
view.wrapper { 'Column #2' }
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
expect(example).to eql <<-HTML.compress
|
421
|
+
<table class="container">
|
422
|
+
<tr>
|
423
|
+
<td>
|
424
|
+
|
425
|
+
<table class="block-grid two-up">
|
426
|
+
<tr>
|
427
|
+
<td>Column #1</td>
|
428
|
+
<td>Column #2</td>
|
429
|
+
</tr>
|
430
|
+
</table>
|
431
|
+
|
432
|
+
</td>
|
433
|
+
</tr>
|
434
|
+
</table>
|
435
|
+
HTML
|
436
|
+
end
|
437
|
+
|
438
|
+
it 'can render a sidebar' do
|
439
|
+
example = view.row do
|
440
|
+
view.wrapper(class: 'wrapper') do
|
441
|
+
view.columns(:eight) { 'Main content' }
|
442
|
+
end +
|
443
|
+
view.wrapper(class: 'wrapper last') do
|
444
|
+
view.columns(:four, class: 'panel') { 'Panel content' }
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
expect(example).to eql <<-HTML.compress
|
449
|
+
<table class="row">
|
450
|
+
<tr>
|
451
|
+
<td class="wrapper">
|
452
|
+
|
453
|
+
<table class="eight columns">
|
454
|
+
<tr>
|
455
|
+
<td>Main content</td>
|
456
|
+
<td class="expander"></td>
|
457
|
+
</tr>
|
458
|
+
</table>
|
459
|
+
|
460
|
+
</td>
|
461
|
+
<td class="wrapper last">
|
462
|
+
|
463
|
+
<table class="four columns">
|
464
|
+
<tr>
|
465
|
+
<td class="panel">Panel content</td>
|
466
|
+
<td class="expander"></td>
|
467
|
+
</tr>
|
468
|
+
</table>
|
469
|
+
|
470
|
+
</td>
|
471
|
+
</tr>
|
472
|
+
</table>
|
473
|
+
HTML
|
474
|
+
end
|
475
|
+
|
476
|
+
it 'can render a panel with a sub-grid' do
|
477
|
+
example = view.columns(:twelve, class: 'panel sub-grid', sub_columns: true) do
|
478
|
+
view.panel_sub_grid do
|
479
|
+
view.sub_columns(:six) { 'Left Sub-Column' } +
|
480
|
+
view.sub_columns(:six) { 'Right Sub-Column' }
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
expect(example).to eql <<-HTML.compress
|
485
|
+
<table class="twelve columns">
|
486
|
+
<tr>
|
487
|
+
<td class="panel sub-grid">
|
488
|
+
|
489
|
+
<table>
|
490
|
+
<tr>
|
491
|
+
<td class="six sub-columns">Left Sub-Column</td>
|
492
|
+
<td class="six sub-columns">Right Sub-Column</td>
|
493
|
+
</tr>
|
494
|
+
</table>
|
495
|
+
|
496
|
+
</td>
|
497
|
+
<td class="expander"></td>
|
498
|
+
</tr>
|
499
|
+
</table>
|
500
|
+
HTML
|
501
|
+
end
|
502
|
+
end
|
503
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Blot::Helpers::Grid
|
4
|
+
|
5
|
+
describe Blot::Helpers::Visibility do
|
6
|
+
let(:view) { ActionView::Base.new.extend subject }
|
7
|
+
|
8
|
+
it '#show_for_small' do
|
9
|
+
expect(view.show_for_small).to eql <<-HTML.compress
|
10
|
+
<!--[if !mso]><!-- -->
|
11
|
+
<table class="show-for-small">
|
12
|
+
<tr>
|
13
|
+
<td></td>
|
14
|
+
</tr>
|
15
|
+
</table>
|
16
|
+
<!--<![endif]-->
|
17
|
+
HTML
|
18
|
+
end
|
19
|
+
|
20
|
+
it '#hide_for_small' do
|
21
|
+
expect(view.hide_for_small).to eql <<-HTML.compress
|
22
|
+
<table class="hide-for-small">
|
23
|
+
<tr>
|
24
|
+
<td></td>
|
25
|
+
</tr>
|
26
|
+
</table>
|
27
|
+
HTML
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'example' do
|
31
|
+
it 'can render visibility of columns in a row' do
|
32
|
+
example = view.row do
|
33
|
+
view.wrapper(class: 'wrapper last') do
|
34
|
+
view.show_for_small do
|
35
|
+
view.columns(:twelve, class: 'panel') { '.show-for-small' }
|
36
|
+
end +
|
37
|
+
view.hide_for_small do
|
38
|
+
view.columns(:twelve, class: 'panel') { '.hide-for-small' }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
expect(example).to eql <<-HTML.compress
|
44
|
+
<table class="row">
|
45
|
+
<tr>
|
46
|
+
<td class="wrapper last">
|
47
|
+
|
48
|
+
<!--[if !mso]><!-- -->
|
49
|
+
<table class="show-for-small">
|
50
|
+
<tr>
|
51
|
+
<td>
|
52
|
+
|
53
|
+
<table class="twelve columns">
|
54
|
+
<tr>
|
55
|
+
<td class="panel">.show-for-small</td>
|
56
|
+
<td class="expander"></td>
|
57
|
+
</tr>
|
58
|
+
</table>
|
59
|
+
|
60
|
+
</td>
|
61
|
+
</tr>
|
62
|
+
</table>
|
63
|
+
<!--<![endif]-->
|
64
|
+
|
65
|
+
<table class="hide-for-small">
|
66
|
+
<tr>
|
67
|
+
<td>
|
68
|
+
|
69
|
+
<table class="twelve columns">
|
70
|
+
<tr>
|
71
|
+
<td class="panel">.hide-for-small</td>
|
72
|
+
<td class="expander"></td>
|
73
|
+
</tr>
|
74
|
+
</table>
|
75
|
+
|
76
|
+
</td>
|
77
|
+
</tr>
|
78
|
+
</table>
|
79
|
+
|
80
|
+
</td>
|
81
|
+
</tr>
|
82
|
+
</table>
|
83
|
+
HTML
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'rails/all'
|
5
|
+
|
6
|
+
require 'blot'
|
7
|
+
|
8
|
+
require 'rspec/its'
|
9
|
+
require 'rspec/collection_matchers'
|
10
|
+
|
11
|
+
require 'support/string'
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.expect_with :rspec do |expectations|
|
15
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
16
|
+
end
|
17
|
+
|
18
|
+
config.mock_with :rspec do |mocks|
|
19
|
+
mocks.verify_partial_doubles = true
|
20
|
+
end
|
21
|
+
|
22
|
+
config.run_all_when_everything_filtered = true
|
23
|
+
config.warnings = true
|
24
|
+
|
25
|
+
if config.files_to_run.one?
|
26
|
+
config.default_formatter = 'doc'
|
27
|
+
end
|
28
|
+
|
29
|
+
config.order = :random
|
30
|
+
|
31
|
+
Kernel.srand config.seed
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben A Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,62 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-its
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-collection_matchers
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
55
111
|
description: "\n Tired of all those tables in those emails?\n Blot is a DSL
|
56
112
|
that lets you create them with ease and optimized with the Ink email framework.\n
|
57
113
|
\ "
|
@@ -62,6 +118,7 @@ extensions: []
|
|
62
118
|
extra_rdoc_files: []
|
63
119
|
files:
|
64
120
|
- ".gitignore"
|
121
|
+
- ".rspec"
|
65
122
|
- Gemfile
|
66
123
|
- LICENSE.txt
|
67
124
|
- README.md
|
@@ -69,9 +126,19 @@ files:
|
|
69
126
|
- blot.gemspec
|
70
127
|
- lib/blot.rb
|
71
128
|
- lib/blot/helpers.rb
|
129
|
+
- lib/blot/helpers/button.rb
|
72
130
|
- lib/blot/helpers/grid.rb
|
131
|
+
- lib/blot/helpers/visibility.rb
|
73
132
|
- lib/blot/railtie.rb
|
74
133
|
- lib/blot/version.rb
|
134
|
+
- spec/blot/helpers/button_spec.rb
|
135
|
+
- spec/blot/helpers/grid_spec.rb
|
136
|
+
- spec/blot/helpers/visibility_spec.rb
|
137
|
+
- spec/blot/helpers_spec.rb
|
138
|
+
- spec/blot/railtie_spec.rb
|
139
|
+
- spec/blot/version_spec.rb
|
140
|
+
- spec/spec_helper.rb
|
141
|
+
- spec/support/string.rb
|
75
142
|
homepage: https://github.com/BenMorganIO/blot
|
76
143
|
licenses:
|
77
144
|
- MIT
|
@@ -96,5 +163,13 @@ rubygems_version: 2.2.2
|
|
96
163
|
signing_key:
|
97
164
|
specification_version: 4
|
98
165
|
summary: Blot, a DSL for Ink emails.
|
99
|
-
test_files:
|
166
|
+
test_files:
|
167
|
+
- spec/blot/helpers/button_spec.rb
|
168
|
+
- spec/blot/helpers/grid_spec.rb
|
169
|
+
- spec/blot/helpers/visibility_spec.rb
|
170
|
+
- spec/blot/helpers_spec.rb
|
171
|
+
- spec/blot/railtie_spec.rb
|
172
|
+
- spec/blot/version_spec.rb
|
173
|
+
- spec/spec_helper.rb
|
174
|
+
- spec/support/string.rb
|
100
175
|
has_rdoc:
|