aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorZakaria BOUZIANE2015-04-15 13:15:50 +0200
committerZakaria BOUZIANE2015-04-15 13:15:50 +0200
commitc84c37af67f0188d6c08b8bc7399f8f570145bb0 (patch)
tree75c619d44fea55f209633db6b0f4b637252c395b /app
parent252236c4b5e038bb02b9323e0e16171671a90dd7 (diff)
downloadchouette-core-c84c37af67f0188d6c08b8bc7399f8f570145bb0.tar.bz2
Fix Unpermitted parameters: footnotes_attributes
Diffstat (limited to 'app')
-rw-r--r--app/controllers/lines_controller.rb2
-rw-r--r--app/controllers/vehicle_journeys_controller.rb12
-rw-r--r--app/views/exports/_export.erb3
-rw-r--r--app/views/imports/_import.erb3
-rw-r--r--app/views/validations/_validation.erb5
5 files changed, 18 insertions, 7 deletions
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb
index ce552034f..e33b82329 100644
--- a/app/controllers/lines_controller.rb
+++ b/app/controllers/lines_controller.rb
@@ -83,7 +83,7 @@ class LinesController < ChouetteController
private
def line_params
- params.require(:line).permit( :transport_mode, :network_id, :company_id, :objectid, :object_version, :creation_time, :creator_id, :name, :number, :published_name, :transport_mode_name, :registration_number, :comment, :mobility_restricted_suitability, :int_user_needs, :flexible_service, :group_of_lines, :group_of_line_ids, :group_of_line_tokens, :url, :color, :text_color)
+ params.require(:line).permit( :transport_mode, :network_id, :company_id, :objectid, :object_version, :creation_time, :creator_id, :name, :number, :published_name, :transport_mode_name, :registration_number, :comment, :mobility_restricted_suitability, :int_user_needs, :flexible_service, :group_of_lines, :group_of_line_ids, :group_of_line_tokens, :url, :color, :text_color, { footnotes_attributes: [ :code, :label, :_destroy ] } )
end
end
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb
index 9e809a719..fa1584b36 100644
--- a/app/controllers/vehicle_journeys_controller.rb
+++ b/app/controllers/vehicle_journeys_controller.rb
@@ -22,10 +22,10 @@ class VehicleJourneysController < ChouetteController
create!(:alert => t('activerecord.errors.models.vehicle_journey.invalid_times'))
end
- def update
+ def update
update!(:alert => t('activerecord.errors.models.vehicle_journey.invalid_times'))
end
-
+
def index
index! do
@matrix ||= matrix
@@ -78,4 +78,12 @@ class VehicleJourneysController < ChouetteController
end
end
end
+
+
+ private
+
+ def vehicle_journey_params
+ params.require(:vehicle_journey).permit( { footnote_ids: [] } , :journey_pattern_id, :number, :published_journey_name, :published_journey_identifier, :comment, :transport_mode_name, :mobility_restricted_suitability, :flexible_service, :status_value, :facility, :vehicle_type_identifier, :objectid, :time_table_tokens, { date: [ :hour, :minute ] }, :button, :referential_id, :line_id, :route_id, :id, { vehicle_journey_at_stops_attributes: [ :arrival_time, :id, :_destroy, :stop_point_id, :departure_time ] } )
+ end
+
end
diff --git a/app/views/exports/_export.erb b/app/views/exports/_export.erb
index cc3cb9757..1477c63bc 100644
--- a/app/views/exports/_export.erb
+++ b/app/views/exports/_export.erb
@@ -2,7 +2,8 @@
<div class="panel-heading">
<div class="panel-title clearfix">
<span class="pull-right">
- <%= link_to "#{export.datas.links[4].href}", :method => :delete, :data => {:confirm => t('exports.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
+ <% location = export.datas.links.select { |link| link["rel"] == "location" }.first.href %>
+ <%= link_to "#{location}", :method => :delete, :data => {:confirm => t('exports.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
<span class="fa fa-trash-o"></span>
<% end %>
</span>
diff --git a/app/views/imports/_import.erb b/app/views/imports/_import.erb
index 68a87dd1f..9c1ca1885 100644
--- a/app/views/imports/_import.erb
+++ b/app/views/imports/_import.erb
@@ -2,7 +2,8 @@
<div class="panel-heading">
<div class="panel-title clearfix">
<span class="pull-right">
- <%= link_to "#{import.datas.links[4].href}", :method => :delete, :data => {:confirm => t('import_tasks.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
+ <% location = import.datas.links.select { |link| link["rel"] == "location" }.first.href %>
+ <%= link_to "#{location}", :method => :delete, :data => {:confirm => t('import_tasks.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
<span class="fa fa-trash-o"></span>
<% end %>
</span>
diff --git a/app/views/validations/_validation.erb b/app/views/validations/_validation.erb
index 876002aee..d288c8b7e 100644
--- a/app/views/validations/_validation.erb
+++ b/app/views/validations/_validation.erb
@@ -1,8 +1,9 @@
<div id="index_item" class="panel panel-default">
<div class="panel-heading">
<div class="panel-title clearfix">
- <span class="pull-right">
- <%= link_to "#{validation.datas.links[4].href}", :method => :delete, :data => {:confirm => t('validation_tasks.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
+ <span class="pull-right">
+ <% location = validation.datas.links.select { |link| link["rel"] == "location" }.first.href %>
+ <%= link_to "#{location}", :method => :delete, :data => {:confirm => t('validation_tasks.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
<span class="fa fa-trash-o"></span>
<% end %>
</span>