sudo_rails 0.6.1 → 0.7.0

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
  SHA256:
3
- metadata.gz: 6ed6d190a51d927747f58d7ce61af01b6dd8ab0edff663969773ebbbebd21b37
4
- data.tar.gz: 85f9dc0920bdc8226b36053b06c4304b45b55f90a4735b22faed4334a7a87ad1
3
+ metadata.gz: 9b83893c9eec976687c8c2025317dc0e3b0b3174cc128868a0d4cdb079c83bfc
4
+ data.tar.gz: cf24b4e05521fc40d24e31e061c5fc71efb0b63af7eacfcff0164d35d60ac0e4
5
5
  SHA512:
6
- metadata.gz: ef19bd450721d754b582ebe425dcdf30e91758089593743ed16fadd2400ac4cb2e898e336000a840fed37ac69124138cf5105953ff2342cdf3b37b45c6295196
7
- data.tar.gz: 76a63a6de298a85130286495533149325a752c772bcf0a4d3d33ccb20e9645563397c9dca75f0c9174f46e9924b02d58b89a4de5919067ffd2f00cd2cd540bf7
6
+ metadata.gz: 650c2237a64d202041e45f50b3831362af5077d5f1b35e56482d7c93326482c1b022896cd39a215e199c8a52aaf638db7db0b6a90bf7d5bbbb3e37dddf8e32fb
7
+ data.tar.gz: 25f83106ff3762ff132b442f186f2f82966595a82ee7390fef99a9b3a415b87a6cf882adadf14fb6e283a2f35c2b786673f0ff50bd8230cba7e329cff1bd803c
data/README.md CHANGED
@@ -55,9 +55,9 @@ SudoRails.setup do |config|
55
55
  config.sudo_session_duration = 10.minutes
56
56
 
57
57
  # Confirmation page styling
58
- config.custom_logo = 'logos/medium_dark.png'
59
- config.primary_color = '#1A7191'
60
- config.background_color = '#1A7191'
58
+ config.custom_logo = '/images/logo_medium.png'
59
+ config.primary_color = '#1a7191'
60
+ config.background_color = '#1a1a1a'
61
61
  config.layout = 'admin'
62
62
 
63
63
  # Confirmation strategy implementation
@@ -81,7 +81,7 @@ If you set it to `nil`, your `sudo` session won't expire automatically and you w
81
81
 
82
82
  Using the `custom_logo`, `primary_color` and `background_color` options, you can customize the confirmation page. In case you want full control of the styles, you can use your own layout (and consequently your own styles too) using the `layout` option.
83
83
 
84
- See some [examples here](support/images/).
84
+ See some :camera: [examples here](support/images/).
85
85
 
86
86
  **NOTE** If you are using your own layout, don't forget to render the flash messages in that layout. You can do something like [this](app/views/sudo_rails/_flash_alert.html.erb).
87
87
 
@@ -3,8 +3,7 @@
3
3
  <head>
4
4
  <title><%= t('sudo_rails.page_header') %></title>
5
5
  <%= csrf_meta_tags %>
6
- <%= stylesheet_link_tag "sudo_rails/application", media: "all" %>
7
- <%= render 'sudo_rails/inject_custom_styles' if SudoRails.custom_styles? %>
6
+ <%= render 'sudo_rails/stylesheet' %>
8
7
  </head>
9
8
  <body>
10
9
  <%= render 'sudo_rails/flash_alert' %>
@@ -0,0 +1,93 @@
1
+ <style type="text/css">
2
+ body {
3
+ text-align: center;
4
+ font-family: Helvetica, Arial, sans-serif;
5
+ background-color: #ececec;
6
+ margin: 0 auto;
7
+ }
8
+
9
+ a {
10
+ color: #000;
11
+ }
12
+
13
+ input {
14
+ -webkit-appearance: none;
15
+ }
16
+
17
+ .sudo-container {
18
+ transform: translateY(25%);
19
+ }
20
+
21
+ .sudo-header {
22
+ margin: 2em auto;
23
+ }
24
+
25
+ .sudo-header img {
26
+ margin-top: -60px;
27
+ max-width: 280px;
28
+ }
29
+
30
+ .sudo-form {
31
+ background-color: #fff;
32
+ border-radius: 5px;
33
+ padding: 2em;
34
+ margin: 0 auto;
35
+ max-width: 340px;
36
+ box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2);
37
+ }
38
+
39
+ .sudo-form input {
40
+ display: block;
41
+ width: 100%;
42
+ font-size: 16px;
43
+ line-height: 2em;
44
+ padding: 4px;
45
+ border-radius: 5px;
46
+ border: 1px solid #ececec;
47
+ }
48
+
49
+ .sudo-form input[type="submit"] {
50
+ cursor: pointer;
51
+ margin: 1em auto;
52
+ width: 60%;
53
+ padding: 4px;
54
+ background-color: #ececec;
55
+ border-radius: 25px;
56
+ border: none;
57
+ }
58
+
59
+ .sudo-tip {
60
+ margin-top: 2em;
61
+ font-size: 14px;
62
+ }
63
+
64
+ .sudo-alert {
65
+ background: #000;
66
+ color: #fff;
67
+ padding: 10px;
68
+ font-weight: bold;
69
+ }
70
+
71
+ <% if SudoRails.background_color.present? %>
72
+ body {
73
+ background-color: <%= SudoRails.background_color %>;
74
+ color: <%= SudoRails.color_contrast(SudoRails.background_color) %>;
75
+ }
76
+
77
+ .sudo-alert {
78
+ background-color: <%= SudoRails.color_contrast(SudoRails.background_color) %>;
79
+ color: <%= SudoRails.background_color %>;
80
+ }
81
+ <% end %>
82
+
83
+ <% if SudoRails.primary_color.present? %>
84
+ a {
85
+ color: <%= SudoRails.primary_color %>;
86
+ }
87
+
88
+ .sudo-form input[type="submit"] {
89
+ background-color: <%= SudoRails.primary_color %>;
90
+ color: <%= SudoRails.color_contrast(SudoRails.primary_color) %>;
91
+ }
92
+ <% end %>
93
+ </style>
@@ -1,6 +1,6 @@
1
1
  <div class='sudo-header'>
2
2
  <% if SudoRails.custom_logo %>
3
- <%= image_tag SudoRails.custom_logo %>
3
+ <img src="<%= SudoRails.custom_logo %>">
4
4
  <% end %>
5
5
 
6
6
  <h2><%= t('sudo_rails.page_header') %></h2>
data/lib/sudo_rails.rb CHANGED
@@ -2,7 +2,6 @@ require "sudo_rails/version"
2
2
  require "sudo_rails/controller_ext"
3
3
  require "sudo_rails/styling"
4
4
  require "sudo_rails/engine"
5
- require "sassc-rails"
6
5
 
7
6
  module SudoRails
8
7
  class << self
@@ -13,9 +13,5 @@ module SudoRails
13
13
  post '/sudo_rails/confirm' => 'sudo_rails/application#confirm'
14
14
  end
15
15
  end
16
-
17
- config.assets.precompile << %w(
18
- sudo_rails/application.css
19
- )
20
16
  end
21
17
  end
@@ -4,15 +4,10 @@ module SudoRails
4
4
  SudoRails.layout || 'sudo_rails/application'
5
5
  end
6
6
 
7
- def custom_styles?
8
- SudoRails.primary_color.present? || SudoRails.background_color.present?
9
- end
10
-
11
- # Ref: https://gist.github.com/charliepark/480358
12
7
  def color_contrast(hex_color)
13
8
  return nil unless hex_color.include?('#')
14
9
 
15
- hex_color.delete('#').scan(/../).sum { |color| color.hex } > 382.5 ? '#000' : '#FFF'
10
+ hex_color.delete('#').scan(/../).sum { |color| color.hex } > 382.5 ? '#000' : '#fff'
16
11
  end
17
12
  end
18
13
  end
@@ -1,3 +1,3 @@
1
1
  module SudoRails
2
- VERSION = "0.6.1"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sudo_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - markets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.2'
27
- - !ruby/object:Gem::Dependency
28
- name: sassc-rails
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rspec-rails
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -62,11 +48,10 @@ files:
62
48
  - LICENSE
63
49
  - README.md
64
50
  - Rakefile
65
- - app/assets/stylesheets/sudo_rails/application.scss
66
51
  - app/controllers/sudo_rails/application_controller.rb
67
52
  - app/views/layouts/sudo_rails/application.html.erb
68
53
  - app/views/sudo_rails/_flash_alert.html.erb
69
- - app/views/sudo_rails/_inject_custom_styles.html.erb
54
+ - app/views/sudo_rails/_stylesheet.html.erb
70
55
  - app/views/sudo_rails/confirm_form.html.erb
71
56
  - config/locales/en.yml
72
57
  - lib/sudo_rails.rb
@@ -1,68 +0,0 @@
1
- body {
2
- text-align: center;
3
- font-family: Helvetica, Arial, sans-serif;
4
- background-color: #ececec;
5
- margin: 0 auto;
6
- }
7
-
8
- a {
9
- color: #000;
10
- }
11
-
12
- input {
13
- -webkit-appearance: none;
14
- }
15
-
16
- .sudo-container {
17
- transform: translateY(25%);
18
- }
19
-
20
- .sudo-header {
21
- margin: 2em auto;
22
-
23
- img {
24
- margin-top: -60px;
25
- max-width: 280px;
26
- }
27
- }
28
-
29
- .sudo-form {
30
- background-color: #fff;
31
- border-radius: 5px;
32
- padding: 2em;
33
- margin: 0 auto;
34
- max-width: 340px;
35
- box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2);
36
-
37
- input {
38
- display: block;
39
- width: 100%;
40
- font-size: 16px;
41
- line-height: 2em;
42
- padding: 4px;
43
- border-radius: 5px;
44
- border: 1px solid #ececec;
45
- }
46
-
47
- input[type="submit"] {
48
- cursor: pointer;
49
- margin: 1em auto;
50
- width: 60%;
51
- padding: 4px;
52
- background-color: #ececec;
53
- border-radius: 25px;
54
- border: none;
55
- }
56
- }
57
-
58
- .sudo-tip {
59
- margin-top: 2em;
60
- font-size: 14px;
61
- }
62
-
63
- .sudo-alert {
64
- background: #000;
65
- color: #fff;
66
- padding: 10px;
67
- font-weight: bold;
68
- }
@@ -1,24 +0,0 @@
1
- <style type="text/css">
2
- <% if SudoRails.background_color.present? %>
3
- body {
4
- background-color: <%= SudoRails.background_color %>;
5
- color: <%= SudoRails.color_contrast(SudoRails.background_color) %>;
6
- }
7
-
8
- .sudo-alert {
9
- background-color: <%= SudoRails.color_contrast(SudoRails.background_color) %>;
10
- color: <%= SudoRails.background_color %>;
11
- }
12
- <% end %>
13
-
14
- <% if SudoRails.primary_color.present? %>
15
- a {
16
- color: <%= SudoRails.primary_color %>;
17
- }
18
-
19
- .sudo-form input[type="submit"] {
20
- background-color: <%= SudoRails.primary_color %>;
21
- color: <%= SudoRails.color_contrast(SudoRails.primary_color) %>;
22
- }
23
- <% end %>
24
- </style>