dvl-core 0.0.4 → 0.0.5

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: 9d483c9ce83bd8cc33e07fbc1f6145da935056ec
4
- data.tar.gz: 0faea3855a6d151647eb907766ab85cc0ada5526
3
+ metadata.gz: cc2345f55387cc09bb5531eb7ae72c4ee9f45502
4
+ data.tar.gz: b17acdbf412ed3f8c82f094168d44fb7af2db5f3
5
5
  SHA512:
6
- metadata.gz: a28c487f354160e0378f1055575ac02a5ed004304d3a94433fb4ae0c842525319c474cf3a7d0b51f3eb015a6b10f14b7f791587bc1cec17a3c9cbb4c576c9992
7
- data.tar.gz: 6efb14e5f11365fd9632aec7c3c3758a406fb4555b5a9b7ea4aa8c193dd8c06aa1fe137cfd701e7500d25b88d3a927410bc100231e42efc060a9f43146cc45ba
6
+ metadata.gz: 6fda03c9527f401603ff5100b7e628b98adb33884578bf9018ce69484f176dbe28c07446ca400488e5eea976859de8154dc1c485da8f14d414a78a149c656293
7
+ data.tar.gz: 7fa211bbd00527a19a6e78222df7b268e44a887a92830c5a9b3a01766d7b63f4c34c293442032d7ac0306b50abdf6945bea979c40bf5399fa170f6f793b16322
data/README.md CHANGED
@@ -33,6 +33,11 @@ gem 'dvl-core'
33
33
  ![flash_success](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/flash_success.png)
34
34
  ![flash_info](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/flash_info.png)
35
35
 
36
+ ### Modals
37
+
38
+ ![modal](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/modal.png)
39
+ ![confirm_modal](http://artifinder.herokuapp.com/gh/dobtco/dvl-core/x/artifacts/0/home/ubuntu/dvl-core/screenshots/confirm_modal.png)
40
+
36
41
  ## Development
37
42
 
38
43
  1. `script/bootstrap`
@@ -1,4 +1,4 @@
1
- class Dvl::Core::Components::Flashes < Erector::Widget
1
+ class Dvl::Components::Flashes < Erector::Widget
2
2
  needs :flash
3
3
 
4
4
  def content
@@ -1,4 +1,4 @@
1
- class Dvl::Core::Components::Footer < Erector::Widget
1
+ class Dvl::Components::Footer < Erector::Widget
2
2
  needs :application_name
3
3
 
4
4
  def content
@@ -0,0 +1,24 @@
1
+ class Dvl::Components::Modal < Erector::Widget
2
+ needs :title,
3
+ id: nil,
4
+ html_opts: {}
5
+
6
+ def content
7
+ div(@html_opts.merge(class: "modal #{@html_opts[:class]}", tabindex: '-1', id: @id)) {
8
+ div.modal_dialog {
9
+ div.modal_content {
10
+ div.modal_header {
11
+ a.close '&times;'.html_safe, 'data-dismiss' => 'modal'
12
+ h3 @title.html_safe
13
+ }
14
+
15
+ modal_content
16
+ }
17
+ }
18
+ }
19
+ end
20
+
21
+ def modal_content
22
+ call_block
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  module Dvl
2
2
  module Core
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
data/lib/dvl/core.rb CHANGED
@@ -1,21 +1,17 @@
1
1
  require 'dvl/core/version'
2
2
 
3
- if defined?(Rails)
4
- module Dvl
5
- module Core
3
+ module Dvl
4
+ module Core
5
+ if defined?(Rails)
6
6
  class Engine < ::Rails::Engine
7
- # nada
8
7
  end
9
8
  end
10
9
  end
11
- end
12
10
 
13
- module Dvl
14
- module Core
15
- module Components
16
- end
11
+ module Components
17
12
  end
18
13
  end
19
14
 
20
- require 'dvl/core/components/footer'
21
- require 'dvl/core/components/flashes'
15
+ require 'dvl/components/footer'
16
+ require 'dvl/components/flashes'
17
+ require 'dvl/components/modal'
data/preview/app.rb CHANGED
@@ -169,24 +169,27 @@ module Views
169
169
 
170
170
  docs 'Modals' do
171
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
178
- }
172
+ widget Dvl::Components::Modal.new(title: 'Awesome modal', id: 'modal') do
173
+ div.modal_body {
174
+ text 'This is the modal body!'
175
+ }
176
+ end
179
177
 
180
- div.modal_body {
181
- text 'This is the modal body!'
182
- }
178
+ br
183
179
 
184
- div.modal_footer {
185
- text 'This is the modal footer!'
186
- }
187
- }
180
+ a 'Confirmation modal', 'data-toggle' => 'modal', href: '#confirmModal'
181
+ widget Dvl::Components::Modal.new(
182
+ title: 'Are you sure?',
183
+ id: 'confirmModal',
184
+ html_opts: { class: 'modal_confirm' }
185
+ ) do
186
+ div.modal_body {
187
+ text 'Are you sure?'
188
188
  }
189
- }
189
+ div.modal_footer {
190
+ a.button.error 'OK'
191
+ }
192
+ end
190
193
  end
191
194
 
192
195
  docs 'Pagination' do
@@ -295,7 +298,7 @@ module Views
295
298
  def main
296
299
  br
297
300
  br
298
- widget Dvl::Core::Components::Footer.new(application_name: 'dvl-core')
301
+ widget Dvl::Components::Footer.new(application_name: 'dvl-core')
299
302
  end
300
303
  end
301
304
  end
@@ -11,7 +11,7 @@ describe 'Flashes' do
11
11
  end
12
12
  end
13
13
 
14
- describe Dvl::Core::Components::Flashes do
14
+ describe Dvl::Components::Flashes do
15
15
  let!(:success_html) do
16
16
  described_class.new(
17
17
  flash: { 'success' => 'Yeah!' }
data/spec/main_spec.rb CHANGED
@@ -2,13 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe 'Main' do
4
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
5
+ take_screenshot '/', 'core_1200', res_x: 1200, res_y: 1000, full: true
6
+ take_screenshot '/', 'core_760', res_x: 760, res_y: 1000, full: true
7
+ take_screenshot '/', 'core_400', res_x: 400, res_y: 1000, full: true
8
+ take_screenshot '/footer', 'footer', res_x: 1000, res_y: 200
9
+ take_screenshot '/flashes', 'flash_error', res_y: 100, before: Proc.new { click_link('Error') }
10
+ take_screenshot '/flashes', 'flash_success', res_y: 100, before: Proc.new { click_link('Success') }
11
+ take_screenshot '/flashes', 'flash_info', res_y: 100, before: Proc.new { click_link('Info') }
12
+ take_screenshot '/flashes', 'flash_error_mobile', res_x: 320, res_y: 100, before: Proc.new { click_link('Error') }
13
+ take_screenshot '/', 'modal', res_x: 1000, res_y: 250, before: Proc.new { click_link('Open modal') }
14
+ take_screenshot '/', 'confirm_modal', res_x: 1000, res_y: 250, before: Proc.new { click_link('Confirmation modal') }
13
15
  end
14
16
  end
data/spec/spec_helper.rb CHANGED
@@ -9,30 +9,16 @@ require_relative '../preview/app'
9
9
  Capybara.app = App
10
10
  Capybara.javascript_driver = :poltergeist
11
11
 
12
- def take_screenshot(path, name, res_x = 900, res_y = 150, opts = {})
12
+ def take_screenshot(path, name, opts = {})
13
13
  describe "taking screenshot: #{name}.png" do
14
14
  before do
15
- page.driver.resize(res_x, res_y)
15
+ page.driver.resize(opts[:res_x] || 900, opts[:res_y] || 500)
16
16
  end
17
17
 
18
18
  it 'works' do
19
19
  visit path
20
- page.save_screenshot "screenshots/#{name}.png", opts
20
+ self.instance_eval(&opts[:before]) if opts[:before]
21
+ page.save_screenshot "screenshots/#{name}.png", opts.slice(:full)
21
22
  end
22
23
  end
23
24
  end
24
-
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
36
- end
37
- end
38
-
@@ -46,10 +46,23 @@
46
46
  position: relative;
47
47
  background-color: #fff;
48
48
  border: 1px solid rgba(#000,0.15);
49
- border-radius: $radius * 2;
49
+ border-radius: $radius;
50
50
  background-clip: padding-box;
51
51
  // Remove focus outline from opened modal
52
52
  outline: 0;
53
+ box-shadow: 0 1px 3px rgba(#000,0.18);
54
+ animation: modal_show 0.25s ease-out;
55
+ }
56
+
57
+ @keyframes modal_show {
58
+ 0% {
59
+ opacity: 0;
60
+ transform: scale(0.93);
61
+ }
62
+ 100% {
63
+ opacity: 1;
64
+ transform: scale(1);
65
+ }
53
66
  }
54
67
 
55
68
  // Modal background
@@ -60,11 +73,15 @@
60
73
  bottom: 0;
61
74
  left: 0;
62
75
  background-color: #000;
63
- // Fade for backdrop
64
- &.fade {
76
+ opacity: 0.5;
77
+ animation: fade_half 170ms ease-in;
78
+ }
79
+
80
+ @keyframes fade_half {
81
+ 0% {
65
82
  opacity: 0;
66
83
  }
67
- &.in {
84
+ 100% {
68
85
  opacity: 0.5;
69
86
  }
70
87
  }
@@ -75,29 +92,26 @@
75
92
  padding: 1rem 2rem;
76
93
  background-color: #f0f0f0;
77
94
  margin-bottom: 1rem;
78
- @include border_top_radius(($radius * 2) - 1);
79
95
  position: relative;
96
+ padding: 0.5rem 1.75rem;
80
97
  h3 {
81
- font-size: 1.6rem;
82
- font-weight: normal;
98
+ font-size: 1.35rem;
99
+ font-weight: 600;
83
100
  margin: 0;
84
- color: #333;
101
+ color: #444;
102
+ line-height: 2rem;
85
103
  }
86
104
  .close {
87
- position: absolute;
88
- top: -9px;
89
- right: -9px;
90
- color: #fff;
91
- background-color: $darkestGray;
92
- border-radius: 50%;
93
- width: 24px;
94
- height: 24px;
105
+ float: right;
106
+ color: rgba(#000,0.6);
95
107
  text-decoration: none;
96
- text-align: center;
97
- font-size: 20px;
98
- line-height: 24px;
108
+ text-align: right;
109
+ font-size: 2rem;
110
+ font-weight: 300;
111
+ line-height: 2rem;
112
+ width: 2rem;
99
113
  &:hover {
100
- background-color: #4d4d4d;
114
+ color: rgba(#000,0.75);
101
115
  }
102
116
  }
103
117
  }
@@ -149,6 +163,12 @@
149
163
  color: #fff;
150
164
  }
151
165
  }
166
+ .close {
167
+ color: rgba(#fff,0.8);
168
+ &:hover {
169
+ color: rgba(#fff,0.92);
170
+ }
171
+ }
152
172
  .modal_body p {
153
173
  font-size: 1.1rem;
154
174
  margin-bottom: 0;
@@ -60,15 +60,13 @@ ul {
60
60
  margin: 0 0 1rem;
61
61
  }
62
62
 
63
- dl {
64
- dt {
65
- color: $black;
66
- font-weight: 700;
67
- }
63
+ dt {
64
+ color: #888;
65
+ font-size: 0.9rem;
66
+ }
68
67
 
69
- dd {
70
- margin: 0 0 1rem;
71
- }
68
+ dd {
69
+ margin: 0 0 1.5rem;
72
70
  }
73
71
 
74
72
  em,
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.4
4
+ version: 0.0.5
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-23 00:00:00.000000000 Z
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -177,9 +177,10 @@ files:
177
177
  - circle.yml
178
178
  - config/locales/en.yml
179
179
  - dvl-core.gemspec
180
+ - lib/dvl/components/flashes.rb
181
+ - lib/dvl/components/footer.rb
182
+ - lib/dvl/components/modal.rb
180
183
  - lib/dvl/core.rb
181
- - lib/dvl/core/components/flashes.rb
182
- - lib/dvl/core/components/footer.rb
183
184
  - lib/dvl/core/version.rb
184
185
  - preview/app.rb
185
186
  - script/bootstrap