abraham 2.1.2 → 2.5.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 +121 -14
- data/Rakefile +1 -1
- data/app/assets/javascripts/abraham/index.js +24 -4
- data/app/controllers/abraham_histories_controller.rb +0 -1
- data/app/helpers/abraham_helper.rb +19 -12
- data/app/views/application/_abraham.html.erb +46 -35
- data/lib/abraham/version.rb +1 -1
- data/lib/generators/abraham/install_generator.rb +6 -0
- data/lib/generators/abraham/templates/initializer.rb +11 -11
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 025f51bb1380ebbd7c172d43d66b79ca4b68fdb4eb4af6940364fff44b282176
|
4
|
+
data.tar.gz: a791c10896b5f002e1aa5daa8edccd2ec810a4479aeccac4a5d8b28a52795c5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e6f5e3fae2acca16748c5ace7c7fde3436e3aab72604c3e35030d5488ec389fd4903ff53a63dbdc4fe473a554853860a6d6f05e8a126bd49d7ae15f71c573b4
|
7
|
+
data.tar.gz: 816fb772c290eb0504885b2e93f21d952e7322bf87c05ca3332d57c6ff81fb1e5062a93824d5d087b142c05e4efab6af2f01fdbbc12623b9b3740acb82cc4a7d
|
data/README.md
CHANGED
@@ -6,16 +6,19 @@ _Guide your users in the one true path._
|
|
6
6
|
|
7
7
|

|
8
8
|
|
9
|
-
Abraham
|
9
|
+
Abraham makes it easy to show guided tours to users of your Rails application. When Abraham shows a tour, it keeps track of whether the user has completed it (so it doesn't get shown again) or dismissed it for later (so it reappears in a future user session).
|
10
10
|
|
11
11
|
* Define tour content with simple YAML files, in any/many languages.
|
12
12
|
* Organize tours by controller and action.
|
13
|
-
*
|
14
|
-
*
|
13
|
+
* Trigger tours automatically on page load or manually via JavaScript method.
|
14
|
+
* Built with the [Shepherd JS](https://shepherdjs.dev/) library. Plays nicely with Turbolinks.
|
15
|
+
* Ships with two basic CSS themes (default & dark) — or write your own
|
15
16
|
|
16
17
|
## Requirements
|
17
18
|
|
18
|
-
Abraham needs to know the current user to track tour views, e.g. `current_user` from Devise.
|
19
|
+
* Abraham needs to know the current user to track tour views, e.g. `current_user` from Devise.
|
20
|
+
* If you are using a different method to identify who is currently logged in, you can, for example, add an alias to make it work. Assuming you have a method `current_foo` to identify your currenly logged-in user, you can add `alias_method 'current_user', 'current_foo'` in the place you define `current_foo`.
|
21
|
+
* Abraham is tested on Rails 5.2, 6.0, and 6.1
|
19
22
|
|
20
23
|
## Installation
|
21
24
|
|
@@ -37,7 +40,7 @@ $ rails db:migrate
|
|
37
40
|
Install the JavaScript dependencies:
|
38
41
|
|
39
42
|
```
|
40
|
-
$ yarn add
|
43
|
+
$ yarn add js-cookie@^2.2.0 shepherd.js@^6.0.0-beta
|
41
44
|
```
|
42
45
|
|
43
46
|
Require `abraham` in `app/assets/javascripts/application.js`
|
@@ -76,12 +79,15 @@ Tell Abraham where to insert its generated JavaScript in `app/views/layouts/appl
|
|
76
79
|
|
77
80
|
## Defining your tours
|
78
81
|
|
79
|
-
Define your tours in the `config/tours` directory. Its directory structure
|
82
|
+
Define your tours in the `config/tours` directory corresponding to the views defined in your application. Its directory structure mirrors your application's controllers, and the tour files mirror your actions/views. (As of version 2.4.0, Abraham respects controllers organized into modules.)
|
80
83
|
|
81
84
|
```
|
82
85
|
config/
|
83
86
|
└── tours/
|
84
|
-
|
87
|
+
├── admin/
|
88
|
+
│ └── articles/
|
89
|
+
│ └── edit.en.yml
|
90
|
+
├── blog/
|
85
91
|
│ ├── show.en.yml
|
86
92
|
│ └── show.es.yml
|
87
93
|
└── articles/
|
@@ -91,11 +97,15 @@ config/
|
|
91
97
|
└── show.es.yml
|
92
98
|
```
|
93
99
|
|
94
|
-
|
100
|
+
For example, per above, when a Spanish-speaking user visits `/articles/`, they'll see the tours defined by `config/tours/articles/index.es.yml`.
|
101
|
+
|
102
|
+
(Note: You must specify a locale in the filename, even if you're only supporting one language.)
|
95
103
|
|
96
104
|
### Tour content
|
97
105
|
|
98
|
-
|
106
|
+
Within a tour file, each tour is composed of a series of **steps**. A step may have a `title` and must have `text`. You may attach a step to a particular element on the page, and place the callout in a particular position.
|
107
|
+
|
108
|
+
In this example, we define a tour called "intro" with 3 steps:
|
99
109
|
|
100
110
|
```yaml
|
101
111
|
intro:
|
@@ -122,11 +132,81 @@ Abraham takes care of which buttons should appear with each step:
|
|
122
132
|
* "Exit" and "Next" buttons on intermediate steps
|
123
133
|
* "Done" button on the last step
|
124
134
|
|
135
|
+
See below for how to define custom buttons.
|
136
|
+
|
137
|
+
When you specify an `attachTo` element, use the `placement` option to choose where the callout should appear relative to that element:
|
138
|
+
|
139
|
+
* `bottom` / `bottom center`
|
140
|
+
* `bottom left`
|
141
|
+
* `bottom right`
|
142
|
+
* `center` / `middle` / `middle center`
|
143
|
+
* `left` / `middle left`
|
144
|
+
* `right` / `middle right`
|
145
|
+
* `top` / `top center`
|
146
|
+
* `top left`
|
147
|
+
* `top right`
|
148
|
+
|
125
149
|
Abraham tries to be helpful when your tour steps attach to page elements that are missing:
|
126
150
|
|
127
151
|
* If your first step is attached to a particular element, and that element is not present on the page, the tour won't start. ([#28](https://github.com/actmd/abraham/issues/28))
|
128
152
|
* If your tour has an intermediate step attached to a missing element, Abraham will skip that step and automatically show the next. ([#6](https://github.com/actmd/abraham/issues/6))
|
129
153
|
|
154
|
+
### Automatic vs. manual tours
|
155
|
+
|
156
|
+
By default, Abraham will automatically start a tour that the current user hasn't seen yet.
|
157
|
+
You can instead define a tour to be triggered manually using the `trigger` option:
|
158
|
+
|
159
|
+
```yml
|
160
|
+
walkthrough:
|
161
|
+
trigger: "manual"
|
162
|
+
steps:
|
163
|
+
1:
|
164
|
+
text: "This walkthrough will show you how to..."
|
165
|
+
```
|
166
|
+
|
167
|
+
This tour will not start automatically; instead, use the `Abraham.startTour` method with the tour name:
|
168
|
+
|
169
|
+
```
|
170
|
+
<button id="startTour">Start tour</button>
|
171
|
+
|
172
|
+
<script>
|
173
|
+
document.querySelector("#startTour").addEventListener("click", function() {
|
174
|
+
Abraham.startTour("walkthrough"));
|
175
|
+
});
|
176
|
+
</script>
|
177
|
+
```
|
178
|
+
|
179
|
+
...or if you happen to use jQuery:
|
180
|
+
|
181
|
+
```
|
182
|
+
<script>
|
183
|
+
$("#startTour").on("click", function() { Abraham.startTour('walkthrough'); })
|
184
|
+
</script>
|
185
|
+
```
|
186
|
+
|
187
|
+
### Custom buttons
|
188
|
+
|
189
|
+
You can define custom buttons in a step like so:
|
190
|
+
|
191
|
+
```
|
192
|
+
my_tour:
|
193
|
+
steps:
|
194
|
+
1:
|
195
|
+
text: "Welcome to my custom button tour"
|
196
|
+
buttons:
|
197
|
+
1:
|
198
|
+
text: 'Show this to me later'
|
199
|
+
action: 'cancel'
|
200
|
+
classes: 'custom-button shepherd-button-secondary'
|
201
|
+
2:
|
202
|
+
text: 'Finish now'
|
203
|
+
action: 'complete'
|
204
|
+
classes: 'custom-button'
|
205
|
+
```
|
206
|
+
|
207
|
+
* `action` is one of the Shepherd tour method names, i.e. `cancel`, `next`, or `complete`
|
208
|
+
* `classes` are the CSS class names you want applied to the button
|
209
|
+
|
130
210
|
### Testing your tours
|
131
211
|
|
132
212
|
Abraham loads tour definitions once when you start your server. Restart your server to see tour changes.
|
@@ -141,11 +221,22 @@ end
|
|
141
221
|
|
142
222
|
## Full example
|
143
223
|
|
144
|
-
We provide a [small example app](https://github.com/actmd/abraham-example) that implements
|
224
|
+
We provide a [small example app](https://github.com/actmd/abraham-example) that implements Abraham, so you can see it in action.
|
145
225
|
|
146
|
-
## Upgrading
|
226
|
+
## Upgrading
|
147
227
|
|
148
|
-
|
228
|
+
### From version 2.3.0 or earlier
|
229
|
+
|
230
|
+
Abraham 2.4.0 introduced an updated initializer that supports controllers organized into modules.
|
231
|
+
Rerun the generator with these options to replace the old initializer:
|
232
|
+
|
233
|
+
```
|
234
|
+
$ rails generate abraham:install --skip-migration --skip-config
|
235
|
+
```
|
236
|
+
|
237
|
+
### From version 1
|
238
|
+
|
239
|
+
Abraham v1 was built using Shepherd 1.8, v2 now uses Shepherd 6 – quite a jump, yes.
|
149
240
|
|
150
241
|
If you were using Abraham v1, you'll want to take the following steps to upgrade:
|
151
242
|
|
@@ -161,10 +252,26 @@ If you have any trouble at all, please [submit an issue](https://github.com/actm
|
|
161
252
|
|
162
253
|
Contributions are welcome!
|
163
254
|
|
164
|
-
Create a feature branch (using git-flow) and submit as a pull request.
|
255
|
+
Create a feature branch (using git-flow) and submit as a pull request (with a base branch of `develop`).
|
165
256
|
|
166
257
|
Everyone interacting in Abraham's codebase, issue tracker, etc. is expected to follow the [Contributor Covenent Code of Conduct](https://www.contributor-covenant.org/version/1/4/code-of-conduct).
|
167
258
|
|
259
|
+
### Getting started with the source code
|
260
|
+
|
261
|
+
Abraham uses `rvm` with a gemset to ensure the appropriate version of Ruby and its dependencies. Make sure that's installed before you get started.
|
262
|
+
|
263
|
+
```
|
264
|
+
~ git clone git@github.com:actmd/abraham.git
|
265
|
+
Cloning into 'abraham'...
|
266
|
+
~ cd abraham
|
267
|
+
ruby-2.5.3 - #gemset created /Users/jon/.rvm/gems/ruby-2.5.3@abraham
|
268
|
+
ruby-2.5.3 - #generating abraham wrappers - please wait
|
269
|
+
~ bundle install
|
270
|
+
Bundle complete! 13 Gemfile dependencies, 73 gems now installed.
|
271
|
+
Use `bundle info [gemname]` to see where a bundled gem is installed.
|
272
|
+
~ yarn install
|
273
|
+
```
|
274
|
+
|
168
275
|
### Testing
|
169
276
|
|
170
277
|
#### Testing locally
|
@@ -183,7 +290,7 @@ gem 'abraham', path: '~/Workspace/abraham'
|
|
183
290
|
|
184
291
|
#### Automated testing
|
185
292
|
|
186
|
-
We use
|
293
|
+
We use GitHub Actions to automatically test this engine with Rails 5.2, 6.0, and 6.1.
|
187
294
|
|
188
295
|
### Releasing
|
189
296
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,28 @@
|
|
1
|
-
//= require jquery
|
2
1
|
//= require js-cookie/src/js.cookie
|
3
2
|
//= require shepherd.js/dist/js/shepherd
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
var Abraham = new Object();
|
5
|
+
|
6
|
+
Abraham.tours = {};
|
7
|
+
Abraham.incompleteTours = [];
|
8
|
+
Abraham.startTour = function(tourName) {
|
9
|
+
if (!Shepherd.activeTour) {
|
10
|
+
Abraham.tours[tourName].start();
|
11
|
+
}
|
12
|
+
};
|
13
|
+
Abraham.startNextIncompleteTour = function() {
|
14
|
+
if (Abraham.incompleteTours.length) {
|
15
|
+
Abraham.tours[Abraham.incompleteTours[0]].checkAndStart();
|
16
|
+
}
|
17
|
+
};
|
18
|
+
|
19
|
+
document.addEventListener("DOMContentLoaded", Abraham.startNextIncompleteTour);
|
20
|
+
document.addEventListener("turbolinks:load", Abraham.startNextIncompleteTour);
|
21
|
+
|
22
|
+
document.addEventListener('turbolinks:before-cache', function() {
|
23
|
+
// Remove visible product tours
|
24
|
+
document.querySelectorAll(".shepherd-element").forEach(function(el) { el.remove() });
|
25
|
+
// Clear Abraham data
|
26
|
+
Abraham.tours = {};
|
27
|
+
Abraham.incompleteTours = [];
|
8
28
|
});
|
@@ -15,7 +15,6 @@ class AbrahamHistoriesController < ApplicationController
|
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
-
# Never trust parameters from the scary internet, only allow the white list through.
|
19
18
|
def abraham_history_params
|
20
19
|
params.require(:abraham_history).permit(:controller_name, :action_name, :tour_name)
|
21
20
|
end
|
@@ -3,29 +3,37 @@
|
|
3
3
|
module AbrahamHelper
|
4
4
|
def abraham_tour
|
5
5
|
# Do we have tours for this controller/action in the user's locale?
|
6
|
-
tours = Rails.configuration.abraham.tours["#{
|
7
|
-
|
8
|
-
tours ||= Rails.configuration.abraham.tours["#{
|
6
|
+
tours = Rails.configuration.abraham.tours["#{controller_path}.#{action_name}.#{I18n.locale}"]
|
7
|
+
# Otherwise, default to the default locale
|
8
|
+
tours ||= Rails.configuration.abraham.tours["#{controller_path}.#{action_name}.#{I18n.default_locale}"]
|
9
9
|
|
10
10
|
if tours
|
11
|
+
# Have any automatic tours been completed already?
|
11
12
|
completed = AbrahamHistory.where(
|
12
13
|
creator_id: current_user.id,
|
13
|
-
controller_name:
|
14
|
+
controller_name: controller_path,
|
14
15
|
action_name: action_name
|
15
16
|
)
|
16
|
-
remaining = tours.keys - completed.map(&:tour_name)
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
tour_keys_completed = completed.map(&:tour_name)
|
19
|
+
tour_keys = tours.keys
|
20
|
+
|
21
|
+
tour_html = ''
|
22
|
+
|
23
|
+
tour_keys.each do |key|
|
24
|
+
tour_html += render(partial: "application/abraham",
|
25
|
+
locals: { tour_name: key,
|
26
|
+
tour_completed: tour_keys_completed.include?(key),
|
27
|
+
trigger: tours[key]["trigger"],
|
28
|
+
steps: tours[key]["steps"] })
|
23
29
|
end
|
30
|
+
|
31
|
+
tour_html.html_safe
|
24
32
|
end
|
25
33
|
end
|
26
34
|
|
27
35
|
def abraham_cookie_prefix
|
28
|
-
"abraham-#{fetch_application_name.to_s.underscore}-#{current_user.id}-#{
|
36
|
+
"abraham-#{fetch_application_name.to_s.underscore}-#{current_user.id}-#{controller_path}-#{action_name}"
|
29
37
|
end
|
30
38
|
|
31
39
|
def fetch_application_name
|
@@ -36,7 +44,6 @@ module AbrahamHelper
|
|
36
44
|
end
|
37
45
|
end
|
38
46
|
|
39
|
-
|
40
47
|
def abraham_domain
|
41
48
|
request.host
|
42
49
|
end
|
@@ -1,70 +1,81 @@
|
|
1
1
|
<script>
|
2
|
-
|
2
|
+
Abraham.tours["<%= tour_name %>"] = new Shepherd.Tour(<%= Rails.configuration.abraham.tour_options.html_safe unless Rails.configuration.abraham.tour_options.nil? %>);
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
data: JSON.stringify({
|
4
|
+
<% if trigger != 'manual' %>
|
5
|
+
Abraham.tours["<%= tour_name %>"].on("complete", function() {
|
6
|
+
// Make AJAX call to save history of tour completion
|
7
|
+
return fetch("/abraham_histories/", {
|
8
|
+
method: "POST",
|
9
|
+
headers: { 'Content-Type': 'application/json' },
|
10
|
+
body: JSON.stringify({
|
12
11
|
authenticity_token: '<%= form_authenticity_token %>',
|
13
|
-
controller_name: '<%=
|
12
|
+
controller_name: '<%= controller_path %>',
|
14
13
|
action_name: '<%= action_name %>',
|
15
14
|
tour_name: '<%= tour_name %>'
|
16
15
|
})
|
17
16
|
});
|
18
17
|
});
|
19
18
|
|
20
|
-
|
19
|
+
Abraham.tours["<%= tour_name %>"].on("cancel", function() {
|
21
20
|
Cookies.set('<%= abraham_cookie_prefix %>-<%= tour_name %>', 'later', { domain: '<%= abraham_domain %>' });
|
22
21
|
});
|
22
|
+
<% end %>
|
23
23
|
|
24
24
|
<% steps.each_with_index do |(key, step), index| %>
|
25
|
-
|
25
|
+
Abraham.tours["<%= tour_name %>"].addStep({
|
26
26
|
id: 'step-<%= key %>',
|
27
27
|
<% if step.key?('title') %>
|
28
28
|
title: "<%= step['title'] %>",
|
29
29
|
<% end %>
|
30
30
|
text: "<%= step['text'] %>",
|
31
31
|
<% if step.key?('attachTo') %>
|
32
|
-
attachTo: { element: "<%= step['attachTo']['element'] %>", on: "<%= step['attachTo']['placement'] %>" },
|
32
|
+
attachTo: { element: "<%= escape_javascript(step['attachTo']['element'].html_safe) %>", on: "<%= step['attachTo']['placement'] %>" },
|
33
33
|
showOn: function() {
|
34
34
|
// Only display this step if its selector is present
|
35
|
-
return document.querySelector("<%= step['attachTo']['element'] %>") ? true : false
|
35
|
+
return document.querySelector("<%= escape_javascript(step['attachTo']['element'].html_safe) %>") ? true : false
|
36
36
|
},
|
37
37
|
<% end %>
|
38
38
|
buttons: [
|
39
|
-
<% if
|
40
|
-
|
41
|
-
|
39
|
+
<% if step.key?('buttons') %>
|
40
|
+
<% step['buttons'].each do |button| %>
|
41
|
+
{ text: '<%= button[1]['text'] %>', action: Abraham.tours["<%= tour_name %>"].<%= button[1]['action'] %>, classes: '<%= button[1]['classes'] %>' },
|
42
|
+
<% end %>
|
42
43
|
<% else %>
|
43
|
-
|
44
|
-
|
44
|
+
<% if index == steps.size - 1 %>
|
45
|
+
{ text: '<%= t('abraham.done') %>', action: Abraham.tours["<%= tour_name %>"].complete }
|
46
|
+
<% else %>
|
47
|
+
<% if index == 0 %>
|
48
|
+
{ text: '<%= t('abraham.later') %>', action: Abraham.tours["<%= tour_name %>"].cancel, classes: 'shepherd-button-secondary' },
|
49
|
+
{ text: '<%= t('abraham.continue') %>', action: Abraham.tours["<%= tour_name %>"].next }
|
45
50
|
<% else %>
|
46
|
-
|
47
|
-
|
51
|
+
{ text: '<%= t('abraham.exit') %>', action: Abraham.tours["<%= tour_name %>"].cancel, classes: 'shepherd-button-secondary' },
|
52
|
+
{ text: '<%= t('abraham.next') %>', action: Abraham.tours["<%= tour_name %>"].next }
|
48
53
|
<% end %>
|
54
|
+
<% end %>
|
49
55
|
<% end %>
|
50
56
|
]
|
51
57
|
});
|
52
58
|
<% end %>
|
53
59
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
<% if trigger != "manual" %>
|
61
|
+
Abraham.tours["<%= tour_name %>"].checkAndStart = function (start) {
|
62
|
+
return function () {
|
63
|
+
// Don't start the tour if the user dismissed it once this session
|
64
|
+
var tourMayStart = !Cookies.get('<%= abraham_cookie_prefix %>-<%= tour_name %>', {domain: '<%= abraham_domain %>'});
|
65
|
+
<% if steps.first[1]['attachTo'] %>
|
66
|
+
// Don't start the tour if the first step's element is missing
|
67
|
+
tourMayStart = tourMayStart && document.querySelector("<%= steps.first[1]['attachTo']['element'] %>");
|
68
|
+
<% end %>
|
69
|
+
|
70
|
+
if (tourMayStart) {
|
71
|
+
start();
|
72
|
+
}
|
65
73
|
}
|
66
|
-
}
|
67
|
-
|
74
|
+
}(Abraham.tours["<%= tour_name %>"].start)
|
75
|
+
|
76
|
+
<% if !tour_completed %>
|
77
|
+
Abraham.incompleteTours.push("<%= tour_name %>");
|
78
|
+
<% end %>
|
79
|
+
<% end %>
|
68
80
|
|
69
|
-
tour.start()
|
70
81
|
</script>
|
data/lib/abraham/version.rb
CHANGED
@@ -10,6 +10,7 @@ module Abraham
|
|
10
10
|
|
11
11
|
class_option :'skip-migration', type: :boolean, desc: "Don't generate a migration for the histories table"
|
12
12
|
class_option :'skip-initializer', type: :boolean, desc: "Don't generate an initializer"
|
13
|
+
class_option :'skip-config', type: :boolean, desc: "Don't generate a config file"
|
13
14
|
|
14
15
|
source_root File.expand_path(File.join(File.dirname(__FILE__), "templates"))
|
15
16
|
|
@@ -24,6 +25,11 @@ module Abraham
|
|
24
25
|
return if options["skip-initializer"]
|
25
26
|
|
26
27
|
copy_file "initializer.rb", "config/initializers/abraham.rb"
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_config
|
31
|
+
return if options["skip-config"]
|
32
|
+
|
27
33
|
copy_file "abraham.yml", "config/abraham.yml"
|
28
34
|
end
|
29
35
|
end
|
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
Rails.application.configure do
|
4
4
|
tours = {}
|
5
|
+
tours_root = Pathname.new(Rails.root.join("config/tours"))
|
5
6
|
|
6
|
-
if Rails.root.join(
|
7
|
-
Dir
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
7
|
+
if Rails.root.join("config/tours").exist?
|
8
|
+
Dir.glob(Rails.root.join("config/tours/**/*.yml")).each do |yml|
|
9
|
+
relative_filename = Pathname.new(yml).relative_path_from(tours_root)
|
10
|
+
# `controller_path` is either "controller_name" or "module_name/controller_name"
|
11
|
+
controller_path, filename = relative_filename.split
|
12
|
+
file_parts = filename.to_s.split(".")
|
13
|
+
action = file_parts[0]
|
14
|
+
locale = file_parts[1]
|
15
|
+
t = YAML.load_file(yml)
|
16
|
+
tours["#{controller_path}.#{action}.#{locale}"] = t
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
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.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Abbett
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sassc-rails
|
@@ -115,7 +115,7 @@ homepage: https://github.com/actmd/abraham
|
|
115
115
|
licenses:
|
116
116
|
- MIT
|
117
117
|
metadata: {}
|
118
|
-
post_install_message:
|
118
|
+
post_install_message:
|
119
119
|
rdoc_options: []
|
120
120
|
require_paths:
|
121
121
|
- lib
|
@@ -130,9 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
|
-
|
134
|
-
|
135
|
-
signing_key:
|
133
|
+
rubygems_version: 3.0.8
|
134
|
+
signing_key:
|
136
135
|
specification_version: 4
|
137
136
|
summary: Trackable application tours for Rails with i18n support, based on Shepherd.js.
|
138
137
|
test_files: []
|