abraham 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +9 -6
- data/Rakefile +17 -16
- data/app/assets/javascripts/abraham/index.js +2 -4
- data/app/controllers/abraham_histories_controller.rb +5 -4
- data/app/helpers/abraham_helper.rb +12 -6
- data/app/models/abraham_history.rb +1 -0
- data/app/models/application_record.rb +1 -0
- data/app/views/application/_abraham.html.erb +3 -2
- data/config/routes.rb +1 -0
- data/lib/abraham.rb +2 -1
- data/lib/abraham/engine.rb +2 -4
- data/lib/abraham/version.rb +2 -1
- data/lib/generators/abraham/install_generator.rb +12 -9
- data/lib/generators/abraham/templates/initializer.rb +1 -0
- data/lib/generators/abraham/templates/migration.rb +1 -0
- metadata +15 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ca52c3a0aa0f4083eef1a33a1099d4e38daeab9356d7a4b627431c4946fc3909
|
4
|
+
data.tar.gz: cf910c06b3e50bd1a99e33caac9521da5483f521cf31aa2521e499d3b9868e8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8982797ad163a2cd6e06d65ce1beacb97817ab2da56805bac8d39812f3c791777e0c079e8b61d3835e4f94dc13d88b23f1adc2b1ba8d9b972d574819c0f56d89
|
7
|
+
data.tar.gz: fa2b12411cde48ab87068e9cf5c038f9630777520bf23f9876a68a9c38ef55ed2c0136a845cb5f89a59cba68e489e102fbf85ad660ace22315b971da7b4f8c5d
|
data/README.md
CHANGED
@@ -16,22 +16,25 @@ Abraham needs to know the current user to track tour views, e.g. `current_user`
|
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
19
|
-
Add `abraham`
|
19
|
+
Add `abraham` to your Gemfile:
|
20
20
|
|
21
21
|
```
|
22
22
|
gem 'abraham'
|
23
23
|
|
24
|
-
source 'https://rails-assets.org' do
|
25
|
-
gem 'rails-assets-shepherd.js', '~> 1.8'
|
26
|
-
gem 'rails-assets-js-cookie', '~> 2.1'
|
27
|
-
end
|
28
24
|
```
|
29
25
|
|
30
|
-
|
26
|
+
Install the gem and run the installer:
|
31
27
|
|
32
28
|
```
|
33
29
|
$ bundle install
|
34
30
|
$ rails generate abraham:install
|
31
|
+
$ rails db:migrate
|
32
|
+
```
|
33
|
+
|
34
|
+
Install the JavaScript dependencies:
|
35
|
+
|
36
|
+
```
|
37
|
+
$ yarn add jquery js-cookie shepherd.js
|
35
38
|
```
|
36
39
|
|
37
40
|
Require `abraham` in `app/assets/javascripts/application.js`
|
data/Rakefile
CHANGED
@@ -1,33 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
begin
|
3
|
-
require
|
4
|
+
require "bundler/setup"
|
4
5
|
rescue LoadError
|
5
|
-
puts
|
6
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
6
7
|
end
|
7
8
|
|
8
|
-
require
|
9
|
+
require "rdoc/task"
|
9
10
|
|
10
11
|
RDoc::Task.new(:rdoc) do |rdoc|
|
11
|
-
rdoc.rdoc_dir =
|
12
|
-
rdoc.title =
|
13
|
-
rdoc.options <<
|
14
|
-
rdoc.rdoc_files.include(
|
15
|
-
rdoc.rdoc_files.include(
|
12
|
+
rdoc.rdoc_dir = "rdoc"
|
13
|
+
rdoc.title = "Abraham"
|
14
|
+
rdoc.options << "--line-numbers"
|
15
|
+
rdoc.rdoc_files.include("README.md")
|
16
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
16
17
|
end
|
17
18
|
|
18
|
-
APP_RAKEFILE = File.expand_path(
|
19
|
-
load
|
19
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
20
|
+
load "rails/tasks/engine.rake"
|
20
21
|
|
21
|
-
load
|
22
|
+
load "rails/tasks/statistics.rake"
|
22
23
|
|
23
|
-
require
|
24
|
+
require "bundler/gem_tasks"
|
24
25
|
|
25
|
-
require
|
26
|
+
require "rake/testtask"
|
26
27
|
|
27
28
|
Rake::TestTask.new(:test) do |t|
|
28
|
-
t.libs <<
|
29
|
-
t.libs <<
|
30
|
-
t.pattern =
|
29
|
+
t.libs << "lib"
|
30
|
+
t.libs << "test"
|
31
|
+
t.pattern = "test/**/*_test.rb"
|
31
32
|
t.verbose = false
|
32
33
|
end
|
33
34
|
|
@@ -1,8 +1,6 @@
|
|
1
1
|
//= require jquery
|
2
|
-
//= require
|
3
|
-
//= require js
|
4
|
-
//= require tether
|
5
|
-
//= require shepherd.js.js
|
2
|
+
//= require js-cookie/src/js.cookie
|
3
|
+
//= require shepherd.js/dist/js/shepherd
|
6
4
|
|
7
5
|
$(document).on('turbolinks:before-cache', function() {
|
8
6
|
// Remove visible product tours
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
class AbrahamHistoriesController < ApplicationController
|
3
4
|
def create
|
4
5
|
@abraham_history = AbrahamHistory.new(abraham_history_params)
|
@@ -14,8 +15,8 @@ class AbrahamHistoriesController < ApplicationController
|
|
14
15
|
|
15
16
|
private
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
19
|
+
def abraham_history_params
|
20
|
+
params.require(:abraham_history).permit(:controller_name, :action_name, :tour_name)
|
21
|
+
end
|
21
22
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module AbrahamHelper
|
3
4
|
def abraham_tour
|
4
5
|
# Do we have tours for this controller/action in the user's locale?
|
5
6
|
tours = Rails.configuration.abraham.tours["#{controller_name}.#{action_name}.#{I18n.locale}"]
|
6
7
|
|
7
|
-
|
8
|
-
# How about the default locale?
|
9
|
-
tours = Rails.configuration.abraham.tours["#{controller_name}.#{action_name}.#{I18n.default_locale}"]
|
10
|
-
end
|
8
|
+
tours ||= Rails.configuration.abraham.tours["#{controller_name}.#{action_name}.#{I18n.default_locale}"]
|
11
9
|
|
12
10
|
if tours
|
13
11
|
completed = AbrahamHistory.where(
|
@@ -19,10 +17,18 @@ module AbrahamHelper
|
|
19
17
|
|
20
18
|
if remaining.any?
|
21
19
|
# Generate the javascript snippet for the next remaining tour
|
22
|
-
render(partial:
|
20
|
+
render(partial: "application/abraham",
|
23
21
|
locals: { tour_name: remaining.first,
|
24
|
-
steps: tours[remaining.first][
|
22
|
+
steps: tours[remaining.first]["steps"] })
|
25
23
|
end
|
26
24
|
end
|
27
25
|
end
|
26
|
+
|
27
|
+
def abraham_cookie_prefix
|
28
|
+
"abraham-#{Rails.application.class.parent.to_s.underscore}-#{current_user.id}-#{controller_name}-#{action_name}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def abraham_domain
|
32
|
+
request.host
|
33
|
+
end
|
28
34
|
end
|
@@ -13,6 +13,7 @@
|
|
13
13
|
dataType: "json",
|
14
14
|
contentType: "application/json",
|
15
15
|
data: JSON.stringify({
|
16
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
16
17
|
controller_name: '<%= controller_name %>',
|
17
18
|
action_name: '<%= action_name %>',
|
18
19
|
tour_name: '<%= tour_name %>'
|
@@ -21,7 +22,7 @@
|
|
21
22
|
});
|
22
23
|
|
23
24
|
tour.on("cancel", function() {
|
24
|
-
Cookies.set('
|
25
|
+
Cookies.set('<%= abraham_cookie_prefix %>-<%= tour_name %>', 'later', { domain: '<%= abraham_domain %>' });
|
25
26
|
});
|
26
27
|
|
27
28
|
<% steps.each_with_index do |(key, step), index| %>
|
@@ -54,7 +55,7 @@
|
|
54
55
|
<% end %>
|
55
56
|
|
56
57
|
// Don't start the tour if the user dismissed it once this session
|
57
|
-
if (!Cookies.get('
|
58
|
+
if (!Cookies.get('<%= abraham_cookie_prefix %>-<%= tour_name %>', { domain: '<%= abraham_domain %>' })) {
|
58
59
|
tour.start();
|
59
60
|
}
|
60
61
|
</script>
|
data/config/routes.rb
CHANGED
data/lib/abraham.rb
CHANGED
data/lib/abraham/engine.rb
CHANGED
data/lib/abraham/version.rb
CHANGED
@@ -1,27 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require
|
2
|
+
|
3
|
+
require "rails/generators"
|
4
|
+
require "rails/generators/active_record"
|
4
5
|
|
5
6
|
module Abraham
|
6
7
|
module Generators
|
7
8
|
class InstallGenerator < ActiveRecord::Generators::Base
|
8
|
-
argument :name, type: :string, default:
|
9
|
+
argument :name, type: :string, default: "random_name"
|
9
10
|
|
10
11
|
class_option :'skip-migration', type: :boolean, desc: "Don't generate a migration for the histories table"
|
11
12
|
class_option :'skip-initializer', type: :boolean, desc: "Don't generate an initializer"
|
12
13
|
|
13
|
-
source_root File.expand_path(File.join(File.dirname(__FILE__),
|
14
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), "templates"))
|
14
15
|
|
15
16
|
# Copies the migration template to db/migrate.
|
16
17
|
def copy_files
|
17
|
-
return if options[
|
18
|
-
|
18
|
+
return if options["skip-migration"]
|
19
|
+
|
20
|
+
migration_template "migration.rb", "db/migrate/create_abraham_histories.rb"
|
19
21
|
end
|
20
22
|
|
21
23
|
def create_initializer
|
22
|
-
return if options[
|
23
|
-
|
24
|
-
copy_file
|
24
|
+
return if options["skip-initializer"]
|
25
|
+
|
26
|
+
copy_file "initializer.rb", "config/initializers/abraham.rb"
|
27
|
+
copy_file "abraham.yml", "config/abraham.yml"
|
25
28
|
end
|
26
29
|
end
|
27
30
|
end
|
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: '1.
|
4
|
+
version: '1.4'
|
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: 2019-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,42 +16,22 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 5.0.0.1
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '5.0'
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 5.0.0.1
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: sass-rails
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '5.0'
|
19
|
+
version: '5.1'
|
40
20
|
type: :runtime
|
41
21
|
prerelease: false
|
42
22
|
version_requirements: !ruby/object:Gem::Requirement
|
43
23
|
requirements:
|
44
24
|
- - "~>"
|
45
25
|
- !ruby/object:Gem::Version
|
46
|
-
version: '5.
|
26
|
+
version: '5.1'
|
47
27
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
28
|
+
name: sassc-rails
|
49
29
|
requirement: !ruby/object:Gem::Requirement
|
50
30
|
requirements:
|
51
31
|
- - ">="
|
52
32
|
- !ruby/object:Gem::Version
|
53
33
|
version: '0'
|
54
|
-
type: :
|
34
|
+
type: :development
|
55
35
|
prerelease: false
|
56
36
|
version_requirements: !ruby/object:Gem::Requirement
|
57
37
|
requirements:
|
@@ -59,35 +39,21 @@ dependencies:
|
|
59
39
|
- !ruby/object:Gem::Version
|
60
40
|
version: '0'
|
61
41
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - "~>"
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '1.8'
|
68
|
-
type: :runtime
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - "~>"
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '1.8'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: rails-assets-js-cookie
|
42
|
+
name: sqlite3
|
77
43
|
requirement: !ruby/object:Gem::Requirement
|
78
44
|
requirements:
|
79
|
-
- - "
|
45
|
+
- - ">="
|
80
46
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
82
|
-
type: :
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
83
49
|
prerelease: false
|
84
50
|
version_requirements: !ruby/object:Gem::Requirement
|
85
51
|
requirements:
|
86
|
-
- - "
|
52
|
+
- - ">="
|
87
53
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
54
|
+
version: '0'
|
89
55
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
56
|
+
name: rubocop
|
91
57
|
requirement: !ruby/object:Gem::Requirement
|
92
58
|
requirements:
|
93
59
|
- - ">="
|
@@ -101,7 +67,7 @@ dependencies:
|
|
101
67
|
- !ruby/object:Gem::Version
|
102
68
|
version: '0'
|
103
69
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
70
|
+
name: listen
|
105
71
|
requirement: !ruby/object:Gem::Requirement
|
106
72
|
requirements:
|
107
73
|
- - ">="
|
@@ -161,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
127
|
- !ruby/object:Gem::Version
|
162
128
|
version: '0'
|
163
129
|
requirements: []
|
164
|
-
|
165
|
-
rubygems_version: 2.6.14
|
130
|
+
rubygems_version: 3.0.2
|
166
131
|
signing_key:
|
167
132
|
specification_version: 4
|
168
133
|
summary: Trackable application tours for Rails with i18n support, based on Shepherd.js.
|