hat-trick 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +2 -0
- data/lib/hat_trick/step.rb +15 -3
- data/lib/hat_trick/step_definition.rb +8 -1
- data/lib/hat_trick/version.rb +1 -1
- data/lib/hat_trick/wizard.rb +1 -0
- metadata +2 -2
data/Changelog
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
* 0.2.1 - Fix a bug where button_to data was shared across multiple users of the app. They are now user-specific, as they should be.
|
2
|
+
|
1
3
|
* 0.2.0 - Now calls before/after :each callbacks before the step-specific ones
|
2
4
|
|
3
5
|
* 0.1.5 - Allow hide_button DSL method inside before / after blocks
|
data/lib/hat_trick/step.rb
CHANGED
@@ -2,12 +2,12 @@ require 'hat_trick/step_definition'
|
|
2
2
|
|
3
3
|
module HatTrick
|
4
4
|
class Step
|
5
|
-
attr_reader :step_def, :wizard
|
5
|
+
attr_reader :step_def, :wizard, :buttons
|
6
6
|
attr_accessor :next_step, :redirect_from
|
7
7
|
attr_writer :skipped
|
8
8
|
|
9
|
-
delegate :name, :fieldset, :
|
10
|
-
:
|
9
|
+
delegate :name, :fieldset, :to_sym, :to_s, :run_after_callback,
|
10
|
+
:run_before_callback, :include_data,
|
11
11
|
:run_include_data_callback, :run_step_contents_callback,
|
12
12
|
:include_data_key, :config, :step_contents, :last?, :first?,
|
13
13
|
:to => :step_def
|
@@ -16,10 +16,22 @@ module HatTrick
|
|
16
16
|
|
17
17
|
def initialize(step_def, wizard)
|
18
18
|
@step_def = step_def
|
19
|
+
@buttons = step_def.buttons.dup
|
19
20
|
@wizard = wizard
|
20
21
|
@skipped = step_def.skipped?
|
21
22
|
end
|
22
23
|
|
24
|
+
def add_button(button)
|
25
|
+
@buttons.delete_if do |b|
|
26
|
+
b.keys.first == button.keys.first && b[b.keys.first][:default]
|
27
|
+
end
|
28
|
+
@buttons << button
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete_button(type)
|
32
|
+
@buttons.delete_if { |b| b.keys.first == type }
|
33
|
+
end
|
34
|
+
|
23
35
|
def skipped?
|
24
36
|
@skipped || (skipped_steps.include?(self.to_sym) && !visited?)
|
25
37
|
end
|
@@ -149,7 +149,14 @@ module HatTrick
|
|
149
149
|
end
|
150
150
|
|
151
151
|
def run_before_callback(context, model)
|
152
|
-
|
152
|
+
log_msg = if model && model.respond_to?(:id)
|
153
|
+
"Running before callback for #{name} with model id #{model.id}"
|
154
|
+
elsif model && model.is_a?(ActiveModel::Errors)
|
155
|
+
"Running before callback for #{name} with errors on model id #{model.instance_variable_get(:@base).id}"
|
156
|
+
else
|
157
|
+
"Running before callback for #{name}"
|
158
|
+
end
|
159
|
+
Rails.logger.info log_msg
|
153
160
|
run_callbacks(before_callbacks, context, model)
|
154
161
|
end
|
155
162
|
|
data/lib/hat_trick/version.rb
CHANGED
data/lib/hat_trick/wizard.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hat-trick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|