aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/access_links_controller.rb13
-rw-r--r--app/controllers/access_points_controller.rb7
-rw-r--r--app/controllers/autocomplete_time_tables_controller.rb33
-rw-r--r--app/controllers/companies_controller.rb4
-rw-r--r--app/controllers/connection_links_controller.rb6
-rw-r--r--app/controllers/exports_controller.rb4
-rw-r--r--app/controllers/group_of_lines_controller.rb9
-rw-r--r--app/controllers/journey_patterns_controller.rb4
-rw-r--r--app/controllers/lines_controller.rb6
-rw-r--r--app/controllers/networks_controller.rb4
-rw-r--r--app/controllers/organisations_controller.rb5
-rw-r--r--app/controllers/routes_controller.rb4
-rw-r--r--app/controllers/stop_areas_controller.rb6
-rw-r--r--app/controllers/time_tables_controller.rb6
14 files changed, 90 insertions, 21 deletions
diff --git a/app/controllers/access_links_controller.rb b/app/controllers/access_links_controller.rb
index 2a9189eaa..36063ced5 100644
--- a/app/controllers/access_links_controller.rb
+++ b/app/controllers/access_links_controller.rb
@@ -61,14 +61,12 @@ class AccessLinksController < ChouetteController
build_breadcrumb :edit
end
end
+
+
protected
alias_method :access_link, :resource
-# def map
-# @map = AccessLinkMap.new(access_link).with_helpers(self)
-# end
-
def collection
@q = parent.access_links.search(params[:q])
@access_links ||=
@@ -78,9 +76,12 @@ class AccessLinksController < ChouetteController
access_links
end
end
+
- def permitted_params
- params.permit(company: [ :id, :access_link_type,:access_point_id, :stop_area_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation, :link_orientation_type, :stop_area ])
+ private
+
+ def access_link_params
+ params.require(:access_link).permit( :access_link_type,:access_point_id, :stop_area_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation, :link_orientation_type, :stop_area )
end
end
diff --git a/app/controllers/access_points_controller.rb b/app/controllers/access_points_controller.rb
index ca8e0b156..534b0c835 100644
--- a/app/controllers/access_points_controller.rb
+++ b/app/controllers/access_points_controller.rb
@@ -62,4 +62,11 @@ class AccessPointsController < ChouetteController
end
end
+
+ private
+
+ def access_point_params
+ params.require(:access_point).permit( :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :openning_time, :closing_time, :access_type, :access_point_type, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :stop_area_id, :coordinates )
+ end
+
end
diff --git a/app/controllers/autocomplete_time_tables_controller.rb b/app/controllers/autocomplete_time_tables_controller.rb
new file mode 100644
index 000000000..c556bb71c
--- /dev/null
+++ b/app/controllers/autocomplete_time_tables_controller.rb
@@ -0,0 +1,33 @@
+class AutocompleteTimeTablesController < InheritedResources::Base
+ respond_to :json, :only => [:index]
+
+ before_filter :switch_referential
+
+ def switch_referential
+ Apartment::Database.switch(referential.slug)
+ end
+
+ def referential
+ @referential ||= current_organisation.referentials.find params[:referential_id]
+ end
+
+ protected
+
+ def select_time_tables
+ if params[:route_id]
+ referential.time_tables.joins( vehicle_journeys: :route).where( "routes.id IN (#{params[:route_id]})")
+ else
+ referential.time_tables
+ end
+ end
+
+ def referential_time_tables
+ @referential_time_tables ||= select_time_tables
+ end
+
+ def collection
+ comment_selection = referential_time_tables.select{ |p| p.comment =~ /#{params[:q]}/i }
+ tag_selection = referential_time_tables.tagged_with( params[:q], :wild => true)
+ @time_tables = (comment_selection + tag_selection).uniq
+ end
+end
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb
index 90d0c2530..1abaca9a8 100644
--- a/app/controllers/companies_controller.rb
+++ b/app/controllers/companies_controller.rb
@@ -35,8 +35,8 @@ class CompaniesController < ChouetteController
referential_companies_path(referential)
end
- def permitted_params
- params.permit(company: [ :objectid, :object_version, :creation_time, :creator_id, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone ])
+ def company_params
+ params.require(:company).permit( :objectid, :object_version, :creation_time, :creator_id, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone )
end
end
diff --git a/app/controllers/connection_links_controller.rb b/app/controllers/connection_links_controller.rb
index a8e0c19a6..ca36a999f 100644
--- a/app/controllers/connection_links_controller.rb
+++ b/app/controllers/connection_links_controller.rb
@@ -52,8 +52,10 @@ class ConnectionLinksController < ChouetteController
referential_connection_links_path(referential)
end
- def permitted_params
- params.permit(connection_link: [ :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs ])
+ private
+
+ def connection_link_params
+ params.require(:connection_link).permit( :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs )
end
end
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb
index e8c140dd7..bb9cff197 100644
--- a/app/controllers/exports_controller.rb
+++ b/app/controllers/exports_controller.rb
@@ -14,8 +14,8 @@ class ExportsController < ChouetteController
end
def create
- if (params[:export][:type] == "HubExport") && Chouette::VehicleJourneyAtStop.all.count > 50000
- flash[:notice] = I18n.t("formtastic.titles.export.vjas.size", size: Chouette::VehicleJourneyAtStop.all.count)
+ if (params[:export][:type] == "HubExport") && Chouette::VehicleJourneyAtStop.count > 50000
+ flash[:notice] = I18n.t("formtastic.titles.export.vjas.size", size: Chouette::VehicleJourneyAtStop.count)
redirect_to new_referential_export_path(@referential)
elsif (params[:export][:type] == "HubExport") && (params[:export][:start_date].empty? || params[:export][:end_date].empty?)
flash[:notice] = I18n.t("formtastic.titles.export.dates.not_nul")
diff --git a/app/controllers/group_of_lines_controller.rb b/app/controllers/group_of_lines_controller.rb
index 3b91f8dd6..78d3f64c0 100644
--- a/app/controllers/group_of_lines_controller.rb
+++ b/app/controllers/group_of_lines_controller.rb
@@ -34,6 +34,7 @@ class GroupOfLinesController < ChouetteController
end
end
+
protected
def filtered_group_of_lines_maps
@@ -58,4 +59,12 @@ class GroupOfLinesController < ChouetteController
def collection_url
referential_group_of_lines_path(referential)
end
+
+
+ private
+
+ def group_of_line_params
+ params.require(:group_of_line).permit( :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :lines, :registration_number, :line_tokens)
+ end
+
end
diff --git a/app/controllers/journey_patterns_controller.rb b/app/controllers/journey_patterns_controller.rb
index 907d1e63d..6f33fd0de 100644
--- a/app/controllers/journey_patterns_controller.rb
+++ b/app/controllers/journey_patterns_controller.rb
@@ -50,8 +50,8 @@ class JourneyPatternsController < ChouetteController
@journey_patterns ||= @q.result(:distinct => true).order(:name)
end
- def permitted_params
- params.permit(journey_pattern: [ :route_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :registration_number, :published_name, :departure_stop_point_id, :arrival_stop_point_id, :stop_point_ids, :stop_points ])
+ def journey_pattern_params
+ params.require(journey_pattern).permit( :route_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :registration_number, :published_name, :departure_stop_point_id, :arrival_stop_point_id, :stop_point_ids, :stop_points )
end
end
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb
index aee3f8c67..be4ca6547 100644
--- a/app/controllers/lines_controller.rb
+++ b/app/controllers/lines_controller.rb
@@ -81,4 +81,10 @@ class LinesController < ChouetteController
@lines ||= @q.result(:distinct => true).order(:number).paginate(:page => params[:page]).includes([:network, :company])
end
+ 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)
+ end
+
end
diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb
index 618bb83e6..5dff116c2 100644
--- a/app/controllers/networks_controller.rb
+++ b/app/controllers/networks_controller.rb
@@ -41,8 +41,8 @@ class NetworksController < ChouetteController
referential_networks_path(referential)
end
- def permitted_params
- params.permit(network: [ :objectid, :object_version, :creation_time, :creator_id, :version_date, :description, :name, :registration_number, :source_name, :source_type, :source_identifier, :comment ])
+ def network_params
+ params.require(:network).permit(:objectid, :object_version, :creation_time, :creator_id, :version_date, :description, :name, :registration_number, :source_name, :source_type, :source_identifier, :comment )
end
end
diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb
index 9faea18a5..026892613 100644
--- a/app/controllers/organisations_controller.rb
+++ b/app/controllers/organisations_controller.rb
@@ -14,5 +14,10 @@ class OrganisationsController < BreadcrumbController
def resource
@organisation = current_organisation
end
+
+ def organisation_params
+ params.require(:organisation).permit(:name)
+ end
+
end
diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb
index c74b0ade8..9f9d66ba5 100644
--- a/app/controllers/routes_controller.rb
+++ b/app/controllers/routes_controller.rb
@@ -75,7 +75,9 @@ class RoutesController < ChouetteController
end
end
- def permitted_params
+ private
+
+ def route_params
params.require(:route).permit( :direction_code, :wayback_code, :line_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :opposite_route_id, :published_name, :number, :direction, :wayback, { stop_points_attributes: [ :id, :_destroy, :position, :stop_area_id ] } )
end
diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb
index 0b816ca45..9321ac9ae 100644
--- a/app/controllers/stop_areas_controller.rb
+++ b/app/controllers/stop_areas_controller.rb
@@ -133,8 +133,10 @@ class StopAreasController < ChouetteController
end
end
- def permitted_params
- params.permit(stop_area: [ :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone ])
+ private
+
+ def stop_area_params
+ params.require(:stop_area).permit( :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone )
end
end
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index 52493987a..d64b752a0 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -88,7 +88,9 @@ class TimeTablesController < ChouetteController
referential_time_tables_path(referential)
end
- def permitted_params
- params.permit(time_table: [ :objectid, :object_version, :creation_time, :creator_id, :version, :comment, :int_day_types, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday, :start_date, :end_date, :dates_attributes, :periods_attributes, :tag_list, :tag_search ] )
+ private
+
+ def time_table_params
+ params.require(:time_table).permit( :objectid, :object_version, :creation_time, :creator_id, :version, :comment, :int_day_types, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday, :start_date, :end_date, :dates_attributes, :periods_attributes, :tag_list, :tag_search )
end
end