rails_onboarding 0.8.4 → 0.8.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 007cab6c758c3d50c9c2b9dca6c8f798956b6c09d61a0078de8c347f2b857395
4
- data.tar.gz: d431ee736da8d5de6af011483929f64cefd5da668844d88934ad48d30e3af5a1
3
+ metadata.gz: 1eb640c48091d5cc3028c5563bbdd22d3b5a2b2a32e3ce6079f20afb99b14cec
4
+ data.tar.gz: b85af1963ce35f84da739613dc6168179ea0e548bc90d11a91e7a01be2c5c484
5
5
  SHA512:
6
- metadata.gz: b6f99c18d8a9e4143aa445392866e46e88561ec28e51f8d29a72c37458eecfbab311bed79ed9c400104849ba2669acecc8307464a5bbb8edbe3001543df763ec
7
- data.tar.gz: c4db1b37aeec6472fb839ac1647f8d4ddc9fd1f643e4118e889e0a14db9a5ec1b9793bd3d3af0cfbb1f1550cced75c5439216f8a3c1b7f26402bf26d276a0dfb
6
+ metadata.gz: 1f76a6f1b8d8ec877f5efe98026c2f75039d6a6102bc3eda76cbdbabb36d9926b9b2fe3f88044e0a515fcb76053eb087d7929b7fa62799acdd5ab2abafacb476
7
+ data.tar.gz: b58edc5a568ad4691982422fe8a21c557d074fed14c91990fbda23ef2e8cdd9584eee8b54241ac5996f97578eeffdbdcd6250c5812d8880e2753ed644893fab8
@@ -203,6 +203,17 @@
203
203
  border-color: var(--onboarding-primary-fill-hover);
204
204
  }
205
205
 
206
+ /* Shown in place of a control on a step that is neither skippable nor yet
207
+ satisfied, so the banner's action area is never empty on one step and full on
208
+ the next. Sized and spaced like .onboarding-banner-skip so the three states
209
+ occupy the same visual slot. */
210
+ .onboarding-banner-hint {
211
+ color: var(--onboarding-text-muted);
212
+ padding: var(--onboarding-space-sm) var(--onboarding-space-sm);
213
+ font-size: var(--onboarding-text-sm);
214
+ white-space: nowrap;
215
+ }
216
+
206
217
  .onboarding-banner-skip {
207
218
  background: transparent;
208
219
  color: var(--onboarding-text-muted);
@@ -101,9 +101,18 @@ module RailsOnboarding
101
101
  # user.onboarding_progress #=> 75
102
102
  def onboarding_progress
103
103
  return 100 if onboarding_completed?
104
- return 0 unless onboarding_current_step
105
104
 
106
- current_index = RailsOnboarding.configuration.step_index(onboarding_current_step)
105
+ # onboarding_current_step is only written once a step is *completed*, so a
106
+ # member who has not finished one yet has nil here while
107
+ # #current_onboarding_step already reports the first step. Without the same
108
+ # fallback the two disagree: the progress markers show "1 of 5" and the bar
109
+ # reads 0%, then jumps to 40% at step two. Fall back the same way, so the
110
+ # first step measures as the first step.
111
+ step_name = onboarding_current_step ||
112
+ RailsOnboarding.configuration.steps.first&.dig(:name)
113
+ return 0 unless step_name
114
+
115
+ current_index = RailsOnboarding.configuration.step_index(step_name)
107
116
  return 0 if current_index.nil?
108
117
 
109
118
  total_steps = RailsOnboarding.configuration.total_steps
@@ -6,7 +6,7 @@
6
6
  viewport and zooms out to fit the physical screen - everything (text,
7
7
  buttons, spacing) looks shrunk even though the CSS itself is correct. %>
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <title><%= Rails.application.class.module_parent.name %> Onboarding</title>
9
+ <title><%= RailsOnboarding.configuration.app_name.presence || Rails.application.class.module_parent.name %> Onboarding</title>
10
10
  <%= csrf_meta_tags %>
11
11
  <%= csp_meta_tag %>
12
12
 
@@ -39,7 +39,8 @@
39
39
  anywhere else in the app - but on the step's own page, with the
40
40
  criteria not yet met, it redirects straight back here and the click
41
41
  does nothing visible. Offer it only when it leads somewhere. %>
42
- <% if !defined?(onboarding_continue_available?) || onboarding_continue_available? %>
42
+ <% continue_offered = !defined?(onboarding_continue_available?) || onboarding_continue_available? %>
43
+ <% if continue_offered %>
43
44
  <%= link_to "Continue setup →", onboarding_root,
44
45
  class: "onboarding-banner-continue" %>
45
46
  <% end %>
@@ -47,6 +48,14 @@
47
48
  <%= button_to "Skip this step", rails_onboarding.skip_onboarding_path,
48
49
  method: :post, class: "onboarding-banner-skip" %>
49
50
  <% end %>
51
+ <%# A step that is neither skippable nor yet satisfied offers neither
52
+ control, which leaves this area empty on one step and populated on the
53
+ next - the flow looks inconsistent step to step even though each state
54
+ is individually correct. Say what will move the member on instead, so
55
+ the banner always answers "how do I proceed?". %>
56
+ <% if !step[:skippable] && !continue_offered && step[:hint].present? %>
57
+ <span class="onboarding-banner-hint"><%= step[:hint] %></span>
58
+ <% end %>
50
59
  </div>
51
60
  </div>
52
61
  <% end %>
@@ -33,7 +33,8 @@ module RailsOnboarding
33
33
  include RateLimiting
34
34
  include Templates
35
35
 
36
- attr_accessor :user_class_name,
36
+ attr_accessor :app_name,
37
+ :user_class_name,
37
38
  :include_host_styles,
38
39
  :redirect_after_completion,
39
40
  :redirect_after_skip,
@@ -45,6 +46,11 @@ module RailsOnboarding
45
46
  :admin_user_search
46
47
 
47
48
  def initialize
49
+ # What to call the host product on onboarding pages. Defaults to the Rails
50
+ # application's module name, which is a code identifier and often not what
51
+ # the product is actually called - "Gift" for an app called Gift Posse.
52
+ # nil keeps the derived name.
53
+ @app_name = nil
48
54
  @user_class_name = "User"
49
55
  @include_host_styles = true # Default to including host app css
50
56
 
@@ -112,6 +112,7 @@ module RailsOnboarding
112
112
  { name: :title, type: String },
113
113
  { name: :icon, type: String },
114
114
  { name: :skippable, type: [ TrueClass, FalseClass ] },
115
+ { name: :hint, type: String },
115
116
  { name: :path, type: [ Symbol, String, Proc ] },
116
117
  { name: :complete_if, type: Proc }
117
118
  ]
@@ -1,3 +1,3 @@
1
1
  module RailsOnboarding
2
- VERSION = "0.8.4"
2
+ VERSION = "0.8.6"
3
3
  end
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
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Lewis
@@ -282,7 +282,7 @@ licenses:
282
282
  metadata:
283
283
  allowed_push_host: https://rubygems.org
284
284
  homepage_uri: https://github.com/bunnahabhain/rails_onboarding
285
- source_code_uri: https://github.com/bunnahabhain/rails_onboarding/tree/v0.8.4
285
+ source_code_uri: https://github.com/bunnahabhain/rails_onboarding/tree/v0.8.6
286
286
  changelog_uri: https://github.com/bunnahabhain/rails_onboarding/blob/master/docs/CHANGELOG.md
287
287
  rdoc_options: []
288
288
  require_paths: