shepherd-rails 0.0.2 → 0.0.3

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: 6bafe26b63e37606b54d3893f6ee8d1a48dd843293b53b1cbbc2aba6bdd2cc2b
4
- data.tar.gz: 4c02327f39a5ff6cd418680071c5787b2a4633d6855c8d41765c79738d07d354
3
+ metadata.gz: 4668b86f00cb27f826ddffac5f2689423ad56e3c8838ddd4070d45039787807b
4
+ data.tar.gz: e804d7c08d8e669609bf3a0711667830c6a067a69fc76d5d11a7e79358ad44c6
5
5
  SHA512:
6
- metadata.gz: ac5b8037f51f7f79684b2d715214694674e8b341299f4699e95c1162ce1b3218c6f4421a0c6d6b678af3ab4d57f097c28154aaa5f9dededb38b05519d75a28b4
7
- data.tar.gz: c7b74234dc1d462c989ff22a1a336049ea87c11253b681ed7aa2b8bac860734eb81d414a894757aa76db5425309a856c48aa6e01f947b801f9098ac6a2286dfb
6
+ metadata.gz: 44ae74b2caafaf70a82b85e776063df8819db3cef7bb83b74dafe380f3218cc3dddfaea65b1e6a52dccace9479afd105f9788a5d22010321e384fce0c35d2685
7
+ data.tar.gz: 748829ef790e1bfe6909616dbbb5a6f1f1104c653c0f5513c65daf9d050a9ab22445c9ecebc386eaeb71ffa8ec1628dfc8864cb8a764de4f596c9f7c65730621
@@ -2,9 +2,10 @@ module ShepherdRails
2
2
  class TourStatusesController < ShepherdRails.configuration.base_controller.constantize
3
3
  def create
4
4
  tour_name = params.require(:tour)
5
+ context = params.to_unsafe_h[:context].to_h.with_indifferent_access
5
6
  case params.require(:event)
6
7
  when 'complete'
7
- ShepherdRails.configuration.on_tour_complete.call(self, tour_name)
8
+ ShepherdRails.configuration.on_tour_complete.call(context, tour_name)
8
9
  end
9
10
 
10
11
  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 = ->(controller, tour_name) { controller.do_something tour_name }
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: ->(_ctx) { puts 'Here' }
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
@@ -1,3 +1,3 @@
1
1
  module ShepherdRails
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  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.2
4
+ version: 0.0.3
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-03-15 00:00:00.000000000 Z
11
+ date: 2023-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails