abraham 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/app/assets/javascripts/abraham/index.js +2 -2
- data/app/helpers/abraham_helper.rb +12 -5
- data/app/helpers/flipper_helper.rb +26 -0
- data/lib/abraham/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3928683d3a3d69dc8a8d252bf34a4093527d958f66e992120895d9287f329aa2
|
4
|
+
data.tar.gz: ec22961e9019b4329fce70ae9db31b43cc5ae284c6255d3db3beacecba74fa6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b9236210c526f1ae9874b13892bf68da1099058c503a065af63b65f2ac61b1af03b69c391725ef227dc3c105c434d68d430e8e9c4e9ffd19654c2e774a786e9
|
7
|
+
data.tar.gz: 12a8fd782dd8d2b0c8414fd7fbff006106ceb48b44e8450458c2a808ccf4f5987b498fdc8420e4ca699e9cf6c0d1dc4e3ea90451866bd342e0099c972c74b62d
|
data/README.md
CHANGED
@@ -207,6 +207,29 @@ my_tour:
|
|
207
207
|
* `action` is one of the Shepherd tour method names, i.e. `cancel`, `next`, or `complete`
|
208
208
|
* `classes` are the CSS class names you want applied to the button
|
209
209
|
|
210
|
+
### Flipper integration
|
211
|
+
|
212
|
+
If you have [Flipper](https://github.com/jnunemaker/flipper) installed as a dependency in your project you will be able to enable or disable tours based on a flipper using the `flipper_key` option. This will automatically enable a tour when this flipper is active and disable it when it's inactive.
|
213
|
+
|
214
|
+
```yml
|
215
|
+
walkthrough:
|
216
|
+
flipper_key: "name_of_flipper"
|
217
|
+
steps:
|
218
|
+
1:
|
219
|
+
text: "This walkthrough will show you how to..."
|
220
|
+
```
|
221
|
+
|
222
|
+
If you would like to disable a tour when a flipper is active you may couple the `flipper_key` option with the `flipper_activation` option. `flipper_activation` supports "enabled" or "disabled" as options. If you enter something other than "enabled" or "disabled" it will use the default, which is "enabled".
|
223
|
+
|
224
|
+
```yml
|
225
|
+
walkthrough:
|
226
|
+
flipper_key: "name_of_flipper"
|
227
|
+
flipper_activation: "disabled"
|
228
|
+
steps:
|
229
|
+
1:
|
230
|
+
text: "This walkthrough will show you how to..."
|
231
|
+
```
|
232
|
+
|
210
233
|
### Testing your tours
|
211
234
|
|
212
235
|
Abraham loads tour definitions once when you start your server. Restart your server to see tour changes.
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module AbrahamHelper
|
4
|
+
include FlipperHelper
|
5
|
+
|
4
6
|
def abraham_tour
|
5
7
|
# Do we have tours for this controller/action in the user's locale?
|
6
8
|
tours = Rails.configuration.abraham.tours["#{controller_path}.#{action_name}.#{I18n.locale}"]
|
@@ -21,11 +23,16 @@ module AbrahamHelper
|
|
21
23
|
tour_html = ''
|
22
24
|
|
23
25
|
tour_keys.each do |key|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
flipper_key = tours[key]["flipper_key"]
|
27
|
+
flipper_activation = tours[key]["flipper_activation"]
|
28
|
+
|
29
|
+
if should_add_tour(flipper_key, flipper_activation)
|
30
|
+
tour_html += render(partial: "application/abraham",
|
31
|
+
locals: { tour_name: key,
|
32
|
+
tour_completed: tour_keys_completed.include?(key),
|
33
|
+
trigger: tours[key]["trigger"],
|
34
|
+
steps: tours[key]["steps"] })
|
35
|
+
end
|
29
36
|
end
|
30
37
|
|
31
38
|
tour_html.html_safe
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FlipperHelper
|
4
|
+
def should_add_tour(flipper_key, flipper_activation)
|
5
|
+
return true if !flipper_defined?
|
6
|
+
|
7
|
+
case process_activation_option(flipper_activation)
|
8
|
+
when "enabled"
|
9
|
+
return (flipper_key && Flipper.enabled?(flipper_key.to_sym)) || flipper_key.nil?
|
10
|
+
when "disabled"
|
11
|
+
return (flipper_key && !Flipper.enabled?(flipper_key.to_sym)) || flipper_key.nil?
|
12
|
+
else
|
13
|
+
return false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def flipper_defined?
|
19
|
+
Object.const_defined?("Flipper")
|
20
|
+
end
|
21
|
+
|
22
|
+
def process_activation_option(flipper_activation)
|
23
|
+
return "disabled" if flipper_activation == "disabled"
|
24
|
+
"enabled"
|
25
|
+
end
|
26
|
+
end
|
data/lib/abraham/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abraham
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Abbett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sassc-rails
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- app/assets/stylesheets/abraham/theme-default.scss
|
97
97
|
- app/controllers/abraham_histories_controller.rb
|
98
98
|
- app/helpers/abraham_helper.rb
|
99
|
+
- app/helpers/flipper_helper.rb
|
99
100
|
- app/models/abraham_history.rb
|
100
101
|
- app/models/application_record.rb
|
101
102
|
- app/views/application/_abraham.html.erb
|
@@ -130,7 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
131
|
- !ruby/object:Gem::Version
|
131
132
|
version: '0'
|
132
133
|
requirements: []
|
133
|
-
|
134
|
+
rubyforge_project:
|
135
|
+
rubygems_version: 2.7.6
|
134
136
|
signing_key:
|
135
137
|
specification_version: 4
|
136
138
|
summary: Trackable application tours for Rails with i18n support, based on Shepherd.js.
|