Commit 4e192d90d72b944baef7db61c75aa9e075b7ff2f
Committed by
Paulo Meireles
1 parent
46b3891d
Exists in
master
and in
29 other branches
[Mezuro] Handling javascript errors in mezuro configuration edition.
Showing
4 changed files
with
15 additions
and
9 deletions
Show diff stats
plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb
| ... | ... | @@ -28,7 +28,6 @@ class MezuroPluginRangeController < MezuroPluginMyprofileController |
| 28 | 28 | metric_configuration.save |
| 29 | 29 | if metric_configuration_has_errors? metric_configuration |
| 30 | 30 | @error = metric_configuration.errors[0].message |
| 31 | - #redirect_to_error_page metric_configuration.errors[0].message | |
| 32 | 31 | end |
| 33 | 32 | end |
| 34 | 33 | |
| ... | ... | @@ -41,7 +40,7 @@ class MezuroPluginRangeController < MezuroPluginMyprofileController |
| 41 | 40 | metric_configuration.ranges[index] = Kalibro::Range.new params[:range] |
| 42 | 41 | metric_configuration.save |
| 43 | 42 | if metric_configuration_has_errors? metric_configuration |
| 44 | - redirect_to_error_page metric_configuration.errors[0].message | |
| 43 | + @error = metric_configuration.errors[0].message | |
| 45 | 44 | end |
| 46 | 45 | end |
| 47 | 46 | |
| ... | ... | @@ -57,9 +56,9 @@ class MezuroPluginRangeController < MezuroPluginMyprofileController |
| 57 | 56 | else |
| 58 | 57 | formatted_metric_name = metric_name.gsub(/\s/, '+') |
| 59 | 58 | if metric_configuration.metric.class == Kalibro::CompoundMetric |
| 60 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_compound_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" | |
| 59 | + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_compound_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" | |
| 61 | 60 | else |
| 62 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" | |
| 61 | + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" | |
| 63 | 62 | end |
| 64 | 63 | end |
| 65 | 64 | end | ... | ... |
plugins/mezuro/lib/kalibro/range.rb
plugins/mezuro/views/mezuro_plugin_range/create_range.rjs
| 1 | -page.alert @error | |
| 2 | -page.visual_effect :toggle_slide, "range_form" | |
| 3 | -page.insert_html :bottom, "ranges", :partial => "range", :locals => {:range => @range} | |
| 1 | +if @error.nil? | |
| 2 | + page.visual_effect :toggle_slide, "range_form" | |
| 3 | + page.insert_html :bottom, "ranges", :partial => "range", :locals => {:range => @range} | |
| 4 | +else | |
| 5 | + page.alert @error | |
| 6 | +end | ... | ... |
plugins/mezuro/views/mezuro_plugin_range/update_range.rjs