sudo_rails 0.6.1 → 0.7.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/README.md +4 -4
- data/app/views/layouts/sudo_rails/application.html.erb +1 -2
- data/app/views/sudo_rails/_stylesheet.html.erb +93 -0
- data/app/views/sudo_rails/confirm_form.html.erb +1 -1
- data/lib/sudo_rails.rb +0 -1
- data/lib/sudo_rails/engine.rb +0 -4
- data/lib/sudo_rails/styling.rb +1 -6
- data/lib/sudo_rails/version.rb +1 -1
- metadata +3 -18
- data/app/assets/stylesheets/sudo_rails/application.scss +0 -68
- data/app/views/sudo_rails/_inject_custom_styles.html.erb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b83893c9eec976687c8c2025317dc0e3b0b3174cc128868a0d4cdb079c83bfc
|
4
|
+
data.tar.gz: cf24b4e05521fc40d24e31e061c5fc71efb0b63af7eacfcff0164d35d60ac0e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 = '
|
59
|
-
config.primary_color = '#
|
60
|
-
config.background_color = '#
|
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
|
-
<%=
|
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>
|
data/lib/sudo_rails.rb
CHANGED
data/lib/sudo_rails/engine.rb
CHANGED
data/lib/sudo_rails/styling.rb
CHANGED
@@ -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' : '#
|
10
|
+
hex_color.delete('#').scan(/../).sum { |color| color.hex } > 382.5 ? '#000' : '#fff'
|
16
11
|
end
|
17
12
|
end
|
18
13
|
end
|
data/lib/sudo_rails/version.rb
CHANGED
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.
|
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:
|
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/
|
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>
|