diff --git a/plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb b/plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb index 3f96398..c8baf15 100644 --- a/plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb +++ b/plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb @@ -28,7 +28,6 @@ class MezuroPluginRangeController < MezuroPluginMyprofileController metric_configuration.save if metric_configuration_has_errors? metric_configuration @error = metric_configuration.errors[0].message - #redirect_to_error_page metric_configuration.errors[0].message end end @@ -41,7 +40,7 @@ class MezuroPluginRangeController < MezuroPluginMyprofileController metric_configuration.ranges[index] = Kalibro::Range.new params[:range] metric_configuration.save if metric_configuration_has_errors? metric_configuration - redirect_to_error_page metric_configuration.errors[0].message + @error = metric_configuration.errors[0].message end end @@ -57,9 +56,9 @@ class MezuroPluginRangeController < MezuroPluginMyprofileController else formatted_metric_name = metric_name.gsub(/\s/, '+') if metric_configuration.metric.class == Kalibro::CompoundMetric - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_compound_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_compound_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" else - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" end end end diff --git a/plugins/mezuro/lib/kalibro/range.rb b/plugins/mezuro/lib/kalibro/range.rb index c96f707..28f6e1d 100644 --- a/plugins/mezuro/lib/kalibro/range.rb +++ b/plugins/mezuro/lib/kalibro/range.rb @@ -18,7 +18,7 @@ class Kalibro::Range < Kalibro::Model def end=(value) @end = value.to_f - @end = 1.0/0.0 if value == "INF" + @end = 1.0/0.0 if value =~ /INF/ end def end diff --git a/plugins/mezuro/views/mezuro_plugin_range/create_range.rjs b/plugins/mezuro/views/mezuro_plugin_range/create_range.rjs index 6e77ee4..73adfac 100644 --- a/plugins/mezuro/views/mezuro_plugin_range/create_range.rjs +++ b/plugins/mezuro/views/mezuro_plugin_range/create_range.rjs @@ -1,3 +1,6 @@ -page.alert @error -page.visual_effect :toggle_slide, "range_form" -page.insert_html :bottom, "ranges", :partial => "range", :locals => {:range => @range} +if @error.nil? + page.visual_effect :toggle_slide, "range_form" + page.insert_html :bottom, "ranges", :partial => "range", :locals => {:range => @range} +else + page.alert @error +end diff --git a/plugins/mezuro/views/mezuro_plugin_range/update_range.rjs b/plugins/mezuro/views/mezuro_plugin_range/update_range.rjs index 5b95d3b..3000105 100644 --- a/plugins/mezuro/views/mezuro_plugin_range/update_range.rjs +++ b/plugins/mezuro/views/mezuro_plugin_range/update_range.rjs @@ -1 +1,5 @@ -page.reload() +if @error.nil? + page.reload() +else + page.alert @error +end -- libgit2 0.21.2