shepherd-rails 0.0.1 → 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: 3a728e7d696c667e4674bddb3bcc691c8be34662ff082f3c54621be6e43ada88
4
- data.tar.gz: 6dfebbf1006baf525767deb3245517759f74e02191d7389a71696671d0ec1761
3
+ metadata.gz: 4668b86f00cb27f826ddffac5f2689423ad56e3c8838ddd4070d45039787807b
4
+ data.tar.gz: e804d7c08d8e669609bf3a0711667830c6a067a69fc76d5d11a7e79358ad44c6
5
5
  SHA512:
6
- metadata.gz: e54bc3d14db62f7805ab1c155c2a2a1483400700c4d7e4b9ef4f75e2c5d3f3a2a8503eac0eea0988cfc294ba573ff8e29c7542df300f3f24220dd2cb6cf0db9e
7
- data.tar.gz: 0b30ecac0b5b8b575f9757f06d6a65dd96110a3ca6a1c42812ac2c73978f8f6e1cc24aa9afe2931606bc359d794d545769ff42afe096d04151bc1fe822a3e2ba
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.1"
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.1
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
@@ -36,7 +36,6 @@ files:
36
36
  - Rakefile
37
37
  - app/assets/config/sr_manifest.js
38
38
  - app/assets/stylesheets/sr/application.css
39
- - app/controllers/shepherd_rails/application_controller.rb
40
39
  - app/controllers/shepherd_rails/tour_statuses_controller.rb
41
40
  - app/helpers/shepherd_rails/application_helper.rb
42
41
  - app/jobs/sr/application_job.rb
@@ -55,11 +54,9 @@ homepage: https://github.com/cionescu/shepherd-rails
55
54
  licenses:
56
55
  - MIT
57
56
  metadata:
58
- allowed_push_host: https://rubygems.org
59
57
  homepage_uri: https://github.com/cionescu/shepherd-rails
60
58
  source_code_uri: https://github.com/cionescu/shepherd-rails
61
59
  changelog_uri: https://github.com/cionescu/shepherd-rails
62
- rubygems_mfa_required: 'true'
63
60
  post_install_message:
64
61
  rdoc_options: []
65
62
  require_paths:
@@ -1,4 +0,0 @@
1
- module ShepherdRails
2
- class ApplicationController < ActionController::Base
3
- end
4
- end