diff options
Diffstat (limited to 'app')
31 files changed, 114 insertions, 47 deletions
diff --git a/app/assets/stylesheets/modules/devise.css.scss b/app/assets/stylesheets/modules/devise.css.scss index b4a1d2076..7a762b95f 100644 --- a/app/assets/stylesheets/modules/devise.css.scss +++ b/app/assets/stylesheets/modules/devise.css.scss @@ -14,14 +14,6 @@ #devise_middle{ min-height: 620px; padding: 30px 20px 0px 20px; - - #registrations_new{ - - .form-group{ - margin-bottom: 5px; - } - - } #sessions_new{ diff --git a/app/assets/stylesheets/vendor/openlayers_style.css b/app/assets/stylesheets/vendor/openlayers_style.css index 0e3a67108..25308996f 100644 --- a/app/assets/stylesheets/vendor/openlayers_style.css +++ b/app/assets/stylesheets/vendor/openlayers_style.css @@ -139,7 +139,7 @@ div.olControlMousePosition { } .olControlNavigationHistory { - background-image: url( image-path('/assets/openlayers/navigation_history.png') ); + background-image: url( image-path('openlayers/navigation_history.png') ); background-repeat: no-repeat; width: 24px; height: 24px; diff --git a/app/controllers/access_links_controller.rb b/app/controllers/access_links_controller.rb index b22dd75a8..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,5 +76,12 @@ class AccessLinksController < ChouetteController access_links end end + + + 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/api/v1/chouette_controller.rb b/app/controllers/api/v1/chouette_controller.rb index b8879cd3f..c1d626adf 100644 --- a/app/controllers/api/v1/chouette_controller.rb +++ b/app/controllers/api/v1/chouette_controller.rb @@ -17,7 +17,7 @@ private end end def switch_referential - Apartment::Database.switch(@api_key.referential.slug) + Apartment::Tenant.switch(@api_key.referential.slug) end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 04dd281d5..4359ee02e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,6 +2,7 @@ class ApplicationController < ActionController::Base protect_from_forgery before_filter :authenticate_user! before_filter :set_locale + helper LanguageEngine::Engine.helpers def set_locale I18n.locale = session[:language] || I18n.default_locale diff --git a/app/controllers/autocomplete_stop_areas_controller.rb b/app/controllers/autocomplete_stop_areas_controller.rb index 64a62efe5..2d4a07002 100644 --- a/app/controllers/autocomplete_stop_areas_controller.rb +++ b/app/controllers/autocomplete_stop_areas_controller.rb @@ -4,7 +4,7 @@ class AutocompleteStopAreasController < InheritedResources::Base before_filter :switch_referential def switch_referential - Apartment::Database.switch(referential.slug) + Apartment::Tenant.switch(referential.slug) end def referential diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb index df082d8cd..204a3d6c5 100644 --- a/app/controllers/chouette_controller.rb +++ b/app/controllers/chouette_controller.rb @@ -6,7 +6,7 @@ class ChouetteController < BreadcrumbController before_filter :switch_referential def switch_referential - Apartment::Database.switch(referential.slug) + Apartment::Tenant.switch(referential.slug) end def referential diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index 025c0fdee..1abaca9a8 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -35,4 +35,8 @@ class CompaniesController < ChouetteController referential_companies_path(referential) end + 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 9f08babf0..ca36a999f 100644 --- a/app/controllers/connection_links_controller.rb +++ b/app/controllers/connection_links_controller.rb @@ -52,4 +52,10 @@ class ConnectionLinksController < ChouetteController referential_connection_links_path(referential) end + 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/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 18e7ee28b..6f33fd0de 100644 --- a/app/controllers/journey_patterns_controller.rb +++ b/app/controllers/journey_patterns_controller.rb @@ -50,4 +50,8 @@ class JourneyPatternsController < ChouetteController @journey_patterns ||= @q.result(:distinct => true).order(:name) end + 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 25c4caaac..5dff116c2 100644 --- a/app/controllers/networks_controller.rb +++ b/app/controllers/networks_controller.rb @@ -40,4 +40,9 @@ class NetworksController < ChouetteController def collection_url referential_networks_path(referential) end + + 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/referentials_controller.rb b/app/controllers/referentials_controller.rb index 9cf4a5f62..643c780a4 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -25,18 +25,25 @@ class ReferentialsController < BreadcrumbController def resource @referential ||= current_organisation.referentials.find_by_id(params[:id]) end + def collection @referentials ||= current_organisation.referentials.order(:name) end + def build_resource super.tap do |referential| referential.user_id = current_user.id referential.user_name = current_user.name end end + def create_resource(referential) referential.organisation = current_organisation super end + def permitted_params + params.permit(referential: [ :name, :slug, :prefix, :time_zone, :upper_corner, :lower_corner, :organisation_id ]) + end + end diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index 6454ce068..9f9d66ba5 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -75,5 +75,11 @@ class RoutesController < ChouetteController end end + 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 + end diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index 6277b5814..9321ac9ae 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -133,4 +133,10 @@ class StopAreasController < ChouetteController end end + 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 be1738060..d64b752a0 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -87,4 +87,10 @@ class TimeTablesController < ChouetteController def collection_url referential_time_tables_path(referential) end + + 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 diff --git a/app/inputs/extended_time_picker_input.rb b/app/inputs/extended_time_picker_input.rb index 2298c0185..71628f128 100644 --- a/app/inputs/extended_time_picker_input.rb +++ b/app/inputs/extended_time_picker_input.rb @@ -3,7 +3,6 @@ class ExtendedTimePickerInput < Formtastic::Inputs::TimePickerInput def value return options[:input_html][:value] if options[:input_html] && options[:input_html].key?(:value) val = object.send(method) - puts val.to_s return "00:00:00" if val.is_a?(Date) return val.strftime("%H:%M:%S") if val.is_a?(Time) return "00:00:00" if val.nil? diff --git a/app/models/compliance_check_result.rb b/app/models/compliance_check_result.rb index 72cb4f13e..f34cf7911 100644 --- a/app/models/compliance_check_result.rb +++ b/app/models/compliance_check_result.rb @@ -7,7 +7,7 @@ class ComplianceCheckResult < ActiveRecord::Base scope :nok, -> { where status: 'nok' } scope :na, -> { where status: 'na' } - attr_accessible :violation_count + #attr_accessible :violation_count belongs_to :compliance_check_task validates_presence_of :rule_code diff --git a/app/models/compliance_check_task.rb b/app/models/compliance_check_task.rb index 1808a792c..ef35fcbdc 100644 --- a/app/models/compliance_check_task.rb +++ b/app/models/compliance_check_task.rb @@ -10,7 +10,7 @@ class ComplianceCheckTask < ActiveRecord::Base validates_presence_of :user_name validates_inclusion_of :status, :in => %w{ pending processing completed failed } - has_many :compliance_check_results, :order => [ :severity , :status ] + has_many :compliance_check_results, -> { order([ :severity , :status ]) } serialize :parameter_set, JSON diff --git a/app/models/export.rb b/app/models/export.rb index 4d7b5c56c..99e499c2d 100644 --- a/app/models/export.rb +++ b/app/models/export.rb @@ -5,7 +5,7 @@ class Export < ActiveRecord::Base validates_inclusion_of :status, :in => %w{ pending processing completed failed } - has_many :log_messages, :class_name => "ExportLogMessage", :order => :position, :dependent => :delete_all + has_many :log_messages, -> { order('position ASC') }, :class_name => "ExportLogMessage", :dependent => :delete_all serialize :options diff --git a/app/models/referential.rb b/app/models/referential.rb index 063e7436c..be6e3a3ad 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -50,43 +50,43 @@ class Referential < ActiveRecord::Base end def lines - Chouette::Line.scoped + Chouette::Line.all end def networks - Chouette::Network.scoped + Chouette::Network.all end def group_of_lines - Chouette::GroupOfLine.scoped + Chouette::GroupOfLine.all end def companies - Chouette::Company.scoped + Chouette::Company.all end def stop_areas - Chouette::StopArea.scoped + Chouette::StopArea.all end def access_points - Chouette::AccessPoint.scoped + Chouette::AccessPoint.all end def access_links - Chouette::AccessLink.scoped + Chouette::AccessLink.all end def time_tables - Chouette::TimeTable.scoped + Chouette::TimeTable.all end def connection_links - Chouette::ConnectionLink.scoped + Chouette::ConnectionLink.all end def vehicle_journeys - Chouette::VehicleJourney.scoped + Chouette::VehicleJourney.all end after_initialize :define_default_attributes @@ -97,7 +97,7 @@ class Referential < ActiveRecord::Base def switch raise "Referential not created" if new_record? - Apartment::Database.switch(slug) + Apartment::Tenant.switch(slug) self end @@ -139,12 +139,12 @@ class Referential < ActiveRecord::Base before_create :create_schema def create_schema - Apartment::Database.create slug + Apartment::Tenant.create slug end before_destroy :destroy_schema def destroy_schema - Apartment::Database.drop slug + Apartment::Tenant.drop slug end after_create :add_rule_parameter_set @@ -204,7 +204,7 @@ Rails.application.config.after_initialize do # add referential relationship for objectid and localization functions def referential - @referential ||= Referential.where(:slug => Apartment::Database.current_database).first! + @referential ||= Referential.where(:slug => Apartment::Tenant.current_tenant).first! end # override prefix for good prefix in objectid generation @@ -233,7 +233,6 @@ Rails.application.config.after_initialize do Chouette::StopArea class Chouette::StopArea - include NinoxeExtension::ProjectionFields # override default_position method to add referential envelope when no stoparea is positioned diff --git a/app/models/rule_parameter_set.rb b/app/models/rule_parameter_set.rb index 0c7a98300..b8c5a2f8f 100644 --- a/app/models/rule_parameter_set.rb +++ b/app/models/rule_parameter_set.rb @@ -6,7 +6,7 @@ class RuleParameterSet < ActiveRecord::Base serialize :parameters, JSON - attr_accessible :name, :referential_id + #attr_accessible :name, :referential_id def self.mode_attribute_prefixes %w( allowed_transport inter_stop_area_distance_min inter_stop_area_distance_max speed_max speed_min inter_stop_duration_variation_max) @@ -39,7 +39,7 @@ class RuleParameterSet < ActiveRecord::Base def self.mode_parameter(name) name = name.to_s - attr_accessible name + #attr_accessible name define_method(name) do attribute_name, mode = RuleParameterSet.attribute_of_mode_attribute( name), RuleParameterSet.mode_of_mode_attribute( name) @@ -54,7 +54,7 @@ class RuleParameterSet < ActiveRecord::Base end def self.parameter(name) name = name.to_s - attr_accessible name + #attr_accessible name define_method(name) do self.parameters and self.parameters[name] diff --git a/app/models/user.rb b/app/models/user.rb index 6c14b93fb..e37ff62d5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,7 +6,7 @@ class User < ActiveRecord::Base :confirmable, :invitable # Setup accessible (or protected) attributes for your model - attr_accessible :email, :password, :current_password, :password_confirmation, :remember_me, :name, :organisation_attributes + # attr_accessible :email, :password, :current_password, :password_confirmation, :remember_me, :name, :organisation_attributes belongs_to :organisation diff --git a/app/models/vehicle_translation.rb b/app/models/vehicle_translation.rb index f89c127ab..76d679c30 100644 --- a/app/models/vehicle_translation.rb +++ b/app/models/vehicle_translation.rb @@ -5,7 +5,6 @@ class VehicleTranslation attr_accessor :vehicle_journey_id, :count, :duration attr_accessor :first_stop_time, :departure_or_arrival - attr_accessor :delta validates_presence_of :count, :duration, :first_stop_time, :departure_or_arrival validates_inclusion_of :departure_or_arrival, :in => %w( departure arrival) @@ -75,6 +74,7 @@ class VehicleTranslation vehicle_journey.vehicle_journey_at_stops.each do |vjas| vjas_attributes = vjas.attributes.merge( "vehicle_journey_id" => translated.id) + vjas_attributes.delete( "id" ) vjas_attributes.merge! "departure_time" => ( vjas_attributes[ "departure_time"] + delta), "arrival_time" => ( vjas_attributes[ "arrival_time"] + delta) diff --git a/app/views/companies/_companies.erb b/app/views/companies/_companies.erb index fb36a86af..9464f0c1a 100644 --- a/app/views/companies/_companies.erb +++ b/app/views/companies/_companies.erb @@ -1,9 +1,9 @@ <div class="page_info"> - <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @companies %> + <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info( @companies ) %> </div> <div class="companies paginated_content"> - <%= paginated_content(@companies) %> + <%= paginated_content(@companies) %> </div> <div class="pagination"> <%= will_paginate @companies, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %> -</div> +</div>
\ No newline at end of file diff --git a/app/views/companies/index.html.erb b/app/views/companies/index.html.erb index c28eaa8bc..ec6ffbeb2 100644 --- a/app/views/companies/index.html.erb +++ b/app/views/companies/index.html.erb @@ -16,7 +16,7 @@ </div> <% end %> -<div id="companies"><%= render 'companies' %></div> +<div id="companies"><%= render partial: "companies", object: @companies %></div> <% content_for :sidebar do %> <ul class="actions"> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 9334bab35..bac1ad2f5 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -11,7 +11,7 @@ <div class="col-md-4 login"> <div class="panel panel-default"> <div class="panel-body"> - <%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :wrapper => "form_without_label" ) do |form| %> + <%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :wrapper => "form_without_label", :form_class => 'session_new' ) do |form| %> <%= form.input :email, :label => false, :placeholder => t("helpers.label.user.email"), input_html: { :class => "form-control" } %> <div class="row"> <div class="col-md-6"> @@ -39,7 +39,7 @@ <div class="panel panel-default"> <div class="panel-heading"><%= t("devise.registrations.new.title") %></div> <div class="panel-body"> - <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :wrapper => "form_without_label" ) do |form| %> + <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :wrapper => "form_without_label", input_html: { class: "registration_new" } ) do |form| %> <%= form.simple_fields_for :organisation, Organisation.new do |organisation| %> <%= organisation.input :name, :label => false, :placeholder => t("helpers.label.user.organisation_name"), input_html: { :class => "form-control" } %> <% end %> diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 387221103..b8dea72e8 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -18,7 +18,7 @@ </div> <div style="color: #333333; text-align:center; font-size: 10px;"> - Envoyé par <%= link_to root_url, "Chouette" %> + Envoyé par <%= link_to unauthenticated_root_url, "Chouette" %> </div> </body> </html> |
