ref: refs/heads/master
commit bc767d88017c49b8f5ad0ba605e69f9cd85a3d5c
Author: Josef Reidinger
Date: Mon Dec 7 18:17:30 2009 +0100
last module in base system has Finish button instead of Next (bnc#561329)
---
webclient/app/helpers/application_helper.rb | 9 ++++-----
webclient/lib/basesystem.rb | 6 ++++++
webclient/test/unit/basesystem_test.rb | 1 +
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/webclient/app/helpers/application_helper.rb b/webclient/app/helpers/application_helper.rb
index d357e3f..4e3d435 100644
--- a/webclient/app/helpers/application_helper.rb
+++ b/webclient/app/helpers/application_helper.rb
@@ -24,11 +24,10 @@ module ApplicationHelper
end
def form_next_button(send_options={})
- if Basesystem.done? session
- submit_tag _("Save"),send_options
- else
- submit_tag _("Next"),send_options
- end
+ label = _("Next")
+ label = _("Save") if Basesystem.done?(session)
+ label = _("Finish") if Basesystem.last_step?(session)
+ submit_tag label,send_options
end
end
diff --git a/webclient/lib/basesystem.rb b/webclient/lib/basesystem.rb
index 686ef19..63a0136 100644
--- a/webclient/lib/basesystem.rb
+++ b/webclient/lib/basesystem.rb
@@ -49,6 +49,12 @@ module Basesystem
session[:wizard_current] == steps.first
end
+ def Basesystem.last_step?(session)
+ return false unless session[:wizard_steps]
+ steps = session[:wizard_steps].split ","
+ session[:wizard_current] == steps.last
+ end
+
def Basesystem.initialize(basesystem,session)
if basesystem.steps.empty? or basesystem.finish
session[:wizard_current] = FINAL_STEP
diff --git a/webclient/test/unit/basesystem_test.rb b/webclient/test/unit/basesystem_test.rb
index c5838c8..23be82a 100644
--- a/webclient/test/unit/basesystem_test.rb
+++ b/webclient/test/unit/basesystem_test.rb
@@ -39,6 +39,7 @@ class BasesystemTest < ActiveSupport::TestCase
result = {:controller => "timezone", :action => "index"}
assert_equal result,Basesystem.current_target(session)
Basesystem.next_step session
+ assert Basesystem.last_step?(session)
Basesystem.next_step session
assert Basesystem.done?(session)
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org