shepherd-rails 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d863f2b6d490cf748b5a78fbfbda547d0c829b706f689c41b42325427f40b760
|
4
|
+
data.tar.gz: 5e69af20b3a81ac0c600ea0bd35863d82a4603c474505a29ea22a2d6d750d97f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40937cbdd4726100f5164042d816dbc5b9b04d9e1962104a717a702ce0bd0a445e2ffdc8dcb8d90be1e50d324566cb8c2c4f5d06ec045ccc8efd8d7c508e8ae9
|
7
|
+
data.tar.gz: fdb9cd09216b475a3ff74a8402c37b39c994ae6839a928558e72085805cea69fd6dfa8945885db109191a804694b1e8e278b4d9282e830e801660d545441c91a
|
@@ -1,10 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ShepherdRails
|
2
4
|
class TourStatusesController < ShepherdRails.configuration.base_controller.constantize
|
5
|
+
protect_from_forgery with: :null_session
|
6
|
+
|
3
7
|
def create
|
4
8
|
tour_name = params.require(:tour)
|
9
|
+
context = params.to_unsafe_h[:context].to_h.with_indifferent_access
|
5
10
|
case params.require(:event)
|
6
11
|
when 'complete'
|
7
|
-
ShepherdRails.configuration.on_tour_complete.call(
|
12
|
+
ShepherdRails.configuration.on_tour_complete.call(context, tour_name)
|
8
13
|
end
|
9
14
|
|
10
15
|
head :ok
|
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
module ShepherdRails
|
4
4
|
module ApplicationHelper
|
5
|
-
def shepherd_tour tour:
|
5
|
+
def shepherd_tour tour:, context: {}
|
6
6
|
tag.div nil, data: {
|
7
7
|
controller: 'shepherd-rails',
|
8
8
|
'shepherd-rails-tour-name-value' => tour,
|
9
9
|
'shepherd-rails-endpoint-value' => shepherd_rails.tour_statuses_path,
|
10
|
-
'shepherd-rails-config-value' => I18n.t(tour, scope: 'shepherd_rails')
|
10
|
+
'shepherd-rails-config-value' => I18n.t(tour, scope: 'shepherd_rails'),
|
11
|
+
'shepherd-rails-context-value' => context
|
11
12
|
}
|
12
13
|
end
|
13
14
|
end
|
@@ -1,4 +1,4 @@
|
|
1
1
|
ShepherdRails.configure do |config|
|
2
|
-
# config.on_tour_complete = ->(
|
2
|
+
# config.on_tour_complete = ->(context, tour_name) { Model.find(context[:model_id].do_something tour_name }
|
3
3
|
# config.base_controller = 'ApplicationController'
|
4
4
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module ShepherdRails
|
2
2
|
class Config
|
3
|
-
cattr_accessor :on_tour_complete, default: ->(
|
3
|
+
cattr_accessor :on_tour_complete, default: ->(context, tour_name) { puts "Completed tour #{tour_name} - context: #{context.inspect}" }
|
4
4
|
cattr_accessor :base_controller, default: 'ActionController::Base'
|
5
5
|
end
|
6
6
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shepherd-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Catalin Ionescu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|