dvl-core 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80985cd1efd94694ea77912db8b906c7a6dbfc4e
4
- data.tar.gz: e21f200cff904493c23208253b11e59d46570b21
3
+ metadata.gz: 9d483c9ce83bd8cc33e07fbc1f6145da935056ec
4
+ data.tar.gz: 0faea3855a6d151647eb907766ab85cc0ada5526
5
5
  SHA512:
6
- metadata.gz: 5a61a459c89b6e62c776eb0f44a6e33d0c81aa7a6846365f6c80d3322e7dca75b5632282a95e2871599a919854b6933220b70937f9ee2bafd2b1d6ee8d644839
7
- data.tar.gz: c24eb2160c50870a5e5848dee5df9ee089edb23f28985165dc61854a4e1394d888c7a14b15f51a27724037a49f43befb4b4f59c4b397c324230a3b6a0064f7d6
6
+ metadata.gz: a28c487f354160e0378f1055575ac02a5ed004304d3a94433fb4ae0c842525319c474cf3a7d0b51f3eb015a6b10f14b7f791587bc1cec17a3c9cbb4c576c9992
7
+ data.tar.gz: 6efb14e5f11365fd9632aec7c3c3758a406fb4555b5a9b7ea4aa8c193dd8c06aa1fe137cfd701e7500d25b88d3a927410bc100231e42efc060a9f43146cc45ba
data/README.md CHANGED
@@ -19,7 +19,19 @@ gem 'dvl-core'
19
19
 
20
20
  ## Screenshots
21
21
 
22
- ![all_760](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/all_760.png)
22
+ ### Core
23
+
24
+ ![core_760](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/core_760.png)
25
+
26
+ ### Footer
27
+
28
+ ![footer](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/footer.png)
29
+
30
+ ### Flashes
31
+
32
+ ![flash_error](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/flash_error.png)
33
+ ![flash_success](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/flash_success.png)
34
+ ![flash_info](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/flash_info.png)
23
35
 
24
36
  ## Development
25
37
 
@@ -0,0 +1,8 @@
1
+ en:
2
+ dvl_core:
3
+ footer:
4
+ about: " is an application by <a href='http://www.dobt.co' target='_blank'>The Department of Better Technology</a>."
5
+ status: Service Status
6
+ legal: Legal
7
+ help: Get Help
8
+ contact: Contact Us
data/dvl-core.gemspec CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency 'poltergeist', '1.5.1'
26
26
  s.add_development_dependency 'rerun', '0.10.0'
27
27
  s.add_development_dependency 'rspec', '3.1.0'
28
+ s.add_development_dependency 'rspec-html-matchers', '0.6.1'
28
29
  s.add_development_dependency 'sinatra', '1.4.5'
29
30
  s.add_development_dependency 'sinatra-assetpack', '0.3.3'
30
31
  end
@@ -0,0 +1,13 @@
1
+ class Dvl::Core::Components::Flashes < Erector::Widget
2
+ needs :flash
3
+
4
+ def content
5
+ @flash.select { |k, v| k.to_s.in?(%w(success error info)) && v.present? }.each do |k, v|
6
+ div(class: "flash flash_#{k}") {
7
+ a.flash_close '&times;'.html_safe
8
+ span text v
9
+ }
10
+ end
11
+ end
12
+ end
13
+
@@ -0,0 +1,21 @@
1
+ class Dvl::Core::Components::Footer < Erector::Widget
2
+ needs :application_name
3
+
4
+ def content
5
+ footer.footer {
6
+ div.footer_inner {
7
+ span {
8
+ text @application_name
9
+ rawtext t('dvl_core.footer.about')
10
+ }
11
+
12
+ ul {
13
+ li { a t('dvl_core.footer.status'), href: 'http://status.dobt.co', target: '_blank' }
14
+ li { a t('dvl_core.footer.legal'), href: 'https://dashboard.dobt.co/terms', target: '_blank' }
15
+ li { a t('dvl_core.footer.help'), href: 'http://help.dobt.co', target: '_blank' }
16
+ li { a t('dvl_core.footer.contact'), href: 'mailto:support@dobt.co' }
17
+ }
18
+ }
19
+ }
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Dvl
2
2
  module Core
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
data/lib/dvl/core.rb CHANGED
@@ -9,3 +9,13 @@ if defined?(Rails)
9
9
  end
10
10
  end
11
11
  end
12
+
13
+ module Dvl
14
+ module Core
15
+ module Components
16
+ end
17
+ end
18
+ end
19
+
20
+ require 'dvl/core/components/footer'
21
+ require 'dvl/core/components/flashes'
data/preview/app.rb CHANGED
@@ -3,36 +3,43 @@ require 'sinatra/assetpack'
3
3
  require 'active_support/all'
4
4
  require 'erector'
5
5
  require 'dvl/core'
6
+ require 'yaml'
6
7
 
7
8
  module AppHelpers
8
9
  def docs(name, &block)
9
10
  div.section_header name, id: name.downcase
10
11
  yield
11
12
  end
12
- end
13
-
14
- Erector::HTMLWidget.send(:include, AppHelpers)
15
13
 
16
- class App < Sinatra::Base
14
+ def translations
15
+ @translations ||= YAML::load(File.read("#{File.dirname(__FILE__)}/../config/locales/en.yml"))['en']
16
+ end
17
17
 
18
- set :root, File.dirname(__FILE__)
19
- set :scss, { load_paths: [ "#{self.root}/../vendor/assets/stylesheets/dvl" ] }
18
+ def t(key)
19
+ pieces = key.split('.')
20
+ found = translations.dup
20
21
 
21
- register Sinatra::AssetPack
22
+ while pieces.length > 0
23
+ found = found[pieces.shift] || {}
24
+ end
22
25
 
23
- assets do
24
- serve '/css', from: '../vendor/assets/stylesheets'
25
- serve '/js', from: '../vendor/assets/javascripts'
26
+ found
26
27
  end
28
+ end
27
29
 
28
- get '/' do
29
- Erector.inline {
30
+ Erector::HTMLWidget.send(:include, AppHelpers)
31
+
32
+ module Views
33
+ class Base < Erector::Widget
34
+ def content
30
35
  rawtext '<!doctype html>'
31
36
  html {
32
37
  head {
33
38
  link href: '//fonts.googleapis.com/css?family=Open+Sans:400,300,700,600', rel: 'stylesheet', type: 'text/css'
34
39
 
35
40
  link href: '/css/dvl/core.css', rel: 'stylesheet', type: 'text/css', media: 'all'
41
+ link href: '/css/dvl/components/flashes.css', rel: 'stylesheet', type: 'text/css', media: 'all'
42
+ link href: '/css/dvl/components/footer.css', rel: 'stylesheet', type: 'text/css', media: 'all'
36
43
  style(type: 'text/css') {
37
44
  rawtext %{
38
45
  body {
@@ -50,215 +57,271 @@ class App < Sinatra::Base
50
57
  }
51
58
  }
52
59
  body {
53
- docs 'Buttons' do
54
- a.button 'Yo!'
55
- text ' '
56
- a.button.info 'Info'
57
- text ' '
58
- a.button.primary 'Primary'
59
- text ' '
60
- a.button.success 'Success'
61
- text ' '
62
- a.button.white 'White'
63
- text ' '
64
- a.button_uppercase 'Uppercase'
65
- end
66
-
67
- docs 'Code' do
68
- pre %{<p>This is some awesome code</p>}
69
- p %{This is a paragraph with <code>code</code>.}.html_safe
70
- end
71
-
72
- docs 'Dropdowns' do
73
- span.dropdown {
74
- a.dropdown_toggle 'Click me',
75
- 'data-toggle' => 'dropdown'
76
- div.dropdown_menu {
77
- ul.dropdown_body {
78
- li {
79
- a 'Hey!'
80
- }
81
- li {
82
- a 'No!'
83
- }
84
- }
85
- }
86
- }
87
- end
88
-
89
- docs 'Forms' do
90
- form {
91
- input type: 'text'
92
- label.checkbox {
93
- input type: 'checkbox'
94
- text 'Foo'
95
- }
96
- div.input_sub {
97
- label.checkbox {
98
- input type: 'checkbox'
99
- text 'This is a sub-option of foo.'
100
- }
60
+ main
61
+
62
+ script src: '//code.jquery.com/jquery-1.11.1.min.js'
63
+ script src: '/js/dvl/core/modals.js'
64
+ script src: '/js/dvl/core/dropdowns.js'
65
+ script src: '/js/dvl/core/tooltips.js'
66
+ script src: '/js/dvl/core/buttons.js'
67
+ script src: '/js/dvl/components/flashes.js'
68
+ script %{
69
+ $('[data-toggle="tooltip"]').tooltip()
70
+ }.html_safe
71
+ }
72
+ }
73
+ end
74
+ end
75
+
76
+ class Home < Base
77
+ def main
78
+ docs 'Buttons' do
79
+ a.button 'Yo!'
80
+ text ' '
81
+ a.button.info 'Info'
82
+ text ' '
83
+ a.button.primary 'Primary'
84
+ text ' '
85
+ a.button.success 'Success'
86
+ text ' '
87
+ a.button.white 'White'
88
+ text ' '
89
+ a.button_uppercase 'Uppercase'
90
+ end
91
+
92
+ docs 'Code' do
93
+ pre %{<p>This is some awesome code</p>}
94
+ p %{This is a paragraph with <code>code</code>.}.html_safe
95
+ end
96
+
97
+ docs 'Dropdowns' do
98
+ span.dropdown {
99
+ a.dropdown_toggle 'Click me',
100
+ 'data-toggle' => 'dropdown'
101
+ div.dropdown_menu {
102
+ ul.dropdown_body {
103
+ li {
104
+ a 'Hey!'
101
105
  }
102
- div.form_actions {
103
- button.button.primary 'Submit'
106
+ li {
107
+ a 'No!'
104
108
  }
105
109
  }
106
- end
110
+ }
111
+ }
112
+ end
107
113
 
108
- docs 'Grid' do
109
- div.grid {
110
- div.item.six_columns 'six_columns'
111
- div.item.six_columns 'six_columns'
112
- }
113
- div.grid.gutter_none {
114
- div.item.three_columns 'three_columns (gutter_none)'
115
- div.item.three_columns 'three_columns (gutter_none)'
116
- div.item.three_columns 'three_columns (gutter_none)'
117
- div.item.three_columns 'three_columns (gutter_none)'
118
- }
119
- end
120
-
121
- docs 'Labels' do
122
- span.label.label_error 'Error'
123
- text ' '
124
- span.label.label_success 'Success'
125
- text ' '
126
- span.label.label_info 'Info'
127
- text ' '
128
- span.label.label_warning 'Warning'
129
- end
130
-
131
- docs 'Links' do
132
- a.uppercase 'Uppercase'
133
- text ' '
134
- a.smallbold 'Smallbold'
135
- end
136
-
137
- docs 'Lists' do
138
- ul {
139
- li 'This'
140
- li 'is a'
141
- li 'list!'
142
- }
143
- end
144
-
145
- docs 'Modals' do
146
- a 'Open modal', 'data-toggle' => 'modal', href: '#modal'
147
- div(class: 'modal', tabindex: '-1', id: 'modal') {
148
- div.modal_dialog {
149
- div.modal_content {
150
- div.modal_header {
151
- a.close '&times;'.html_safe, 'data-dismiss' => 'modal'
152
- h3 'Awesome modal'.html_safe
153
- }
154
-
155
- div.modal_body {
156
- text 'This is the modal body!'
157
- }
158
-
159
- div.modal_footer {
160
- text 'This is the modal footer!'
161
- }
162
- }
163
- }
114
+ docs 'Forms' do
115
+ form {
116
+ input type: 'text'
117
+ label.checkbox {
118
+ input type: 'checkbox'
119
+ text 'Foo'
120
+ }
121
+ div.input_sub {
122
+ label.checkbox {
123
+ input type: 'checkbox'
124
+ text 'This is a sub-option of foo.'
164
125
  }
165
- end
166
-
167
- docs 'Pagination' do
168
- div(class: 'pagination-wrapper') {
169
- ul {
170
- li { a '‹' }
171
- li { a '1' }
172
- li { span '2' }
173
- li { a '3' }
174
- li { a '' }
126
+ }
127
+ div.form_actions {
128
+ button.button.primary 'Submit'
129
+ }
130
+ }
131
+ end
132
+
133
+ docs 'Grid' do
134
+ div.grid {
135
+ div.item.six_columns 'six_columns'
136
+ div.item.six_columns 'six_columns'
137
+ }
138
+ div.grid.gutter_none {
139
+ div.item.three_columns 'three_columns (gutter_none)'
140
+ div.item.three_columns 'three_columns (gutter_none)'
141
+ div.item.three_columns 'three_columns (gutter_none)'
142
+ div.item.three_columns 'three_columns (gutter_none)'
143
+ }
144
+ end
145
+
146
+ docs 'Labels' do
147
+ span.label.label_error 'Error'
148
+ text ' '
149
+ span.label.label_success 'Success'
150
+ text ' '
151
+ span.label.label_info 'Info'
152
+ text ' '
153
+ span.label.label_warning 'Warning'
154
+ end
155
+
156
+ docs 'Links' do
157
+ a.uppercase 'Uppercase'
158
+ text ' '
159
+ a.smallbold 'Smallbold'
160
+ end
161
+
162
+ docs 'Lists' do
163
+ ul {
164
+ li 'This'
165
+ li 'is a'
166
+ li 'list!'
167
+ }
168
+ end
169
+
170
+ docs 'Modals' do
171
+ a 'Open modal', 'data-toggle' => 'modal', href: '#modal'
172
+ div(class: 'modal', tabindex: '-1', id: 'modal') {
173
+ div.modal_dialog {
174
+ div.modal_content {
175
+ div.modal_header {
176
+ a.close '&times;'.html_safe, 'data-dismiss' => 'modal'
177
+ h3 'Awesome modal'.html_safe
175
178
  }
176
- }
177
- end
178
179
 
179
- docs 'Progress' do
180
- div.progress {
181
- div.progress_inner(style: "width: 30%") {
182
- text '30%'
180
+ div.modal_body {
181
+ text 'This is the modal body!'
183
182
  }
184
- }
185
- end
186
-
187
- docs 'Sidebar' do
188
- div.sidebar_box {
189
- ul.sidebar_data {
190
- li {
191
- div.sidebar_data_icon {
192
- i '✓'
193
- }
194
- div.sidebar_data_text {
195
- div.sidebar_data_label 'Label'
196
- div.sidebar_data_value 'Value'
197
- div.sidebar_data_details 'Details'
198
- }
199
- }
183
+
184
+ div.modal_footer {
185
+ text 'This is the modal footer!'
200
186
  }
201
187
  }
202
- end
203
-
204
- docs 'Tables' do
205
- table.stripes {
206
- thead {
207
- tr {
208
- th 'ID'
209
- th 'Name'
210
- }
188
+ }
189
+ }
190
+ end
191
+
192
+ docs 'Pagination' do
193
+ div(class: 'pagination-wrapper') {
194
+ ul {
195
+ li { a '' }
196
+ li { a '1' }
197
+ li { span '2' }
198
+ li { a '3' }
199
+ li { a '›' }
200
+ }
201
+ }
202
+ end
203
+
204
+ docs 'Progress' do
205
+ div.progress {
206
+ div.progress_inner(style: "width: 30%") {
207
+ text '30%'
208
+ }
209
+ }
210
+ end
211
+
212
+ docs 'Sidebar' do
213
+ div.sidebar_box {
214
+ ul.sidebar_data {
215
+ li {
216
+ div.sidebar_data_icon {
217
+ i '✓'
211
218
  }
212
- tbody {
213
- tr {
214
- td '1'
215
- td 'Bob'
216
- }
217
- tr {
218
- td '2'
219
- td 'Job'
220
- }
219
+ div.sidebar_data_text {
220
+ div.sidebar_data_label 'Label'
221
+ div.sidebar_data_value 'Value'
222
+ div.sidebar_data_details 'Details'
221
223
  }
222
224
  }
223
- end
224
-
225
- docs 'Tooltips' do
226
- %w(top right bottom left).each do |x|
227
- a x.capitalize,
228
- 'data-toggle' => 'tooltip',
229
- 'data-placement' => x,
230
- 'data-container' => 'body',
231
- title: "Tooltip on the #{x}!"
232
- text ' '
233
- end
234
- end
235
-
236
- docs 'Typography' do
237
- h1 'Heading 1'
238
- h2 'Heading 2'
239
- h3 'Heading 3'
240
- h4 'Heading 4'
241
- h5 'Heading 5'
242
- h6 'Heading 6'
243
- p 'Lorem ipsum.'
244
-
245
- p.microcopy {
246
- text 'This is some awesome .microcopy.'
247
- a.microcopy_action 'Microcopy action'
225
+ }
226
+ }
227
+ end
228
+
229
+ docs 'Tables' do
230
+ table {
231
+ thead {
232
+ tr {
233
+ th 'ID'
234
+ th 'Name'
235
+ }
236
+ }
237
+ tbody {
238
+ tr {
239
+ td '1'
240
+ td 'Bob'
248
241
  }
249
- end
242
+ tr {
243
+ td '2'
244
+ td 'Job'
245
+ }
246
+ }
247
+ }
248
+ end
250
249
 
251
- script src: '//code.jquery.com/jquery-1.11.1.min.js'
252
- script src: '/js/dvl/core/modals.js'
253
- script src: '/js/dvl/core/dropdowns.js'
254
- script src: '/js/dvl/core/tooltips.js'
255
- script src: '/js/dvl/core/buttons.js'
256
- script %{
257
- $('[data-toggle="tooltip"]').tooltip()
258
- }.html_safe
250
+ docs 'Tooltips' do
251
+ %w(top right bottom left).each do |x|
252
+ a x.capitalize,
253
+ 'data-toggle' => 'tooltip',
254
+ 'data-placement' => x,
255
+ 'data-container' => 'body',
256
+ title: "Tooltip on the #{x}!"
257
+ text ' '
258
+ end
259
+ end
260
+
261
+ docs 'Typography' do
262
+ h1 'Heading 1'
263
+ h2 'Heading 2'
264
+ h3 'Heading 3'
265
+ h4 'Heading 4'
266
+ h5 'Heading 5'
267
+ h6 'Heading 6'
268
+ p 'Lorem ipsum.'
269
+
270
+ p.microcopy {
271
+ text 'This is some awesome .microcopy.'
272
+ a.microcopy_action 'Microcopy action'
273
+ }
274
+ end
275
+ end
276
+ end
277
+
278
+ class Flashes < Base
279
+ def main
280
+ ul {
281
+ li {
282
+ a 'Success', href: 'javascript:DvlFlash("success", "You did it!")'
283
+ }
284
+ li {
285
+ a 'Info', href: 'javascript:DvlFlash("info", "An informational message...")'
286
+ }
287
+ li {
288
+ a 'Error', href: 'javascript:DvlFlash("error", "Oh no, an error occured!")'
259
289
  }
260
290
  }
261
- }.to_html
291
+ end
292
+ end
293
+
294
+ class Footer < Base
295
+ def main
296
+ br
297
+ br
298
+ widget Dvl::Core::Components::Footer.new(application_name: 'dvl-core')
299
+ end
300
+ end
301
+ end
302
+
303
+ class App < Sinatra::Base
304
+
305
+ set :root, File.dirname(__FILE__)
306
+ set :scss, { load_paths: [ "#{self.root}/../vendor/assets/stylesheets", "#{self.root}/../vendor/assets/stylesheets/dvl" ] }
307
+
308
+ register Sinatra::AssetPack
309
+
310
+ assets do
311
+ serve '/css', from: '../vendor/assets/stylesheets'
312
+ serve '/js', from: '../vendor/assets/javascripts'
313
+ end
314
+
315
+ get '/' do
316
+ Views::Home.new.to_html
317
+ end
318
+
319
+ get '/flashes' do
320
+ Views::Flashes.new.to_html
321
+ end
322
+
323
+ get '/footer' do
324
+ Views::Footer.new.to_html
262
325
  end
263
326
 
264
327
  run! if app_file == $0
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Flashes' do
4
+ describe 'Integration', type: :feature, js: true do
5
+ it 'Flashes properly' do
6
+ visit '/'
7
+ page.execute_script "DvlFlash('error', 'Yeah!')"
8
+ expect(page).to have_selector '.flash.flash_error', text: 'Yeah!'
9
+ sleep 4
10
+ expect(page).to_not have_selector '.flash.flash_error', text: 'Yeah!'
11
+ end
12
+ end
13
+
14
+ describe Dvl::Core::Components::Flashes do
15
+ let!(:success_html) do
16
+ described_class.new(
17
+ flash: { 'success' => 'Yeah!' }
18
+ ).to_html
19
+ end
20
+
21
+ let!(:error_html) do
22
+ described_class.new(
23
+ flash: { 'error' => 'No!' }
24
+ ).to_html
25
+ end
26
+
27
+ it 'renders the proper html' do
28
+ expect(success_html).to have_tag('div.flash_success', content: 'Yeah!')
29
+ end
30
+
31
+ it 'renders the proper html' do
32
+ expect(error_html).to have_tag('div.flash_error', content: 'No!')
33
+ end
34
+ end
35
+ end
data/spec/main_spec.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Main' do
4
+ describe 'Screenshots', type: :feature, js: true do
5
+ take_screenshot '/', 'core_1200', 1200, 1000, full: true
6
+ take_screenshot '/', 'core_760', 760, 1000, full: true
7
+ take_screenshot '/', 'core_400', 400, 1000, full: true
8
+ take_screenshot '/footer', 'footer', 1000, 400
9
+ take_flash_screenshot 'Error', 'flash_error'
10
+ take_flash_screenshot 'Success', 'flash_success'
11
+ take_flash_screenshot 'Info', 'flash_info'
12
+ take_flash_screenshot 'Error', 'flash_error_mobile', 320, 150
13
+ end
14
+ end
@@ -1,5 +1,6 @@
1
1
  require 'capybara/rspec'
2
2
  require 'capybara/poltergeist'
3
+ require 'rspec-html-matchers'
3
4
  require 'active_support/all'
4
5
  require 'erector'
5
6
  require 'dvl/core'
@@ -21,10 +22,17 @@ def take_screenshot(path, name, res_x = 900, res_y = 150, opts = {})
21
22
  end
22
23
  end
23
24
 
24
- describe Dvl::Core do
25
- describe 'Screenshots', type: :feature, js: true do
26
- take_screenshot '/', 'all_1200', 1200, 1000, full: true
27
- take_screenshot '/', 'all_760', 760, 1000, full: true
28
- take_screenshot '/', 'all_400', 400, 1000, full: true
25
+ def take_flash_screenshot(type, name, res_x = 900, res_y = 150, opts = {})
26
+ describe "taking flash screenshot: #{name}.png" do
27
+ before do
28
+ page.driver.resize(res_x, res_y)
29
+ end
30
+
31
+ it 'works' do
32
+ visit '/flashes'
33
+ click_link type
34
+ page.save_screenshot "screenshots/#{name}.png", opts
35
+ end
29
36
  end
30
37
  end
38
+
@@ -0,0 +1,48 @@
1
+ TRANSITION_LENGTH = 300
2
+ FLASH_ALERT_LENGTH = 3500
3
+
4
+ # Grab alerts rendered by the server and apply our behavior to them
5
+ $ ->
6
+ $('.flash').each ->
7
+ DvlFlash $(@)
8
+
9
+ window.DvlFlash = (alertType, message, lengthInMilliseconds) ->
10
+ # Initialize from an existing alert
11
+ if alertType instanceof jQuery
12
+ $alert = alertType
13
+ else
14
+ $alert = $("""
15
+ <div class="flash flash_#{alertType}">
16
+ <a class='flash_close'>&times;</a>
17
+ <span>#{message}</span>
18
+ </div>
19
+ """).appendTo("body")
20
+
21
+ setTimeout ->
22
+ $alert.addClass 'is_visible'
23
+ , 0
24
+
25
+ mousedOver = undefined
26
+ timeoutExpired = undefined
27
+
28
+ hide = ->
29
+ $alert.removeClass 'is_visible'
30
+ setTimeout ->
31
+ $alert.remove()
32
+ , TRANSITION_LENGTH
33
+
34
+ setTimeout ->
35
+ hide() unless mousedOver
36
+ timeoutExpired = true
37
+ , lengthInMilliseconds || FLASH_ALERT_LENGTH
38
+
39
+ $alert.on 'mouseover', ->
40
+ mousedOver = true
41
+
42
+ $alert.one 'mouseout', ->
43
+ mousedOver = undefined
44
+ hide() if timeoutExpired
45
+
46
+ $alert.on 'click', '.flash_close', ->
47
+ mousedOver = undefined
48
+ hide()
@@ -0,0 +1,66 @@
1
+ @import 'dvl/core/includes';
2
+
3
+ $dvlFlashZIndex: 1031 !default; // above modal
4
+ $dvlFlashDefaultColor: #2886A8 !default;
5
+
6
+ .flash {
7
+ position: fixed;
8
+ left: 0;
9
+ top: 0;
10
+ transform: translateY(-8rem);
11
+ opacity: 0;
12
+ transition: transform 0.3s ease-out, opacity 0.15s ease-out;
13
+ width: 95%;
14
+ margin: 1rem 2.5% 0;
15
+ z-index: $dvlFlashZIndex;
16
+ background: $dvlFlashDefaultColor;
17
+ border-radius: $radius;
18
+ padding: 0.75rem 1rem;
19
+ font-size: 0.9rem;
20
+ color: $white;
21
+ box-shadow: 0 1px 0 rgba(#000,0.2);
22
+ line-height: 1rem;
23
+ span {
24
+ display: inline-block;
25
+ max-width: 95%;
26
+ }
27
+ a {
28
+ text-decoration: underline;
29
+ color: $white;
30
+ }
31
+ &.is_visible {
32
+ opacity: 1;
33
+ transform: translateY(0);
34
+ }
35
+ .flash_close {
36
+ position: absolute;
37
+ line-height: 2.5rem;
38
+ text-decoration: none;
39
+ right: 1rem;
40
+ top: 0;
41
+ font-weight: bold;
42
+ color: $lightGray;
43
+ &:hover {
44
+ color: $white;
45
+ text-decoration: none;
46
+ }
47
+ }
48
+ }
49
+
50
+ // Colors
51
+
52
+ .flash_error {
53
+ background: $errorColor;
54
+ }
55
+
56
+ .flash_success {
57
+ background: $successColor;
58
+ }
59
+
60
+ @media only screen and (min-width: 768px) {
61
+ .flash {
62
+ width: 50rem;
63
+ margin-left: -25rem;
64
+ left: 50%;
65
+ }
66
+ }
@@ -0,0 +1,16 @@
1
+ @import "dvl/core/includes";
2
+
3
+ .footer {
4
+ font-size: 0.85rem;
5
+ color: $darkGray;
6
+ padding: 1rem 0;
7
+ line-height: 22px;
8
+ border-top: 1px solid #f2f2f2;
9
+ li {
10
+ display: inline;
11
+ margin-right: 0.75rem;
12
+ &:last-child {
13
+ margin-right: 0;
14
+ }
15
+ }
16
+ }
@@ -46,7 +46,7 @@ span.dropdown {
46
46
  // Links
47
47
  .dropdown_body {
48
48
  max-height: 350px;
49
- overflow: scroll;
49
+ overflow: auto;
50
50
  > li {
51
51
  > a,
52
52
  > span {
@@ -116,7 +116,4 @@ table {
116
116
  }
117
117
  }
118
118
  }
119
- &.stripes tbody > tr:nth-child(even) {
120
- background-color: $lightestGray;
121
- }
122
119
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dvl-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Becker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-15 00:00:00.000000000 Z
11
+ date: 2014-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
124
  version: 3.1.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec-html-matchers
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.6.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.6.1
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: sinatra
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -161,20 +175,28 @@ files:
161
175
  - Gemfile
162
176
  - README.md
163
177
  - circle.yml
178
+ - config/locales/en.yml
164
179
  - dvl-core.gemspec
165
180
  - lib/dvl/core.rb
181
+ - lib/dvl/core/components/flashes.rb
182
+ - lib/dvl/core/components/footer.rb
166
183
  - lib/dvl/core/version.rb
167
184
  - preview/app.rb
168
185
  - script/bootstrap
169
186
  - script/cibuild
170
187
  - script/preview
171
188
  - script/release
172
- - spec/dvl_core_spec.rb
189
+ - spec/dvl_flashes_spec.rb
190
+ - spec/main_spec.rb
191
+ - spec/spec_helper.rb
192
+ - vendor/assets/javascripts/dvl/components/flashes.coffee
173
193
  - vendor/assets/javascripts/dvl/core.js
174
194
  - vendor/assets/javascripts/dvl/core/buttons.js
175
195
  - vendor/assets/javascripts/dvl/core/dropdowns.js
176
196
  - vendor/assets/javascripts/dvl/core/modals.js
177
197
  - vendor/assets/javascripts/dvl/core/tooltips.js
198
+ - vendor/assets/stylesheets/dvl/components/flashes.scss
199
+ - vendor/assets/stylesheets/dvl/components/footer.scss
178
200
  - vendor/assets/stylesheets/dvl/core.scss
179
201
  - vendor/assets/stylesheets/dvl/core/buttons.scss
180
202
  - vendor/assets/stylesheets/dvl/core/code.scss
@@ -222,5 +244,7 @@ signing_key:
222
244
  specification_version: 4
223
245
  summary: Base styles for the DOBT View Layer.
224
246
  test_files:
225
- - spec/dvl_core_spec.rb
247
+ - spec/dvl_flashes_spec.rb
248
+ - spec/main_spec.rb
249
+ - spec/spec_helper.rb
226
250
  has_rdoc: