rails_onboarding 0.8.14 → 0.8.15
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/app/assets/stylesheets/rails_onboarding/flash_messages.css +34 -7
- data/app/models/concerns/rails_onboarding/onboardable.rb +11 -1
- data/app/views/layouts/rails_onboarding/application.html.erb +5 -0
- data/app/views/rails_onboarding/shared/_flash.html.erb +23 -22
- data/lib/rails_onboarding/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df859b74947576d40a44a8a6ce1e37ceb1c9b92297875ac06faa3926f19489cc
|
|
4
|
+
data.tar.gz: 360a0d59bece71c30df19f549bea51cba322b7d0abf0e657d2e77d8b4b9e9d3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0fce05257f5c3f4af31cd191dc961ea151e2b753988758e53315e9914f6db67d4d22f1759ae81562b60b8bbe177a2cd3b59ddeb0f840f42ff46b0834f32b63fe
|
|
7
|
+
data.tar.gz: 83404bc6ac100510474a792a1ff245dbb09f53166df47325117b4f3551cacdeca9bf60dc54550d6c07794c8f371a93f9c2779dc1c48d6d1ffae01d0c4a9ef16e
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
max-width: 500px;
|
|
9
9
|
width: 100%;
|
|
10
10
|
pointer-events: none;
|
|
11
|
+
/* Outside .onboarding-container, which is where the engine sets its font, so it would otherwise
|
|
12
|
+
take the browser's serif default. */
|
|
13
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
.onboarding-flash {
|
|
@@ -29,25 +32,46 @@
|
|
|
29
32
|
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
/*
|
|
35
|
+
/* Each message is an open <dialog> (see shared/_flash), so it closes without JavaScript. Undo
|
|
36
|
+
what the browser gives a dialog - centred, absolutely placed, bordered all round - leaving the
|
|
37
|
+
coloured left border from the type rules below. */
|
|
38
|
+
dialog.onboarding-flash {
|
|
39
|
+
inset: auto;
|
|
40
|
+
margin: 0 0 12px;
|
|
41
|
+
width: auto;
|
|
42
|
+
max-width: none;
|
|
43
|
+
max-height: none;
|
|
44
|
+
border-top: 0;
|
|
45
|
+
border-right: 0;
|
|
46
|
+
border-bottom: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* The close form is only there for method="dialog"; its button is the flex item. */
|
|
50
|
+
.onboarding-flash form {
|
|
51
|
+
display: contents;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Flash types. Each pair is at least 4.5:1 (WCAG AA): white on the 500-weight greens, ambers and
|
|
55
|
+
reds these used was 2-4:1, unreadable on amber in particular. Amber keeps its colour and takes
|
|
56
|
+
dark text instead. */
|
|
33
57
|
.flash-notice,
|
|
34
58
|
.flash-success {
|
|
35
|
-
background-color: #
|
|
59
|
+
background-color: #047857;
|
|
36
60
|
color: white;
|
|
37
|
-
border-left: 4px solid #
|
|
61
|
+
border-left: 4px solid #065f46;
|
|
38
62
|
}
|
|
39
63
|
|
|
40
64
|
.flash-alert,
|
|
41
65
|
.flash-warning {
|
|
42
66
|
background-color: #f59e0b;
|
|
43
|
-
color:
|
|
44
|
-
border-left: 4px solid #
|
|
67
|
+
color: #451a03;
|
|
68
|
+
border-left: 4px solid #b45309;
|
|
45
69
|
}
|
|
46
70
|
|
|
47
71
|
.flash-error {
|
|
48
|
-
background-color: #
|
|
72
|
+
background-color: #b91c1c;
|
|
49
73
|
color: white;
|
|
50
|
-
border-left: 4px solid #
|
|
74
|
+
border-left: 4px solid #7f1d1d;
|
|
51
75
|
}
|
|
52
76
|
|
|
53
77
|
.flash-info {
|
|
@@ -152,6 +176,9 @@
|
|
|
152
176
|
right: 10px;
|
|
153
177
|
left: 10px;
|
|
154
178
|
max-width: none;
|
|
179
|
+
/* Not 100%: with both left and right set, a width overrides right, and the message ran 10px
|
|
180
|
+
off the screen. */
|
|
181
|
+
width: auto;
|
|
155
182
|
}
|
|
156
183
|
|
|
157
184
|
.onboarding-flash {
|
|
@@ -730,8 +730,18 @@ module RailsOnboarding
|
|
|
730
730
|
{ onboarding_replay_started_at: nil, onboarding_replay_steps: [] }
|
|
731
731
|
end
|
|
732
732
|
|
|
733
|
+
# column_names queries the database like the rest, so it takes the same
|
|
734
|
+
# guard -- but purely for symmetry: this one cannot actually be reached
|
|
735
|
+
# with the table missing. It is an instance method, and ActiveRecord cannot
|
|
736
|
+
# instantiate a model whose table is absent (`new` raises while building
|
|
737
|
+
# attribute types), so the guard can never fire. Kept so every column query
|
|
738
|
+
# in this file reads the same way, and it costs nothing: table_exists?
|
|
739
|
+
# reads the schema cache.
|
|
733
740
|
def onboarding_column?(name)
|
|
734
|
-
self.class.respond_to?(:column_names)
|
|
741
|
+
return false unless self.class.respond_to?(:column_names)
|
|
742
|
+
return false unless RailsOnboarding::SchemaGuard.columns_queryable?(self.class)
|
|
743
|
+
|
|
744
|
+
self.class.column_names.include?(name)
|
|
735
745
|
end
|
|
736
746
|
|
|
737
747
|
def persist_and_track!(attributes = nil)
|
|
@@ -51,6 +51,11 @@
|
|
|
51
51
|
</head>
|
|
52
52
|
<body>
|
|
53
53
|
|
|
54
|
+
<%# Without this, a message on the way to onboarding was lost: a host's redirect_to with an alert,
|
|
55
|
+
the engine's own redirect_to onboarding_path, alert:, and the Turbo Stream errors, which replace
|
|
56
|
+
#flash-messages and found nothing to replace. Fixed-position, so it sits over the page. %>
|
|
57
|
+
<%= render "rails_onboarding/shared/flash" %>
|
|
58
|
+
|
|
54
59
|
<%# .onboarding-container/.onboarding-content provide the page-level
|
|
55
60
|
min-height/centering/responsive padding that the stylesheets (see
|
|
56
61
|
application.css and mobile.css) already define for every onboarding
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<span class="flash-icon">✓</span>
|
|
5
|
-
<span class="flash-message"><%= notice %></span>
|
|
6
|
-
<button class="flash-close" onclick="this.parentElement.remove()" aria-label="Dismiss">×</button>
|
|
7
|
-
</div>
|
|
8
|
-
<% end %>
|
|
1
|
+
<%# The flash, on every page of the engine layout, and the target the onboarding controller's
|
|
2
|
+
Turbo Stream errors replace (#flash-messages). Each message comes from a local when one is
|
|
3
|
+
given - those streams pass the message they want shown - and from the flash otherwise.
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
Each message is an open <dialog> closed by a form with method="dialog", which the browser
|
|
6
|
+
handles itself: no JavaScript, so nothing for a strict Content Security Policy to refuse. The
|
|
7
|
+
close buttons were onclick= attributes, which such a policy blocks without a word. Turbo
|
|
8
|
+
leaves method="dialog" forms alone. %>
|
|
9
|
+
<% messages = {
|
|
10
|
+
notice: local_assigns.fetch(:notice) { flash[:notice] },
|
|
11
|
+
alert: local_assigns.fetch(:alert) { flash[:alert] },
|
|
12
|
+
error: local_assigns.fetch(:error) { flash[:error] }
|
|
13
|
+
} %>
|
|
14
|
+
<% icons = { notice: "✓", alert: "⚠", error: "✕" } %>
|
|
15
|
+
<div id="flash-messages" class="flash-container">
|
|
16
|
+
<% messages.each do |type, message| %>
|
|
17
|
+
<% next if message.blank? %>
|
|
18
|
+
<dialog open class="onboarding-flash flash-<%= type %>">
|
|
19
|
+
<span class="flash-icon" aria-hidden="true"><%= icons[type] %></span>
|
|
20
|
+
<span class="flash-message" role="alert"><%= message %></span>
|
|
21
|
+
<form method="dialog">
|
|
22
|
+
<button class="flash-close" aria-label="Dismiss">×</button>
|
|
23
|
+
</form>
|
|
24
|
+
</dialog>
|
|
24
25
|
<% end %>
|
|
25
26
|
</div>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_onboarding
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Lewis
|
|
@@ -283,7 +283,7 @@ licenses:
|
|
|
283
283
|
metadata:
|
|
284
284
|
allowed_push_host: https://rubygems.org
|
|
285
285
|
homepage_uri: https://github.com/bunnahabhain/rails_onboarding
|
|
286
|
-
source_code_uri: https://github.com/bunnahabhain/rails_onboarding/tree/v0.8.
|
|
286
|
+
source_code_uri: https://github.com/bunnahabhain/rails_onboarding/tree/v0.8.15
|
|
287
287
|
changelog_uri: https://github.com/bunnahabhain/rails_onboarding/blob/master/docs/CHANGELOG.md
|
|
288
288
|
rdoc_options: []
|
|
289
289
|
require_paths:
|
|
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
299
299
|
- !ruby/object:Gem::Version
|
|
300
300
|
version: '0'
|
|
301
301
|
requirements: []
|
|
302
|
-
rubygems_version: 4.0.
|
|
302
|
+
rubygems_version: 4.0.22
|
|
303
303
|
specification_version: 4
|
|
304
304
|
summary: Flexible onboarding engine for Rails applications
|
|
305
305
|
test_files: []
|