diff options
49 files changed, 194 insertions, 131 deletions
| diff --git a/app/assets/javascripts/exports/index.js.coffee b/app/assets/javascripts/exports/index.js.coffee index 0f6c524dc..655819507 100644 --- a/app/assets/javascripts/exports/index.js.coffee +++ b/app/assets/javascripts/exports/index.js.coffee @@ -1,5 +1 @@ -$(".exports.index").ready -> -  $(".progress-bar.failed").addClass("progress-bar-danger").prepend("100%") -  $(".progress-bar.pending").addClass("progress-bar-info").prepend("10%") -  $(".progress-bar.processing").addClass("progress-bar-info").prepend("50%") -  $(".progress-bar.completed").addClass("progress-bar-success").prepend("100%")
\ No newline at end of file +$(".exports.index").ready ->
\ No newline at end of file diff --git a/app/assets/javascripts/import_tasks/index.js.coffee b/app/assets/javascripts/import_tasks/index.js.coffee index bb3b3c9fb..8966a2960 100644 --- a/app/assets/javascripts/import_tasks/index.js.coffee +++ b/app/assets/javascripts/import_tasks/index.js.coffee @@ -1,5 +1 @@ -$(".import_tasks.index").ready -> -  $(".progress-bar.failed").addClass("progress-bar-danger").prepend("100%") -  $(".progress-bar.pending").addClass("progress-bar-info").prepend("10%") -  $(".progress-bar.processing").addClass("progress-bar-info").prepend("50%") -  $(".progress-bar.completed").addClass("progress-bar-success").prepend("100%")
\ No newline at end of file +$(".import_tasks.index").ready ->
\ No newline at end of file diff --git a/app/assets/stylesheets/main/help.css.scss b/app/assets/stylesheets/main/help.css.scss index a3950858c..b815f511f 100644 --- a/app/assets/stylesheets/main/help.css.scss +++ b/app/assets/stylesheets/main/help.css.scss @@ -1,18 +1,4 @@  #workspace.help { -h2 { -    font-size: 17px; -} - -h3 { -    font-size: 15px; -} - -h4 { -    text-decoration: underline; -    font-weight: bold; -    padding: 7px 0; -    font-size: 14px; -}  ul li {      list-style: circle; diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 91e8088de..7d4c3409d 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -1,4 +1,11 @@ -class HelpController < ApplicationController +class HelpController < ActionController::Base +  layout "application" +  protect_from_forgery +  before_filter :set_locale + +  def set_locale +    I18n.locale = session[:language] || I18n.default_locale +  end    def show      @page = HelpPage.find(slug) diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb new file mode 100644 index 000000000..f0ac420ce --- /dev/null +++ b/app/controllers/registrations_controller.rb @@ -0,0 +1,17 @@ + class RegistrationsController < Devise::RegistrationsController + +   prepend_before_filter :accept_user_creation, :only => [:new, :create] + +   private + +   def accept_user_creation +     puts "J'y passe" +     if !Rails.application.config.accept_user_creation +       redirect_to root_path +       return false +     else +       return true +     end +   end +    + end diff --git a/app/exporters/chouette/hub/city_code_exporter.rb b/app/exporters/chouette/hub/city_code_exporter.rb index 07afa9cf5..1279313eb 100644 --- a/app/exporters/chouette/hub/city_code_exporter.rb +++ b/app/exporters/chouette/hub/city_code_exporter.rb @@ -27,7 +27,7 @@ class Chouette::Hub::CityCodeExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("COMMUNES\u000D\u000A") if f.size == 0        f.write(render)      end diff --git a/app/exporters/chouette/hub/commercial_stop_area_exporter.rb b/app/exporters/chouette/hub/commercial_stop_area_exporter.rb index bd1ee27cf..da134a08f 100644 --- a/app/exporters/chouette/hub/commercial_stop_area_exporter.rb +++ b/app/exporters/chouette/hub/commercial_stop_area_exporter.rb @@ -27,7 +27,7 @@ class Chouette::Hub::CommercialStopAreaExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("ARRET\u000D\u000A") if f.size == 0        f.write(render)      end if stop_area.present? diff --git a/app/exporters/chouette/hub/company_exporter.rb b/app/exporters/chouette/hub/company_exporter.rb index 830e5bf96..142853b22 100644 --- a/app/exporters/chouette/hub/company_exporter.rb +++ b/app/exporters/chouette/hub/company_exporter.rb @@ -26,7 +26,7 @@ class Chouette::Hub::CompanyExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("TRANSPORTEUR\u000D\u000A") if f.size == 0        f.write(render)      end if company.present? diff --git a/app/exporters/chouette/hub/connection_link_exporter.rb b/app/exporters/chouette/hub/connection_link_exporter.rb index fec8838a9..0db286434 100644 --- a/app/exporters/chouette/hub/connection_link_exporter.rb +++ b/app/exporters/chouette/hub/connection_link_exporter.rb @@ -31,7 +31,7 @@ class Chouette::Hub::ConnectionLinkExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("CORRESPONDANCE\u000D\u000A") if f.size == 0        f.write(render) if (connection_link.present? && connection_link.link_distance.present?)      end diff --git a/app/exporters/chouette/hub/direction_exporter.rb b/app/exporters/chouette/hub/direction_exporter.rb index a3f04d141..03c4c8c85 100644 --- a/app/exporters/chouette/hub/direction_exporter.rb +++ b/app/exporters/chouette/hub/direction_exporter.rb @@ -6,8 +6,8 @@ class Chouette::Hub::DirectionExporter      @journey_pattern = journey_pattern      @directory = directory      @template = File.open('app/views/api/hub/directions.hub.erb' ){ |f| f.read } -    @arrival_stop_point = Chouette::StopPoint.find(@journey_pattern.arrival_stop_point_id) if @journey_pattern.arrival_stop_point_id -    @direction = Chouette::StopArea.find(@arrival_stop_point.stop_area_id) if @arrival_stop_point +    #@arrival_stop_point = Chouette::StopPoint.find(@journey_pattern.arrival_stop_point_id) if @journey_pattern.arrival_stop_point_id +    #@direction = Chouette::StopArea.find(@arrival_stop_point.stop_area_id) if @arrival_stop_point      route = Chouette::Route.find(@journey_pattern.route_id) if @journey_pattern.route_id      @line = Chouette::Line.find(route.line_id) if route    end @@ -30,7 +30,7 @@ class Chouette::Hub::DirectionExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("DIRECTION\u000D\u000A") if f.size == 0        f.write(render)      end if journey_pattern.present? diff --git a/app/exporters/chouette/hub/group_of_lines_exporter.rb b/app/exporters/chouette/hub/group_of_lines_exporter.rb index 8113bfd60..2b07d7c4d 100644 --- a/app/exporters/chouette/hub/group_of_lines_exporter.rb +++ b/app/exporters/chouette/hub/group_of_lines_exporter.rb @@ -26,7 +26,7 @@ class Chouette::Hub::GroupOfLinesExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("GROUPELIGNE\u000D\u000A") if f.size == 0        f.write(render)      end if group_of_lines.present? diff --git a/app/exporters/chouette/hub/journey_pattern_exporter.rb b/app/exporters/chouette/hub/journey_pattern_exporter.rb index af7e27eef..97cbab41d 100644 --- a/app/exporters/chouette/hub/journey_pattern_exporter.rb +++ b/app/exporters/chouette/hub/journey_pattern_exporter.rb @@ -40,7 +40,7 @@ class Chouette::Hub::JourneyPatternExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("CHEMIN\u000D\u000A") if f.size == 0        f.write(render)      end if journey_pattern.present? diff --git a/app/exporters/chouette/hub/line_exporter.rb b/app/exporters/chouette/hub/line_exporter.rb index be2f52060..622f7a924 100644 --- a/app/exporters/chouette/hub/line_exporter.rb +++ b/app/exporters/chouette/hub/line_exporter.rb @@ -31,7 +31,7 @@ class Chouette::Hub::LineExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("LIGNE\u000D\u000A") if f.size == 0        f.write(render)      end if line.present? diff --git a/app/exporters/chouette/hub/network_exporter.rb b/app/exporters/chouette/hub/network_exporter.rb index 584c3770b..fc77a84fc 100644 --- a/app/exporters/chouette/hub/network_exporter.rb +++ b/app/exporters/chouette/hub/network_exporter.rb @@ -26,7 +26,7 @@ class Chouette::Hub::NetworkExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("RESEAU\u000D\u000A") if f.size == 0        f.write(render)      end if network.present? diff --git a/app/exporters/chouette/hub/physical_stop_area_exporter.rb b/app/exporters/chouette/hub/physical_stop_area_exporter.rb index 3086bb850..a8d992735 100644 --- a/app/exporters/chouette/hub/physical_stop_area_exporter.rb +++ b/app/exporters/chouette/hub/physical_stop_area_exporter.rb @@ -38,7 +38,7 @@ class Chouette::Hub::PhysicalStopAreaExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("ARRET\u000D\u000A") if f.size == 0        f.write(render)      end if stop_area.present? diff --git a/app/exporters/chouette/hub/route_exporter.rb b/app/exporters/chouette/hub/route_exporter.rb index e4e6579ce..e94780329 100644 --- a/app/exporters/chouette/hub/route_exporter.rb +++ b/app/exporters/chouette/hub/route_exporter.rb @@ -35,7 +35,7 @@ class Chouette::Hub::RouteExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("SCHEMA\u000D\u000A") if f.size == 0        f.write(render)      end if route.present? diff --git a/app/exporters/chouette/hub/time_table_exporter.rb b/app/exporters/chouette/hub/time_table_exporter.rb index 8620a38dd..2553128cd 100644 --- a/app/exporters/chouette/hub/time_table_exporter.rb +++ b/app/exporters/chouette/hub/time_table_exporter.rb @@ -40,7 +40,7 @@ class Chouette::Hub::TimeTableExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("PERIODE\u000D\u000A") if f.size == 0        f.write(render)      end if time_table.present? diff --git a/app/exporters/chouette/hub/transport_mode_exporter.rb b/app/exporters/chouette/hub/transport_mode_exporter.rb index af9a2357a..46d116eec 100644 --- a/app/exporters/chouette/hub/transport_mode_exporter.rb +++ b/app/exporters/chouette/hub/transport_mode_exporter.rb @@ -27,7 +27,7 @@ class Chouette::Hub::TransportModeExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("MODETRANSPORT\u000D\u000A") if f.size == 0        f.write(render)      end diff --git a/app/exporters/chouette/hub/vehicle_journey_at_stop_exporter.rb b/app/exporters/chouette/hub/vehicle_journey_at_stop_exporter.rb index ede411463..1c4b4c620 100644 --- a/app/exporters/chouette/hub/vehicle_journey_at_stop_exporter.rb +++ b/app/exporters/chouette/hub/vehicle_journey_at_stop_exporter.rb @@ -12,9 +12,12 @@ class Chouette::Hub::VehicleJourneyAtStopExporter      stop_area = stop_point.stop_area      @stop_area_code = stop_area.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if stop_area      @stop_area_id = stop_area.registration_number if stop_area -    @arrival_time = @vehicle_journey_at_stop.arrival_time.sec + 60 * @vehicle_journey_at_stop.arrival_time.min + 60 * 60 * @vehicle_journey_at_stop.arrival_time.hour +    #Time.zone = ActiveSupport::TimeZone.new('Atlantic/Azores') +    arrival_time = @vehicle_journey_at_stop.arrival_time +    @arrival_time = arrival_time.sec + 60 * arrival_time.min + 60 * 60 * arrival_time.hour if arrival_time      @arrival_type = "A" -    @departure_time = @vehicle_journey_at_stop.departure_time.sec + 60 *  @vehicle_journey_at_stop.departure_time.min + 60 * 60 *  @vehicle_journey_at_stop.departure_time.hour +    departure_time = @vehicle_journey_at_stop.departure_time +    @departure_time = departure_time.sec + 60 *  departure_time.min + 60 * 60 *  departure_time.hour if departure_time      @departure_type = "D"    end @@ -46,7 +49,7 @@ class Chouette::Hub::VehicleJourneyAtStopExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("HORAIRE\u000D\u000A") if f.size == 0        f.write(render)      end if vehicle_journey_at_stop.present? diff --git a/app/exporters/chouette/hub/vehicle_journey_exporter.rb b/app/exporters/chouette/hub/vehicle_journey_exporter.rb index 65c507ce4..e1d7fce58 100644 --- a/app/exporters/chouette/hub/vehicle_journey_exporter.rb +++ b/app/exporters/chouette/hub/vehicle_journey_exporter.rb @@ -14,8 +14,13 @@ class Chouette::Hub::VehicleJourneyExporter      @departure_stop_area =  Chouette::StopArea.find(@departure_stop_point.stop_area_id)      @arrival_stop_point = Chouette::StopPoint.find(@journey_pattern.arrival_stop_point_id)      @arrival_stop_area = Chouette::StopArea.find(@arrival_stop_point.stop_area_id) -    departure_time = Chouette::VehicleJourneyAtStop.where( :vehicle_journey_id => @vehicle_journey.id ).where( :stop_point_id => @departure_stop_point.id )[0].departure_time + +    #Time.zone = ActiveSupport::TimeZone.new('Atlantic/Azores') +    departure_time = Chouette::VehicleJourneyAtStop.where( :vehicle_journey_id => @vehicle_journey.id ).where( :stop_point_id => @departure_stop_point.id )[0].departure_time  +    # Time.zone.parse(Chouette::VehicleJourneyAtStop.where( :vehicle_journey_id => @vehicle_journey.id ).where( :stop_point_id => @departure_stop_point.id )[0].departure_time.to_s)      arrival_time = Chouette::VehicleJourneyAtStop.where( :vehicle_journey_id => @vehicle_journey.id ).where( :stop_point_id => @arrival_stop_point.id )[0].arrival_time +    #Time.zone.parse(Chouette::VehicleJourneyAtStop.where( :vehicle_journey_id => @vehicle_journey.id ).where( :stop_point_id => @arrival_stop_point.id )[0].arrival_time.to_s) +          @departure_time_sec = departure_time.sec + ( departure_time.min + departure_time.hour * 60 ) * 60      @arrival_time_sec = arrival_time.sec + ( arrival_time.min + arrival_time.hour * 60 ) * 60      @validity = 0 @@ -35,7 +40,7 @@ class Chouette::Hub::VehicleJourneyExporter      if @vehicle_journey.mobility_restricted_suitability        @renvoi = "1"      end -    File.open(directory + "/RENVOI.TXT" , "a") do |f| +    File.open(directory + "/RENVOI.TXT" , "a:ISO_8859_1") do |f|        if f.size == 0          f.write("RENVOI\u000D\u000A")           f.write("a;PMR;1\u000D\u000A") @@ -61,7 +66,7 @@ class Chouette::Hub::VehicleJourneyExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("COURSE\u000D\u000A") if f.size == 0        f.write(render)      end if vehicle_journey.present? diff --git a/app/exporters/chouette/hub/vehicle_journey_operation_exporter.rb b/app/exporters/chouette/hub/vehicle_journey_operation_exporter.rb index 7f1e52245..533f0628e 100644 --- a/app/exporters/chouette/hub/vehicle_journey_operation_exporter.rb +++ b/app/exporters/chouette/hub/vehicle_journey_operation_exporter.rb @@ -91,7 +91,7 @@ class Chouette::Hub::VehicleJourneyOperationExporter    end    def save -    File.open(directory + hub_name , "a") do |f| +    File.open(directory + hub_name , "a:ISO_8859_1") do |f|        f.write("COURSE_OPERATION\u000D\u000A") if f.size == 0        f.write(render)      end if vehicle_journey.present? diff --git a/app/helpers/exports_helper.rb b/app/helpers/exports_helper.rb index 9be7a5e46..d9b975297 100644 --- a/app/helpers/exports_helper.rb +++ b/app/helpers/exports_helper.rb @@ -16,4 +16,31 @@ module ExportsHelper    include TypeIdsModelsHelper +  def export_progress_bar_tag(export) +     +    if export.status == "failed" +      div_class = "progress-bar progress-bar-danger" +      percentage_progress = "100" +    elsif export.status == "pending" +      div_class = "progress-bar progress-bar-info" +      percentage_progress = "10" +    elsif export.status == "processing" +      div_class = "progress-bar progress-bar-info" +      percentage_progress = "50" +    elsif export.status == "completed" +      div_class = "progress-bar progress-bar-success" +      percentage_progress = "100" +    else +      div_class = "" +      percentage_progress = "" +    end   + +    content_tag :div, :class => "progress" do +      content_tag :div, :class => div_class, role: "progressbar", :'aria-valuenow' => percentage_progress, :'aria-valuemin' => "0", :'aria-valuemax' => "100", :style => "width: #{percentage_progress}%;" do +        percentage_progress + "% " + I18n.t("exports.statuses.#{export.status}") +      end +    end +     +  end +    end diff --git a/app/helpers/imports_helper.rb b/app/helpers/imports_helper.rb index 7f58b229e..fbb9c13df 100644 --- a/app/helpers/imports_helper.rb +++ b/app/helpers/imports_helper.rb @@ -26,4 +26,31 @@ module ImportsHelper      end    end +  def import_progress_bar_tag(export) +       +    if export.status == "failed" +      div_class = "progress-bar progress-bar-danger" +      percentage_progress = "100" +    elsif export.status == "pending" +      div_class = "progress-bar progress-bar-info" +      percentage_progress = "10" +    elsif export.status == "processing" +      div_class = "progress-bar progress-bar-info" +      percentage_progress = "50" +    elsif export.status == "completed" +      div_class = "progress-bar progress-bar-success" +      percentage_progress = "100" +    else +      div_class = "" +      percentage_progress = "" +    end   + +    content_tag :div, :class => "progress" do +      content_tag :div, :class => div_class, role: "progressbar", :'aria-valuenow' => percentage_progress, :'aria-valuemin' => "0", :'aria-valuemax' => "100", :style => "width: #{percentage_progress}%;" do +        percentage_progress + "% " + I18n.t("exports.statuses.#{export.status}") +      end +    end +     +  end +  end diff --git a/app/models/user.rb b/app/models/user.rb index ae6cceeee..1889a3bf0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,9 +6,11 @@ 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 +  attr_accessible :email, :password, :current_password, :password_confirmation, :remember_me, :name, :organisation_attributes    belongs_to :organisation + +  accepts_nested_attributes_for :organisation    validates_presence_of :email    validates_presence_of :name diff --git a/app/views/api/hub/arrets_generiques.hub.erb b/app/views/api/hub/arrets_generiques.hub.erb index b540130f9..00f041552 100644 --- a/app/views/api/hub/arrets_generiques.hub.erb +++ b/app/views/api/hub/arrets_generiques.hub.erb @@ -1 +1 @@ -<%= @stop_area.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @stop_area.objectid %>;<%= @stop_area.name if @stop_area.name %>;<%= @stop_area.nearest_topic_name if @stop_area.nearest_topic_name %>;<%= @type %>;;<%= (@stop_area.latitude && @stop_area.longitude) ? RGeo::CoordSys::Proj4::transform_coords(@from_projection, @to_projection, @stop_area.longitude, @stop_area.latitude)[0].to_i : '' %>;<%=  (@stop_area.latitude && @stop_area.longitude) ? RGeo::CoordSys::Proj4::transform_coords(@from_projection, @to_projection, @stop_area.longitude, @stop_area.latitude)[1].to_i : '' %>;<%= @stop_area.city_name if @stop_area.city_name %>;<%= @stop_area.zip_code if @stop_area.zip_code %>;<%= @stop_area.comment if @stop_area.comment %>;<%= "\u000D\u000A" %>
\ No newline at end of file +<%= @stop_area.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @stop_area.objectid %>;<%= @stop_area.name.encode(Encoding::ISO_8859_1) if @stop_area.name %>;<%= @stop_area.nearest_topic_name.encode(Encoding::ISO_8859_1) if @stop_area.nearest_topic_name %>;<%= @type %>;;<%= (@stop_area.latitude && @stop_area.longitude) ? RGeo::CoordSys::Proj4::transform_coords(@from_projection, @to_projection, @stop_area.longitude, @stop_area.latitude)[0].to_i : '' %>;<%=  (@stop_area.latitude && @stop_area.longitude) ? RGeo::CoordSys::Proj4::transform_coords(@from_projection, @to_projection, @stop_area.longitude, @stop_area.latitude)[1].to_i : '' %>;<%= @stop_area.city_name.encode(Encoding::ISO_8859_1) if @stop_area.city_name %>;<%= @stop_area.zip_code if @stop_area.zip_code %>;<%= @stop_area.comment.encode(Encoding::ISO_8859_1) if @stop_area.comment %>;<%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/api/hub/arrets_physiques.hub.erb b/app/views/api/hub/arrets_physiques.hub.erb index a69047882..02cb11238 100644 --- a/app/views/api/hub/arrets_physiques.hub.erb +++ b/app/views/api/hub/arrets_physiques.hub.erb @@ -1 +1 @@ -<%= @stop_area.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @stop_area.objectid %>;<%= @stop_area.name if @stop_area.name %>;<%= @stop_area.nearest_topic_name if @stop_area.nearest_topic_name %>;<%= @type %>;<%= @parent.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @parent %>;<%= (@stop_area.latitude && @stop_area.longitude) ? RGeo::CoordSys::Proj4::transform_coords(@from_projection, @to_projection, @stop_area.longitude, @stop_area.latitude)[0].to_i : -1 %>;<%=  (@stop_area.latitude && @stop_area.longitude) ? RGeo::CoordSys::Proj4::transform_coords(@from_projection, @to_projection, @stop_area.longitude, @stop_area.latitude)[1].to_i : -1 %>;<%= @stop_area.city_name if @stop_area.city_name %>;<%= @stop_area.zip_code if @stop_area.zip_code %>;<%= @stop_area.comment if @stop_area.comment %>;<%= @stop_area.registration_number %><%= "\u000D\u000A" %>
\ No newline at end of file +<%= @stop_area.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @stop_area.objectid %>;<%= @stop_area.name.encode(Encoding::ISO_8859_1) if @stop_area.name %>;<%= @stop_area.nearest_topic_name.encode(Encoding::ISO_8859_1) if @stop_area.nearest_topic_name %>;<%= @type %>;<%= @parent.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @parent %>;<%= (@stop_area.latitude && @stop_area.longitude) ? RGeo::CoordSys::Proj4::transform_coords(@from_projection, @to_projection, @stop_area.longitude, @stop_area.latitude)[0].to_i : -1 %>;<%=  (@stop_area.latitude && @stop_area.longitude) ? RGeo::CoordSys::Proj4::transform_coords(@from_projection, @to_projection, @stop_area.longitude, @stop_area.latitude)[1].to_i : -1 %>;<%= @stop_area.city_name.encode(Encoding::ISO_8859_1) if @stop_area.city_name %>;<%= @stop_area.zip_code if @stop_area.zip_code %>;<%= @stop_area.comment.encode(Encoding::ISO_8859_1) if @stop_area.comment %>;<%= @stop_area.registration_number %><%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/api/hub/chemins.hub.erb b/app/views/api/hub/chemins.hub.erb index 2a4235db9..f5408c51f 100644 --- a/app/views/api/hub/chemins.hub.erb +++ b/app/views/api/hub/chemins.hub.erb @@ -1 +1 @@ -<%= @line.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @line %>;<%= @journey_pattern.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @journey_pattern.objectid %>;<%= @journey_pattern.registration_number if @journey_pattern.registration_number %>;<%= @journey_pattern.name if @journey_pattern.name %>;<%= (@journey_pattern.route.wayback == 'A' ? 1 : 2) if @journey_pattern.route %>;<%= @type %>;<% @stop_areas.each do |s| %>;<%= s.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if s.objectid %>;<%= s.registration_number %>;;<% end %><%= "\u000D\u000A" %>
\ No newline at end of file +<%= @line.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @line %>;<%= @journey_pattern.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @journey_pattern.objectid %>;<%= @journey_pattern.registration_number if @journey_pattern.registration_number %>;<%= @journey_pattern.name.encode(Encoding::ISO_8859_1) if @journey_pattern.name %>;<%= (@journey_pattern.route.wayback == 'A' ? 1 : 2) if @journey_pattern.route %>;<%= @type %>;<% @stop_areas.each do |s| %>;<%= s.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if s.objectid %>;<%= s.registration_number %>;;<% end %><%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/api/hub/communes.hub.erb b/app/views/api/hub/communes.hub.erb index 714969301..265271c54 100644 --- a/app/views/api/hub/communes.hub.erb +++ b/app/views/api/hub/communes.hub.erb @@ -1 +1 @@ -<%= @city_code %>;<%= @city_name %><%= "\u000D\u000A" %>
\ No newline at end of file +<%= @city_code %>;<%= @city_name.encode(Encoding::ISO_8859_1) if @city_name %><%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/api/hub/directions.hub.erb b/app/views/api/hub/directions.hub.erb index f7ae19781..dd069968d 100644 --- a/app/views/api/hub/directions.hub.erb +++ b/app/views/api/hub/directions.hub.erb @@ -1 +1 @@ -<%= @direction.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @direction %>;<%= @line.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @line %>;<%= (@journey_pattern.route.wayback == 'A' ? 1 : 2) if @journey_pattern.route %>;<%= @journey_pattern.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @journey_pattern.objectid %><%= "\u000D\u000A" %>
\ No newline at end of file +<%= @journey_pattern.name.encode(Encoding::ISO_8859_1) if @journey_pattern.name %>;<%= @line.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @line %>;<%= (@journey_pattern.route.wayback == 'A' ? 1 : 2) if @journey_pattern.route %>;<%= @journey_pattern.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @journey_pattern.objectid %><%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/api/hub/groupe_de_lignes.hub.erb b/app/views/api/hub/groupe_de_lignes.hub.erb index 7f7e24abc..2547c1e11 100644 --- a/app/views/api/hub/groupe_de_lignes.hub.erb +++ b/app/views/api/hub/groupe_de_lignes.hub.erb @@ -1 +1 @@ -<%= @group_of_lines.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') %>;<%= @group_of_lines.name %>;<%= @group_of_lines.id %><%= "\u000D\u000A" %>
\ No newline at end of file +<%= @group_of_lines.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') %>;<%= @group_of_lines.name.encode(Encoding::ISO_8859_1) if @group_of_lines.name %>;<%= @group_of_lines.id %><%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/api/hub/lignes.hub.erb b/app/views/api/hub/lignes.hub.erb index 312d45e1c..921eb7056 100644 --- a/app/views/api/hub/lignes.hub.erb +++ b/app/views/api/hub/lignes.hub.erb @@ -1 +1 @@ -<%= @line.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @line.objectid %>;<%= @line.number %>;<%= @line.name %>;;;<%= @company.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @company %>;<%= @network.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @network %>;<%= @group_of_line %>;<%= @line.id %><%= "\u000D\u000A" %>
\ No newline at end of file +<%= @line.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @line.objectid %>;<%= @line.number %>;<%= @line.name.encode(Encoding::ISO_8859_1) if @line.name %>;;;<%= @company.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @company %>;<%= @network.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') if @network %>;<%= @group_of_line %>;<%= @line.id %><%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/api/hub/periodes.hub.erb b/app/views/api/hub/periodes.hub.erb index 38b2d3db9..2bb3e8368 100644 --- a/app/views/api/hub/periodes.hub.erb +++ b/app/views/api/hub/periodes.hub.erb @@ -1 +1 @@ -<%= Chouette::TimeTable.find(@time_table.id).objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') %>;<%= @time_table.comment %>;<%= @time_table.start_date.strftime("%d/%m/%Y") %>;<%= @time_table.end_date.strftime("%d/%m/%Y") %>;<%= @calendar %>;<%= @identifier %><%= "\u000D\u000A" %>
\ No newline at end of file +<%= Chouette::TimeTable.find(@time_table.id).objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') %>;<%= @time_table.comment.encode(Encoding::ISO_8859_1) if @time_table.comment %>;<%= @time_table.start_date.strftime("%d/%m/%Y") %>;<%= @time_table.end_date.strftime("%d/%m/%Y") %>;<%= @calendar %>;<%= @identifier %><%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/api/hub/reseaux.hub.erb b/app/views/api/hub/reseaux.hub.erb index 1f12a7017..95ab8d547 100644 --- a/app/views/api/hub/reseaux.hub.erb +++ b/app/views/api/hub/reseaux.hub.erb @@ -1 +1 @@ -<%= @network.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') %>;<%= @network.name %>;<%= @network.id %><%= "\u000D\u000A" %>
\ No newline at end of file +<%= @network.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') %>;<%= @network.name.encode(Encoding::ISO_8859_1) if @network.name %>;<%= @network.id %><%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/api/hub/transporteurs.hub.erb b/app/views/api/hub/transporteurs.hub.erb index 7d153ad7c..595d3b5fb 100644 --- a/app/views/api/hub/transporteurs.hub.erb +++ b/app/views/api/hub/transporteurs.hub.erb @@ -1 +1 @@ -<%= @company.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') %>;<%= @company.name %>;<%= @company.id %><%= "\u000D\u000A" %>
\ No newline at end of file +<%= @company.objectid.sub(/(\w*\:\w*\:)(\w*)/, '\2') %>;<%= @company.name.encode(Encoding::ISO_8859_1) if @company.name %>;<%= @company.id %><%= "\u000D\u000A" %>
\ No newline at end of file diff --git a/app/views/devise/_links.erb b/app/views/devise/_links.erb index 3381b2e8e..e2a1bf3ef 100644 --- a/app/views/devise/_links.erb +++ b/app/views/devise/_links.erb @@ -7,7 +7,7 @@    </li>    <li> -  <%- if devise_mapping.registerable? && controller_name != 'registrations' %> +  <%- if devise_mapping.registerable? && controller_name != 'registrations' && Rails.application.config.accept_user_creation %>    <%= link_to t(".sign_up"), new_registration_path(resource_name) %><br />    <% end -%>    </li> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index d18db9402..79edcb53b 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,10 +1,13 @@  <%= title_tag t('.title') %>  <%= semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |form| %> -  <%= form.inputs do %>  +  <%= form.inputs do %> +    <%= form.semantic_fields_for :organisation, Organisation.new do |organisation| %> +      <%= organisation.input :name, :label => t("helpers.label.user.organisation_name") %> +    <% end %>      <% if resource.respond_to?( :name) %>        <%= form.input :name %>  -    <% end %> +      <% end %>          <%= form.input :email %>       <%= form.input :password, :as => :password %>       <%= form.input :password_confirmation, :as => :password %>  diff --git a/app/views/exports/_export.erb b/app/views/exports/_export.erb index 649251b78..a139e3171 100644 --- a/app/views/exports/_export.erb +++ b/app/views/exports/_export.erb @@ -25,9 +25,7 @@        </p>          </div>    <div class="panel-footer"> -    <div class="progress"> -      <div class="progress-bar <%= export.status %>" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"> <%= t("exports.statuses.#{export.status}") %></div> -    </div> +    <%= export_progress_bar_tag(export) %>          <div class="history">        <%= l export.created_at, :format => "%d/%m/%Y %H:%M" %>      </div> diff --git a/app/views/exports/_exports.html.erb b/app/views/exports/_exports.html.erb index 58d4d7e70..9417cfed6 100644 --- a/app/views/exports/_exports.html.erb +++ b/app/views/exports/_exports.html.erb @@ -2,15 +2,7 @@    <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @exports %>  </div>  <div class="exports paginated_content"> -  <% @exports.each_slice(3) do |row_exports| %> -  <div class="row"> -    <% row_exports.each do |export| %> -    <div  class="col-md-4"> -      <%= render :partial => "export",  locals: { export: export } %> -    </div> -    <% end %> -  </div> -  <% end %> +  <%= paginated_content @exports, "export" %>  </div>  <div class="pagination">      <%= will_paginate @exports, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %> diff --git a/app/views/exports/index.js.erb b/app/views/exports/index.js.erb index 08ddf1dc5..e9f06f09e 100644 --- a/app/views/exports/index.js.erb +++ b/app/views/exports/index.js.erb @@ -1 +1 @@ -$('#compliance_check_tasks').html('<%= escape_javascript(render("compliance_check_tasks")) %>');
\ No newline at end of file +$('#exports').html('<%= escape_javascript(render("exports")) %>');
\ No newline at end of file diff --git a/app/views/group_of_lines/_form.erb b/app/views/group_of_lines/_form.erb index 3c685964b..a0ef4a4c4 100644 --- a/app/views/group_of_lines/_form.erb +++ b/app/views/group_of_lines/_form.erb @@ -6,7 +6,7 @@    <% end %>    <%= form.inputs do %> -    <%= form.input :line_tokens, :label => t('.lines'), :as => :text,  :input_html => { :"data-pre" => ( @group_of_line.lines.map { |line| { :id => line.id, :name => line.published_name } } ).to_json }  %> +    <%= form.input :line_tokens, :label => t('.lines'), :as => :text,  :input_html => { :"data-pre" => ( @group_of_line.lines.map { |line| { :id => line.id, :name => line.name } } ).to_json }  %>    <% end %>     <%= form.actions do %> diff --git a/app/views/import_tasks/_import_task.erb b/app/views/import_tasks/_import_task.erb index 0bb8cad08..7ba2c1058 100644 --- a/app/views/import_tasks/_import_task.erb +++ b/app/views/import_tasks/_import_task.erb @@ -22,9 +22,7 @@        <% end %>    </div>    <div class="panel-footer"> -    <div class="progress"> -      <div class="progress-bar <%= import_task.status %>" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"> <%= t("import_tasks.statuses.#{import_task.status}") %></div> -    </div> +    <%= import_progress_bar_tag(import_task) %>          <div class="history">        <%= l import_task.created_at, :format => "%d/%m/%Y %H:%M" %> | <%= import_task.user_name %>      </div> diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb index 478a6b9d3..1c3945164 100644 --- a/app/views/vehicle_journeys/_form.html.erb +++ b/app/views/vehicle_journeys/_form.html.erb @@ -16,10 +16,11 @@      <li class="input">  	    <%= form.label @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids), :class => "label" %>      </li> +      <% unless @vehicle_journey.vehicle_journey_at_stops.empty? ||         @vehicle_journey.vehicle_journey_at_stops.any? { |vjas| vjas.departure_time.nil? } %>    <div class="vehicle_journey_at_stops">        <div class="well"> -	<span class="title"><%= t(".slide_title") %></span> +        <span class="title"><%= t(".slide_title") %></span>          <div>            <span><%= t(".set") %></span> <%= select_tag "", options_for_select( [ [t('.slide_departure'), "departure"], [t('.slide_arrival'), "arrival"] ] ), :class => "departure_or_arrival" %> <span><%= t(".to") %></span>            <%= select_hour(@vehicle_journey.vehicle_journey_at_stops.first.departure_time.hour) %> @@ -27,32 +28,32 @@            <a class="slide btn btn-default"><%= t(".slide") %></a>          </div>        </div> +    <% end %> -      <% end %> - -	    <table class="table table-hover table-striped"> -	      <thead> -	        <tr> -	          <th class="hour title"><%= t('.arrival') %></th> -	          <th class="stop title" ><%= t('.stop_title') %></th> -	          <th class="hour title"><%= t('.departure') %></th> -	        </tr> -	      </thead> -	      <tfoot> -	        <tr> -	          <td class="title"> <a class="to_departures"><%= t('.to_departures') %></a></td> -	          <td class="title" ></td> -	          <td class="title"><a class="to_arrivals"><%= t('.to_arrivals') %></a></td> -	        </tr> -	      </tfoot> -	      <tbody class="journey_pattern_dependent_list"> -	        <%= render :partial => "vehicle_journeys/vehicle_journey_at_stop_fields", -	        :collection => @vehicle_journey.vehicle_journey_at_stops, :as => :vehicle_journey_at_stop, :locals => { :vehicle_journey_at_stops_size => @vehicle_journey.vehicle_journey_at_stops.size } %> -	      </tbody> -	    </table> -    </div> +    <table class="table table-hover table-striped"> +	    <thead> +	      <tr> +	        <th class="hour title"><%= t('.arrival') %></th> +	        <th class="stop title" ><%= t('.stop_title') %></th> +	        <th class="hour title"><%= t('.departure') %></th> +	      </tr> +	    </thead> +	    <tfoot> +	      <tr> +	        <td class="title"> <a class="to_departures"><%= t('.to_departures') %></a></td> +	        <td class="title" ></td> +	        <td class="title"><a class="to_arrivals"><%= t('.to_arrivals') %></a></td> +	      </tr> +	    </tfoot> +	    <tbody class="journey_pattern_dependent_list"> +	      <%= render :partial => "vehicle_journeys/vehicle_journey_at_stop_fields", +	      :collection => @vehicle_journey.vehicle_journey_at_stops, :as => :vehicle_journey_at_stop, :locals => { :vehicle_journey_at_stops_size => @vehicle_journey.vehicle_journey_at_stops.size } %> +         +      </tbody> +    </table> +        <% end %> - +      <%= form.actions do %>      <%= form.action :submit, :as => :button %>      <%= form.action :cancel, :as => :link %> diff --git a/app/views/vehicle_journeys/select_journey_pattern.js.erb b/app/views/vehicle_journeys/select_journey_pattern.js.erb index 3487da1ae..6a32c7b9d 100644 --- a/app/views/vehicle_journeys/select_journey_pattern.js.erb +++ b/app/views/vehicle_journeys/select_journey_pattern.js.erb @@ -1,6 +1,7 @@  $('.journey_pattern_dependent_list').html('<%= escape_javascript(    render(:partial => 'vehicle_journeys/vehicle_journey_at_stop_fields',           :collection => @vehicle_journey.vehicle_journey_at_stops,  -         :as => :vehicle_journey_at_stop)).html_safe %>');  +         :as => :vehicle_journey_at_stop, +         :locals => { :vehicle_journey_at_stops_size => @vehicle_journey.vehicle_journey_at_stops.size })).html_safe %>');  diff --git a/config/environments/development.rb b/config/environments/development.rb index 2c028ac58..0d33ac03c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -52,11 +52,13 @@ ChouetteIhm::Application.configure do    config.company_name = "afimb"      config.company_theme = "#61970b" # AFIMB color    config.company_contact = "http://www.chouette.mobi/contact-support/" - +  config.accept_user_creation = true +      # CITYWAY    # config.company_name = "cityway"    # config.company_theme = "#32adb0"    # config.company_contact = "http://www.cityway.fr/contact/?rub_code=14" +  # config.accept_user_creation = false    # file to data for demo    config.demo_data = "tmp/demo.zip" diff --git a/config/environments/production.rb b/config/environments/production.rb index 594287bea..de408f29f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -135,12 +135,13 @@ ChouetteIhm::Application.configure do    config.company_name = "afimb"      config.company_theme = "#61970b" # AFIMB color    config.company_contact = "http://www.chouette.mobi/contact-support/" +  config.accept_user_creation = true      # CITYWAY    # config.company_name = "cityway"    # config.company_theme = "#32adb0"    # config.company_contact = "http://www.cityway.fr/contact/?rub_code=14" -   +  # config.accept_user_creation = false      # file to data for demo    config.demo_data = ENV['CHOUETTE_DEMO_DATA'].nil? ? "/path/to/demo.zip" : ENV['CHOUETTE_DEMO_DATA'] diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index ef5c89fbf..4aa6ef80d 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -242,25 +242,3 @@ Devise.setup do |config|    #   manager.default_strategies(:scope => :user).unshift :some_external_strategy    # end  end - -# class Devise::FailureApp -#     def return_to_root_path? -#       root_path == session["#{scope}_return_to"] -#     end -#     def redirect -#       store_location! -#       if flash[:timedout] && flash[:alert] -#         flash.keep(:timedout) -#         flash.keep(:alert) -#       else -#         Rails.logger.debug "A" * 30 -#         Rails.logger.debug i18n_message -#         Rails.logger.debug redirect_url -#         Rails.logger.debug scope -#         Rails.logger.debug root_path -#         Rails.logger.debug session["#{scope}_return_to"] -#         flash[:alert] = i18n_message unless return_to_root_path? -#       end -#       redirect_to redirect_url -#     end -# end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 4fb3980f1..0a42a021d 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -36,6 +36,7 @@ en:    helpers:      label:        user: +        organisation_name: "Organisation name"          name: Full name          password: Password          password_confirmation: Password confirmation diff --git a/config/locales/devise.fr.yml b/config/locales/devise.fr.yml index b1a9a743a..d3a60d9a0 100644 --- a/config/locales/devise.fr.yml +++ b/config/locales/devise.fr.yml @@ -40,6 +40,7 @@ fr:    helpers:      label:        user: +        organisation_name: "Nom de l'organisation"          name: Nom complet          password: Mot de passe          password_confirmation: Confirmation du mot de passe diff --git a/config/routes.rb b/config/routes.rb index 827ee97a1..f629a963f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,31 @@  ChouetteIhm::Application.routes.draw do    devise_scope :users do -    match "/users/sign_up" => "subscriptions#new" +    #match "/users/sign_up" => "subscriptions#new",    end -  devise_for :users +  devise_for :users, :controllers => { :registrations => "registrations" } + +  devise_scope :user do +    authenticated :user do +      root :to => 'referentials#index' +    end +     +    unauthenticated do +      root :to => 'devise/sessions#new' +    end +  end + +  # Rails 4 syntax +  # devise_for :users +  # devise_scope :user do +  #   authenticated :user do +  #     root :to => 'referentials#index', as: :authenticated_root +  #   end +  # unauthenticated :user do +  #     root :to => 'devise/registrations#new', as: :unauthenticated_root +  #   end +  # end +    namespace :api do      namespace :v1 do @@ -188,5 +210,4 @@ ChouetteIhm::Application.routes.draw do    match '/422', :to => 'errors#server_error'    match '/500', :to => 'errors#server_error' -  root :to => 'referentials#index'  end | 
