Commit 7f3a7e5e9febd5971f85ecf8598c43d9f0509b64
Committed by
Paulo Meireles
1 parent
feee81ec
Exists in
master
and in
29 other branches
[Mezuro] Refactored redirects in controllers.
Showing
14 changed files
with
76 additions
and
43 deletions
Show diff stats
plugins/mezuro/controllers/myprofile/mezuro_plugin_metric_configuration_controller.rb
... | ... | @@ -15,13 +15,13 @@ class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileControlle |
15 | 15 | end |
16 | 16 | |
17 | 17 | def create_native |
18 | + configuration_content = profile.articles.find(params[:id]) | |
18 | 19 | metric_configuration = Kalibro::MetricConfiguration.create(params[:metric_configuration]) |
19 | 20 | |
20 | 21 | if metric_configuration_has_errors? metric_configuration |
21 | 22 | redirect_to_error_page metric_configuration.errors[0].message |
22 | 23 | else |
23 | - id = params[:id] | |
24 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_native?id=#{id}&metric_configuration_id=#{metric_configuration.id}" | |
24 | + redirect_to(metric_configuration_url(configuration_content)) | |
25 | 25 | end |
26 | 26 | end |
27 | 27 | |
... | ... | @@ -42,7 +42,7 @@ class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileControlle |
42 | 42 | if metric_configuration_has_errors? metric_configuration |
43 | 43 | redirect_to_error_page metric_configuration.errors[0].message |
44 | 44 | else |
45 | - redirect_to "/#{profile.identifier}/#{@configuration_content.slug}" | |
45 | + redirect_to @configuration_content.view_url | |
46 | 46 | end |
47 | 47 | end |
48 | 48 | |
... | ... | @@ -54,7 +54,7 @@ class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileControlle |
54 | 54 | if metric_configuration_has_errors? metric_configuration |
55 | 55 | redirect_to_error_page metric_configuration.errors[0].message |
56 | 56 | else |
57 | - redirect_to "/#{profile.identifier}/#{configuration_content.slug}" | |
57 | + redirect_to configuration_content.view_url | |
58 | 58 | end |
59 | 59 | end |
60 | 60 | |
... | ... | @@ -68,13 +68,13 @@ class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileControlle |
68 | 68 | end |
69 | 69 | |
70 | 70 | def create_compound |
71 | + configuration_content = profile.articles.find(params[:id]) | |
71 | 72 | metric_configuration = Kalibro::MetricConfiguration.create(params[:metric_configuration]) |
72 | 73 | |
73 | 74 | if metric_configuration_has_errors? metric_configuration |
74 | 75 | redirect_to_error_page metric_configuration.errors[0].message |
75 | 76 | else |
76 | - id = params[:id] | |
77 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_compound?id=#{id}&metric_configuration_id=#{metric_configuration.id}" | |
77 | + redirect_to(metric_configuration_url(configuration_content)) | |
78 | 78 | end |
79 | 79 | end |
80 | 80 | |
... | ... | @@ -105,4 +105,14 @@ class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileControlle |
105 | 105 | def configuration_content_has_errors? |
106 | 106 | not @configuration_content.errors[:base].nil? |
107 | 107 | end |
108 | + | |
109 | + def metric_configuration_url configuration_content | |
110 | + url = configuration_content.view_url | |
111 | + url[:controller] = controller_name | |
112 | + url[:id] = configuration_content.id | |
113 | + url[:metric_configuration_id] = params[:metric_configuration][:id].to_i | |
114 | + url[:action] = (params[:metric_configuration][:metric][:compound] ? "edit_compound" : "edit_native") | |
115 | + url | |
116 | + end | |
108 | 117 | end |
118 | + | ... | ... |
plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb
... | ... | @@ -6,6 +6,8 @@ class MezuroPluginRangeController < MezuroPluginMyprofileController |
6 | 6 | @content_id = params[:id].to_i |
7 | 7 | @metric_configuration_id = params[:metric_configuration_id].to_i |
8 | 8 | @reading_labels_and_ids = reading_labels_and_ids |
9 | + @reading_group_id = params[:reading_group_id].to_i | |
10 | + @compound = params[:compound] | |
9 | 11 | end |
10 | 12 | |
11 | 13 | def edit |
... | ... | @@ -18,6 +20,8 @@ class MezuroPluginRangeController < MezuroPluginMyprofileController |
18 | 20 | |
19 | 21 | def create |
20 | 22 | metric_configuration_id = params[:metric_configuration_id].to_i |
23 | + @reading_group_id = params[:reading_group_id].to_i | |
24 | + @compound = params[:compound] | |
21 | 25 | @range = Kalibro::Range.new params[:range] |
22 | 26 | @range.save metric_configuration_id |
23 | 27 | if !@range.errors.empty? |
... | ... | @@ -35,19 +39,23 @@ class MezuroPluginRangeController < MezuroPluginMyprofileController |
35 | 39 | end |
36 | 40 | |
37 | 41 | def remove |
38 | - configuration_content_id = params[:id].to_i | |
39 | - metric_configuration_id = params[:metric_configuration_id].to_i | |
40 | - compound = params[:compound] | |
42 | + configuration_content = profile.articles.find(params[:id]) | |
43 | + | |
41 | 44 | Kalibro::Range.new({:id => params[:range_id].to_i}).destroy |
42 | - if compound | |
43 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_compound?id=#{configuration_content_id}&metric_configuration_id=#{metric_configuration_id}" | |
44 | - else | |
45 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_native?id=#{configuration_content_id}&metric_configuration_id=#{metric_configuration_id}" | |
46 | - end | |
45 | + redirect_to(metric_configuration_url(configuration_content)) | |
47 | 46 | end |
48 | 47 | |
49 | 48 | private |
50 | 49 | |
50 | + def metric_configuration_url configuration_content | |
51 | + url = configuration_content.view_url | |
52 | + url[:controller] = "mezuro_plugin_metric_configuration" | |
53 | + url[:id] = configuration_content.id | |
54 | + url[:metric_configuration_id] = params[:metric_configuration_id].to_i | |
55 | + url[:action] = (params[:compound] ? "edit_compound" : "edit_native") | |
56 | + url | |
57 | + end | |
58 | + | |
51 | 59 | def reading_labels_and_ids |
52 | 60 | array = Kalibro::Reading.readings_of(params[:reading_group_id].to_i).map { |reading| [reading.label, reading.id] } |
53 | 61 | array.sort { |x,y| x.first.downcase <=> y.first.downcase } | ... | ... |
plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb
... | ... | @@ -11,11 +11,10 @@ class MezuroPluginReadingController < MezuroPluginMyprofileController |
11 | 11 | |
12 | 12 | def create |
13 | 13 | reading_group_content = profile.articles.find(params[:id]) |
14 | - | |
15 | 14 | reading = Kalibro::Reading.new params[:reading] |
16 | 15 | |
17 | 16 | if( reading.save(reading_group_content.reading_group_id) ) |
18 | - redirect_to "/#{profile.identifier}/#{reading_group_content.name.downcase.gsub(/\s/, '-').gsub(/[^0-9A-Za-z\-]/, '')}" | |
17 | + redirect_to reading_group_content.view_url | |
19 | 18 | else |
20 | 19 | redirect_to_error_page reading.errors[0].message |
21 | 20 | end |
... | ... | @@ -35,7 +34,7 @@ class MezuroPluginReadingController < MezuroPluginMyprofileController |
35 | 34 | reading = Kalibro::Reading.new params[:reading] |
36 | 35 | |
37 | 36 | if( reading.save(reading_group_content.reading_group_id) ) |
38 | - redirect_to "/profile/#{profile.identifier}/plugin/mezuro/reading/show/#{reading_group_content.id}?reading_id=#{reading.id}" | |
37 | + redirect_to reading_group_content.view_url | |
39 | 38 | else |
40 | 39 | redirect_to_error_page reading.errors[0].message |
41 | 40 | end |
... | ... | @@ -46,7 +45,7 @@ class MezuroPluginReadingController < MezuroPluginMyprofileController |
46 | 45 | reading = Kalibro::Reading.find params[:reading_id] |
47 | 46 | reading.destroy |
48 | 47 | if( reading.errors.empty? ) |
49 | - redirect_to "/#{profile.identifier}/#{reading_group_content.name.downcase.gsub(/\s/, '-')}" | |
48 | + redirect_to reading_group_content.view_url | |
50 | 49 | else |
51 | 50 | redirect_to_error_page reading.errors[0].message |
52 | 51 | end | ... | ... |
plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
... | ... | @@ -25,7 +25,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
25 | 25 | |
26 | 26 | if( repository.errors.empty? ) |
27 | 27 | repository.process |
28 | - redirect_to "/profile/#{profile.identifier}/plugin/mezuro/repository/show/#{project_content.id}?repository_id=#{repository.id}" | |
28 | + redirect_to(repository_url(project_content)) | |
29 | 29 | else |
30 | 30 | redirect_to_error_page repository.errors[0].message |
31 | 31 | end |
... | ... | @@ -56,7 +56,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
56 | 56 | |
57 | 57 | if( repository.errors.empty? ) |
58 | 58 | repository.process |
59 | - redirect_to "/profile/#{profile.identifier}/plugin/mezuro/repository/show/#{project_content.id}?repository_id=#{repository.id}" | |
59 | + redirect_to(repository_url(project_content)) | |
60 | 60 | else |
61 | 61 | redirect_to_error_page repository.errors[0].message |
62 | 62 | end |
... | ... | @@ -76,10 +76,19 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
76 | 76 | repository = project_content.repositories.select{ |repository| repository.id.to_s == params[:repository_id] }.first |
77 | 77 | repository.destroy |
78 | 78 | if( repository.errors.empty? ) |
79 | - redirect_to "/#{profile.identifier}/#{project_content.name.downcase.gsub(/\s/, '-')}" | |
79 | + redirect_to project_content.view_url | |
80 | 80 | else |
81 | 81 | redirect_to_error_page repository.errors[0].message |
82 | 82 | end |
83 | 83 | end |
84 | 84 | |
85 | + def repository_url project_content | |
86 | + url = project_content.view_url | |
87 | + url[:controller] = controller_name | |
88 | + url[:id] = project_content.id | |
89 | + url[:repository_id] = params[:repository_id].to_i | |
90 | + url[:action] = "show" | |
91 | + url | |
92 | + end | |
93 | + | |
85 | 94 | end | ... | ... |
plugins/mezuro/test/functional/myprofile/mezuro_plugin_metric_configuration_controller_test.rb
... | ... | @@ -117,14 +117,14 @@ class MezuroPluginMetricConfigurationControllerTest < ActionController::TestCase |
117 | 117 | @native_metric_configuration.expects(:update_attributes).returns(true) #FIXME need .with(some_hash), should it mock the request?. |
118 | 118 | get :update, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration => @native_metric_configuration_hash |
119 | 119 | assert_equal @configuration_content, assigns(:configuration_content) |
120 | - assert_response 302 | |
120 | + assert_response :redirect | |
121 | 121 | end |
122 | 122 | |
123 | 123 | should 'remove' do |
124 | 124 | Kalibro::MetricConfiguration.expects(:new).with({:id => @native_metric_configuration.id}).returns(@native_metric_configuration) |
125 | 125 | @native_metric_configuration.expects(:destroy).returns() |
126 | 126 | get :remove, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @native_metric_configuration.id |
127 | - assert_response 302 | |
127 | + assert_response :redirect | |
128 | 128 | end |
129 | 129 | |
130 | 130 | end | ... | ... |
plugins/mezuro/test/functional/myprofile/mezuro_plugin_range_controller_test.rb
... | ... | @@ -34,11 +34,13 @@ class MezuroPluginRangeControllerTest < ActionController::TestCase |
34 | 34 | |
35 | 35 | should 'set correct attributes to create a new range' do |
36 | 36 | Kalibro::Reading.expects(:readings_of).with(@metric_configuration.reading_group_id).returns([@reading]) |
37 | - get :new, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id | |
37 | + get :new, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound | |
38 | 38 | assert_equal @content.id, assigns(:content_id) |
39 | 39 | assert_equal @metric_configuration.id, assigns(:metric_configuration_id) |
40 | 40 | assert_equal [[@reading.label,@reading.id]], assigns(:reading_labels_and_ids) |
41 | - assert_response 200 | |
41 | + assert_equal @metric_configuration.reading_group_id, assigns(:reading_group_id) | |
42 | + assert_equal @metric_configuration.metric.compound, assigns(:compound) | |
43 | + assert_response :success | |
42 | 44 | end |
43 | 45 | |
44 | 46 | should 'set correct attributes to edit a range' do |
... | ... | @@ -49,7 +51,7 @@ class MezuroPluginRangeControllerTest < ActionController::TestCase |
49 | 51 | assert_equal @metric_configuration.id, assigns(:metric_configuration_id) |
50 | 52 | assert_equal [[@reading.label,@reading.id]], assigns(:reading_labels_and_ids) |
51 | 53 | assert_equal @range, assigns(:range) |
52 | - assert_response 200 | |
54 | + assert_response :success | |
53 | 55 | end |
54 | 56 | |
55 | 57 | should 'test create instance range' do |
... | ... | @@ -57,9 +59,11 @@ class MezuroPluginRangeControllerTest < ActionController::TestCase |
57 | 59 | :metric_configuration_id => @metric_configuration.id, |
58 | 60 | :range => @created_range.to_hash}).returns(:range_id => @range.id) |
59 | 61 | Kalibro::Reading.expects(:find).with(@created_range.reading_id).returns(@reading) |
60 | - get :create, :profile => @profile.identifier, :range => @created_range_hash, :metric_configuration_id => @metric_configuration.id | |
62 | + get :create, :profile => @profile.identifier, :range => @created_range_hash, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound | |
61 | 63 | assert_equal @range.id, assigns(:range).id |
62 | - assert_response 200 | |
64 | + assert_equal @metric_configuration.reading_group_id, assigns(:reading_group_id) | |
65 | + assert_equal @metric_configuration.metric.compound, assigns(:compound) | |
66 | + assert_response :success | |
63 | 67 | end |
64 | 68 | |
65 | 69 | should 'test update range' do |
... | ... | @@ -68,13 +72,13 @@ class MezuroPluginRangeControllerTest < ActionController::TestCase |
68 | 72 | :range => @range.to_hash}).returns(:range_id => @range.id) |
69 | 73 | get :update, :profile => @profile.identifier, :range => @range_hash, :metric_configuration_id => @metric_configuration.id |
70 | 74 | assert_equal @range.id, assigns(:range).id |
71 | - assert_response 200 | |
75 | + assert_response :success | |
72 | 76 | end |
73 | 77 | |
74 | 78 | should 'test remove range in native metric configuration' do |
75 | 79 | Kalibro::Range.expects(:new).with({:id => @range.id}).returns(@range) |
76 | 80 | @range.expects(:destroy).with().returns() |
77 | 81 | get :remove, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :range_id => @range.id, :compound => false |
78 | - assert_response 302 | |
82 | + assert_response :redirect | |
79 | 83 | end |
80 | 84 | end | ... | ... |
plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb
... | ... | @@ -32,7 +32,7 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase |
32 | 32 | get :module_result, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id] |
33 | 33 | assert_equal @module_result_hash[:grade].to_f, assigns(:module_result).grade |
34 | 34 | assert_equal @metric_result_hash[:value].to_f, assigns(:metric_results).first.value |
35 | - assert_response 200 | |
35 | + assert_response :success | |
36 | 36 | #TODO assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') |
37 | 37 | end |
38 | 38 | |
... | ... | @@ -42,7 +42,7 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase |
42 | 42 | returns({:date_metric_result => @date_metric_result_hash}) |
43 | 43 | get :metric_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id], :metric_name => metric_name |
44 | 44 | assert_equal DateTime.parse(@date_metric_result_hash[:date]), assigns(:history).first.date |
45 | - assert_response 200 | |
45 | + assert_response :success | |
46 | 46 | #TODO assert_select |
47 | 47 | end |
48 | 48 | |
... | ... | @@ -51,7 +51,7 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase |
51 | 51 | returns({:date_module_result => @date_module_result_hash}) |
52 | 52 | get :module_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id] |
53 | 53 | assert_equal DateTime.parse(@date_module_result_hash[:date]), assigns(:history).first.date |
54 | - assert_response 200 | |
54 | + assert_response :success | |
55 | 55 | #TODO assert_select |
56 | 56 | end |
57 | 57 | ... | ... |
plugins/mezuro/test/functional/profile/mezuro_plugin_processing_controller_test.rb
... | ... | @@ -21,14 +21,14 @@ class MezuroPluginProcessingControllerTest < ActionController::TestCase |
21 | 21 | should 'render last processing state' do |
22 | 22 | Kalibro::Processing.expects(:processing_of).with(@repository_id).returns(@processing) |
23 | 23 | get :state, :profile => @profile.identifier, :repository_id => @repository_id |
24 | - assert_response 200 | |
24 | + assert_response :success | |
25 | 25 | assert_equal @processing.state, @response.body |
26 | 26 | end |
27 | 27 | |
28 | 28 | should 'render a processing state in a specific date' do |
29 | 29 | Kalibro::Processing.expects(:processing_with_date_of).with(@repository_id, @processing.date).returns(@processing) |
30 | 30 | get :state, :profile => @profile.identifier, :repository_id => @repository_id, :date => @processing.date |
31 | - assert_response 200 | |
31 | + assert_response :success | |
32 | 32 | assert_equal @processing.state, @response.body |
33 | 33 | end |
34 | 34 | |
... | ... | @@ -36,7 +36,7 @@ class MezuroPluginProcessingControllerTest < ActionController::TestCase |
36 | 36 | Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => @repository_id}).returns({:exists => false}) |
37 | 37 | Kalibro::Processing.expects(:request).with(:last_processing, :repository_id => @repository_id).returns({:processing => @processing_with_error_hash}) |
38 | 38 | get :processing, :profile => @profile.identifier, :repository_id => @repository_id |
39 | - assert_response 200 | |
39 | + assert_response :success | |
40 | 40 | assert_equal @processing_with_error_hash[:state], assigns(:processing).state |
41 | 41 | #TODO How to assert from view? assert_select('h3', 'ERROR') |
42 | 42 | end |
... | ... | @@ -45,7 +45,7 @@ class MezuroPluginProcessingControllerTest < ActionController::TestCase |
45 | 45 | Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => @repository_id}).returns({:exists => true}) |
46 | 46 | Kalibro::Processing.expects(:request).with(:last_ready_processing, {:repository_id => @repository_id}).returns({:processing => @processing_hash}) |
47 | 47 | get :processing, :profile => @profile.identifier, :repository_id => @repository_id |
48 | - assert_response 200 | |
48 | + assert_response :success | |
49 | 49 | assert_select('h4', 'Last Result') |
50 | 50 | end |
51 | 51 | |
... | ... | @@ -53,7 +53,7 @@ class MezuroPluginProcessingControllerTest < ActionController::TestCase |
53 | 53 | Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => @repository_id, :date => @processing.date}).returns({:exists => true}) |
54 | 54 | Kalibro::Processing.expects(:request).with(:first_processing_after, :repository_id => @repository_id, :date => @processing.date).returns({:processing => @processing_hash}) |
55 | 55 | get :processing, :profile => @profile.identifier, :repository_id => @repository_id, :date => @processing.date |
56 | - assert_response 200 | |
56 | + assert_response :success | |
57 | 57 | assert_select('h4', 'Last Result') |
58 | 58 | end |
59 | 59 | ... | ... |
plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb
... | ... | @@ -103,6 +103,7 @@ class MezuroPluginRepositoryControllerTest < ActionController::TestCase |
103 | 103 | assert_equal @configuration.name, assigns(:configuration_name) |
104 | 104 | assert_equal @content.profile.identifier, assigns(:data_profile) |
105 | 105 | assert_equal @content.id, assigns(:data_content) |
106 | + assert_response :success | |
106 | 107 | end |
107 | 108 | |
108 | 109 | should 'destroy a repository' do | ... | ... |
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | |
43 | 43 | <br/> |
44 | 44 | <% if owner %> |
45 | - <%= link_to_remote "New Range", :url => {:action =>"new", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id} %> | |
45 | + <%= link_to_remote "New Range", :url => {:action =>"new", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound} %> | |
46 | 46 | <% end %> |
47 | 47 | <div id="form" style="display:none"></div> |
48 | 48 | ... | ... |
plugins/mezuro/views/mezuro_plugin_range/_form.html.erb
plugins/mezuro/views/mezuro_plugin_range/create.rjs
1 | 1 | if @error.nil? |
2 | 2 | page.visual_effect :toggle_slide, "form" |
3 | - page.insert_html :bottom, "ranges", :partial => "range", :locals => {:range => @range} | |
3 | + page.insert_html :bottom, "ranges", :partial => "range", :locals => {:range => @range, :reading_group_id => @reading_group_id, :compound => @compound} | |
4 | 4 | else |
5 | 5 | page.alert @error |
6 | 6 | end | ... | ... |
plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb
1 | 1 | <script src="/javascripts/colorpicker.js" type="text/javascript"></script> |
2 | 2 | <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> |
3 | -<h3> <%= link_to( @reading_group_name, homepage_url(@data_profile, @reading_group_name.downcase.gsub(/[^0-9A-Za-z\-]/, '')) ) %></h3> | |
3 | +<h3> <%= link_to( @reading_group_name, homepage_url(@data_profile, @reading_group_name.downcase.gsub(/[^0-9A-Za-z\-]/, '-')) ) %></h3> | |
4 | 4 | |
5 | -<% form_for :reading, :url => {:action =>"create", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> | |
5 | +<% form_for :reading, :url => {:action =>"update", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> | |
6 | 6 | <%= hidden_field_tag :id, @reading_group_content_id %> |
7 | 7 | |
8 | 8 | <%= f.hidden_field :id %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_reading/new.html.erb
1 | 1 | <script src="/javascripts/colorpicker.js" type="text/javascript"></script> |
2 | 2 | <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> |
3 | -<h3> <%= link_to( @reading_group_name, homepage_url(@data_profile, @reading_group_name.downcase.gsub(/[^0-9A-Za-z\-]/, '')) ) %></h3> | |
3 | +<h3> <%= link_to( @reading_group_name, homepage_url(@data_profile, @reading_group_name.downcase.gsub(/[^0-9A-Za-z\-]/, '-')) ) %></h3> | |
4 | 4 | |
5 | 5 | <% form_for :reading, :url => {:action =>"create", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> |
6 | 6 | <%= hidden_field_tag :id, @reading_group_content_id %> | ... | ... |