diff options
| author | Zakaria BOUZIANE | 2014-11-24 10:43:16 +0100 | 
|---|---|---|
| committer | Zakaria BOUZIANE | 2014-11-24 10:43:16 +0100 | 
| commit | b63aab1e0c351e8fabed515ee35d8b102af56682 (patch) | |
| tree | 051ca642c98d82f88ba712db57da8685945ad988 | |
| parent | e4ab65ceb98d334c32b7d4a3034ebdb3c0f13f71 (diff) | |
| parent | 4db22a974de47194687560e122372dad4c88a9a5 (diff) | |
| download | chouette-core-b63aab1e0c351e8fabed515ee35d8b102af56682.tar.bz2 | |
Merge branch 'V2_5'
Conflicts:
	app/exporters/chouette/hub/exporter.rb
24 files changed, 197 insertions, 165 deletions
| diff --git a/app/assets/stylesheets/modules/devise.css.scss b/app/assets/stylesheets/modules/devise.css.scss index 8236366ce..b4a1d2076 100644 --- a/app/assets/stylesheets/modules/devise.css.scss +++ b/app/assets/stylesheets/modules/devise.css.scss @@ -1,6 +1,12 @@  #devise{      background-color: $gray-light; +    .passwords.new{ +        input{ +            width: initial !important; +        } +    } +          .front_bg{                  background: url(image-path('welcome.jpg')) no-repeat center center;          background-size: cover; diff --git a/app/controllers/stop_area_children_controller.rb b/app/controllers/stop_area_children_controller.rb index f115ff35a..d60fcb1a6 100644 --- a/app/controllers/stop_area_children_controller.rb +++ b/app/controllers/stop_area_children_controller.rb @@ -3,27 +3,19 @@ class StopAreaChildrenController < ChouetteController    respond_to :json, :only => :index    def index -    respond_to do |format|   -      format.json { render :json => children_maps }   -    end   +    respond_to do |format| +      format.json { render :json => children_maps } +    end    end    protected    def children_maps -    children.collect do |area| -      { :id => area.id.to_s,  -        :name => area.name, -        :country_code =>  area.country_code, -        :zip_code => area.zip_code || "", -        :city_name => area.city_name || "", -        :area_type => t("area_types.label.#{area.area_type.underscore}") -      } -    end +    children.map {|area| area.attributes.merge( :area_type => t("area_types.label.#{area.area_type.underscore}"))}    end -  def children  -    referential.stop_areas.find(params[:stop_area_id]).possible_children.select{ |p| p.name =~ /#{params[:q]}/i  }        +  def children +    referential.stop_areas.find(params[:stop_area_id]).possible_children.select{ |p| p.name =~ /#{params[:q]}/i  }    end  end diff --git a/app/controllers/stop_area_parents_controller.rb b/app/controllers/stop_area_parents_controller.rb index 1dbb0796c..c32e5df17 100644 --- a/app/controllers/stop_area_parents_controller.rb +++ b/app/controllers/stop_area_parents_controller.rb @@ -3,25 +3,17 @@ class StopAreaParentsController < ChouetteController    respond_to :json, :only => :index    def index -    respond_to do |format|   -      format.json { render :json => parents_maps }   -    end   +    respond_to do |format| +      format.json { render :json => parents_maps } +    end    end    def parents_maps -    parents.collect do |area| -      { :id => area.id.to_s,  -        :name => area.name, -        :country_code =>  area.country_code, -        :zip_code => area.zip_code || "", -        :city_name => area.city_name || "", -        :area_type => t("area_types.label.#{area.area_type.underscore}") -      } -    end +    parents.map {|area| area.attributes.merge( :area_type => t("area_types.label.#{area.area_type.underscore}"))}    end -  def parents  -    referential.stop_areas.find(params[:stop_area_id]).possible_parents.select{ |p| p.name =~ /#{params[:q]}/i  }        +  def parents +    referential.stop_areas.find(params[:stop_area_id]).possible_parents.select{ |p| p.name =~ /#{params[:q]}/i  }    end  end diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index b164f4bc8..53a7575b9 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -49,7 +49,7 @@ class StopAreasController < ChouetteController    def index      request.format.kml? ? @per_page = nil : @per_page = 12 -    @country_codes = referential.stop_areas.collect(&:country_code).compact.uniq +    @zip_codes = referential.stop_areas.collect(&:zip_code).compact.uniq      index! do |format|        format.html {          if collection.out_of_bounds? @@ -110,9 +110,9 @@ class StopAreasController < ChouetteController      redirect_to referential_stop_areas_path(@referential)    end -  def country_codes +  def zip_codes      respond_to do |format| -      format.json { render :json => referential.stop_areas.collect(&:country_code).compact.uniq.to_json } +      format.json { render :json => referential.stop_areas.collect(&:zip_code).compact.uniq.to_json }      end    end diff --git a/app/controllers/stop_point_areas_controller.rb b/app/controllers/stop_point_areas_controller.rb index 9544d0fe6..1ece8641e 100644 --- a/app/controllers/stop_point_areas_controller.rb +++ b/app/controllers/stop_point_areas_controller.rb @@ -3,25 +3,17 @@ class StopPointAreasController < ChouetteController    respond_to :json, :only => :index    def index -    respond_to do |format|   -      format.json { render :json => areas_maps }   -    end   +    respond_to do |format| +      format.json { render :json => areas_maps } +    end    end    def areas_maps -    areas.collect do |area| -      { :id => area.id.to_s,  -        :name => area.name, -        :country_code =>  area.country_code, -        :zip_code => area.zip_code || "", -        :city_name => area.city_name || "", -        :area_type => t("area_types.label.#{area.area_type.underscore}") -      } -    end +    areas.map {|area| area.attributes.merge( :area_type => t("area_types.label.#{area.area_type.underscore}"))}    end -  def areas  -    Chouette::StopPoint.area_candidates.select{ |p| p.name =~ /#{params[:q]}/i  }        +  def areas +    Chouette::StopPoint.area_candidates.select{ |p| p.name =~ /#{params[:q]}/i  }    end  end diff --git a/app/exporters/chouette/hub/exporter.rb b/app/exporters/chouette/hub/exporter.rb index 3651e9f4f..27ac4e7ee 100644 --- a/app/exporters/chouette/hub/exporter.rb +++ b/app/exporters/chouette/hub/exporter.rb @@ -45,7 +45,7 @@ class Chouette::Hub::Exporter    def referential_exportable?      Chouette::VehicleJourneyAtStop.all.count < 50000    end -   +    def time_tables_exportable?      time_tables    end @@ -75,13 +75,13 @@ class Chouette::Hub::Exporter    def export(zip_file_path, options = {})      begin        referential.switch -       +        if referential_exportable? && options[:start_date] && options[:end_date] -         +                FileUtils.rm(zip_file_path) if File.exists? zip_file_path -         +                hub_export.log_messages.create( :severity => "ok", :key => "EXPORT", :arguments => {"0" => "HUB"}) -         +              Dir.mktmpdir(nil, "/tmp"){ |temp_dir|          @time_tables = select_time_tables(options[:start_date], options[:end_date]) diff --git a/app/helpers/journey_patterns_helper.rb b/app/helpers/journey_patterns_helper.rb index 6897b88c9..4bbefbc1a 100644 --- a/app/helpers/journey_patterns_helper.rb +++ b/app/helpers/journey_patterns_helper.rb @@ -1,13 +1,15 @@  module JourneyPatternsHelper +    def journey_name( journey_pattern)      if journey_pattern.name.blank? -      t('journey_patterns.journey_pattern.from_to',  +      truncate( t('journey_patterns.journey_pattern.from_to',           :departure => journey_pattern.stop_points.first.stop_area.name,  -        :arrival => journey_pattern.stop_points.last.stop_area.name) +        :arrival => journey_pattern.stop_points.last.stop_area.name), :length => 30)      else        truncate(journey_pattern.name, :length => 30)      end    end +      def stop_point_ids_label(journey_pattern)      return journey_pattern.human_attribute_name(:stop_point_ids) if journey_pattern.vehicle_journeys.empty? diff --git a/app/helpers/lines_helper.rb b/app/helpers/lines_helper.rb index 623d091ca..80073af62 100644 --- a/app/helpers/lines_helper.rb +++ b/app/helpers/lines_helper.rb @@ -16,4 +16,13 @@ module LinesHelper    def background_color(line)      line.color.blank? ? "white" : "#"+line.color    end +   +  def number_style(line) +    if colors?(line) +      number_style = "color: #{text_color(line)}; background-color: #{background_color(line)};" +    else  +      number_style = "" +    end + +  end  end diff --git a/app/helpers/vehicle_journeys_helper.rb b/app/helpers/vehicle_journeys_helper.rb index 2ee8123b5..95741f441 100644 --- a/app/helpers/vehicle_journeys_helper.rb +++ b/app/helpers/vehicle_journeys_helper.rb @@ -1,13 +1,4 @@  module VehicleJourneysHelper -  def journey_name( journey_pattern) -    if !journey_pattern.published_name.blank? -      journey_pattern.published_name.first(8) -    elsif !journey_pattern.name.blank? -      journey_pattern.name.first(8) -    else -      journey_pattern.id -    end -  end    def vehicle_name( vehicle)      if !vehicle.published_journey_name.blank? diff --git a/app/inputs/search_stop_area_input.rb b/app/inputs/search_stop_area_input.rb index 1feb58d00..901715dc1 100644 --- a/app/inputs/search_stop_area_input.rb +++ b/app/inputs/search_stop_area_input.rb @@ -2,9 +2,28 @@ class SearchStopAreaInput < Formtastic::Inputs::SearchInput    def search      if options[:json] -      tokenLimit = options[:tokenLimit].present? ? options[:tokenLimit] : "null"  +      tokenLimit = options[:tokenLimit].present? ? options[:tokenLimit] : "null"        template.content_tag( :script,         ("$(document).ready(function() { +           var item_name = function( item){ +              var result = item.name; +              console.log( item ); +              console.log( item.registration_number ); +              if ( item.registration_number !=null && item.registration_number.length > 0) { +                 result += '  (' + item.registration_number + ')'; +              } +              return result; +           }; +           var item_format = function( item ){ +              var info = ''; +              if ( item.zip_code != null ) { +                 info += item.zip_code + ' '; +              } +              if ( item.city_name != null ) { +                 info += item.city_name; +              } +              return '<li><div class=\"name\">' + item_name( item) + '</div><div class=\"info\">' + item.area_type + '</div><div class=\"info\">' +  info + '</div></li>' +           };             $('##{dom_id}').tokenInput('#{options[:json]}', {               crossDomain: false,               tokenLimit: #{tokenLimit}, @@ -13,21 +32,21 @@ class SearchStopAreaInput < Formtastic::Inputs::SearchInput               hintText: '#{options[:hint_text]}',               noResultsText: '#{options[:no_result_text]}',               searchingText: '#{options[:searching_text]}', -             resultsFormatter: function(item){ return '<li><div class=\"name\">' + item.name + '</div><div class=\"info\">' + item.area_type + '</div><div class=\"info\">' +  item.zip_code + ' ' + item.city_name + '</div></li>' }, -             tokenFormatter: function(item){ return '<li><div class=\"name\">' + item.name + '</div><div class=\"info\">' + item.area_type + '</div><div class=\"info\">' +  item.zip_code + ' ' + item.city_name + '</div></li>' }, +             resultsFormatter: item_format, +             tokenFormatter: item_format             });          });").html_safe)      end    end -   +    def to_html -    input_wrapping do       +    input_wrapping do        label_html <<          builder.search_field(method, input_html_options) <<            search      end    end -   +    def input_html_options      super.merge({                    :required          => nil, @@ -35,6 +54,6 @@ class SearchStopAreaInput < Formtastic::Inputs::SearchInput                    :class             => 'token-input',                    'data-model-name' => object.class.model_name.human                  }) -  end  -   +  end +  end diff --git a/app/models/time_table_combination.rb b/app/models/time_table_combination.rb index 1fa497d73..783ef53ef 100644 --- a/app/models/time_table_combination.rb +++ b/app/models/time_table_combination.rb @@ -6,7 +6,7 @@ class TimeTableCombination    attr_accessor :source_id, :combined_id, :operation     validates_presence_of :source_id, :combined_id, :operation  -  validates_inclusion_of :operation, :in =>  %w( union intersection disjunction) +  validates_inclusion_of :operation, :in =>  %w( union intersection disjunction), :allow_nil => true    def clean      self.source_id = nil diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index 68fd8c22a..865805319 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,12 +1,16 @@ -<div class="panel panel-default"> -  <div class="panel-heading"><%= t('.title') %></div> -  <div class="panel-body"> -    <%= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |form| %> -      <%= form.input :email %>  +<div class="col-md-offset-2 col-md-8"> +  <div class="panel panel-default"> +    <div class="panel-heading"><%= t('.title') %></div> +    <div class="panel-body"> +      <%= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |form| %> +      <%= form.input :email, :as => :email, placeholder: 'user@domain.com'  %>  -      <%= link_to t("cancel"), root_path, :class => "btn btn-default" %>     -      <%= form.button :submit, :value => t("devise.passwords.new.commit") %> -    <% end %> +      <div class="col-md-offset-2"> +        <%= link_to t("cancel"), root_path, :class => "btn btn-default" %>     +        <%= form.button :submit, :value => t("devise.passwords.new.commit"), :class => "btn-info" %> +      </div> +      <% end %> +    </div>    </div>  </div> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index dc06a3ea2..9334bab35 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,21 +1,17 @@  <div id="sessions_new" class="row">    <div class="col-md-8 product_summary"> -    <h2>Bienvenue sur Chouette</h2> -    <p> -     Chouette est un logiciel Open Source de saisie, de visualisation et d'échange d'offre de transport public planifiée. -    </p> -    <p> -      Ce logiciel est déployé en mode Saas et se veut ouvert :       -    </p> +    <h2><%= t(".welcome") %></h2> +    <p><%= t(".introduction1") %></p> +    <p><%= t(".introduction2") %></p>      <ul> -      <li>- choix de plusieurs fonds cartographiques</li> -      <li>- échange de données en différents normes (Neptune, ...) et standard (GTFS, ...)</li> +      <li>- <%= t(".introduction_item1") %></li> +      <li>- <%= t(".introduction_item2") %></li>      </ul>    </div>    <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" ) 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"> @@ -42,24 +38,24 @@      <% if Rails.application.config.accept_user_creation %>      <div class="panel panel-default">        <div class="panel-heading"><%= t("devise.registrations.new.title") %></div> -      <div class="panel-body">         +      <div class="panel-body">          <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :wrapper => "form_without_label" ) 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 %>          <% if resource.respond_to?( :name) %> -          <%= form.input :name, :label => false, :placeholder => t("helpers.label.user.name"), input_html: { :class => "form-control" }  %>  -        <% end %>     -        <%= form.input :email, :label => false, :placeholder => t("helpers.label.user.email"), input_html: { :class => "form-control" } %>  -        <%= form.input :password, :as => :password, :label => false, :placeholder => t("helpers.label.user.password"), input_html: { :class => "form-control" } %>  -        <%= form.input :password_confirmation, :as => :password, :label => false, :placeholder => t("helpers.label.user.password_confirmation"), input_html: { :class => "form-control" } %>  -         +          <%= form.input :name, :label => false, :placeholder => t("helpers.label.user.name"), input_html: { :class => "form-control" }  %> +        <% end %> +        <%= form.input :email, :label => false, :placeholder => t("helpers.label.user.email"), input_html: { :class => "form-control" } %> +        <%= form.input :password, :as => :password, :label => false, :placeholder => t("helpers.label.user.password"), input_html: { :class => "form-control" } %> +        <%= form.input :password_confirmation, :as => :password, :label => false, :placeholder => t("helpers.label.user.password_confirmation"), input_html: { :class => "form-control" } %> +          <%= form.button :submit, t("devise.registrations.new.commit"), :class => "btn-info" %>          <% end %>        </div>      </div>      <% end %> -     +    </div>  </div> diff --git a/app/views/exports/new.html.erb b/app/views/exports/new.html.erb index 8405e2c4d..fe5961ce9 100644 --- a/app/views/exports/new.html.erb +++ b/app/views/exports/new.html.erb @@ -7,26 +7,26 @@  <% end %>  <% @available_exports.each do |export| %> -<%= semantic_form_for [@referential, export], :as => :export, :url => referential_exports_path(@referential), :html => { :id => "#{export.type}_new",  :style => ('display: none' unless @export == export)} do |form| %> +  <%= semantic_form_for [@referential, export], :as => :export, :url => referential_exports_path(@referential), :namespace => export.type.underscore ,:html => { :id => "#{export.type}_new",  :style => ('display: none' unless @export == export)} do |form| %>      <%= form.inputs do %>        <%= fields_for_export_type form %>      <% end %> -  <%= form.inputs do %> -    <%= form.input :type, :as => :hidden %> +    <%= form.inputs do %> +      <%= form.input :type, :as => :hidden %> -    <p class="warning"><%= t('.'+export_partial_name(form)+'.warning',:default => "")%></p> -    <%= form.input :references_type, :as => :select, :collection => export.references_types.map { |c| [ c.model_name.human.capitalize.pluralize, c.name ] }, :include_blank => t(".all") %> +      <p class="warning"><%= t('.'+export_partial_name(form)+'.warning',:default => "")%></p> +      <%= form.input :references_type, :as => :select, :collection => export.references_types.map { |c| [ c.model_name.human.capitalize.pluralize, c.name ] }, :include_blank => t(".all") %> -    <% export.references_types.each do |type| %> -      <%= type_ids_model_references_input(form, @export, Export, type).input %> +      <% export.references_types.each do |type| %> +        <%= type_ids_model_references_input(form, @export, Export, type).input %> +      <% end %>      <% end %> -  <% end %> -   <%= form.actions do %> -     <%= form.action :submit, :as => :button , :label => t( 'formtastic.export' ) %> -     <%= form.action :cancel, :as => :link %> -   <% end %> -<% end %> +    <%= form.actions do %> +      <%= form.action :submit, :as => :button , :label => t( 'formtastic.export' ) %> +      <%= form.action :cancel, :as => :link %> +    <% end %> +  <% end %>  <% end %>  <%= javascript_include_tag new_referential_export_path(@referential, :format => :js) %> diff --git a/app/views/help/index.textile b/app/views/help/index.textile index 1ac92d989..79d3b02e9 100644 --- a/app/views/help/index.textile +++ b/app/views/help/index.textile @@ -3,7 +3,7 @@ layout: default  title: Chouette v2   --- -Version 2.5.0 +Version 2.5.1  h3. Logiciel libre propriété de : @@ -24,6 +24,14 @@ A cet égard  l'attention de l'utilisateur est attirée sur les risques associé  h3. Notes de version +h4. Version 2.5.1 + +* Nouvelles foctionnalités : +** refonte de l'import/export GTFS +** ajout des couleurs de lignes +** ajout de l'URL d'une page web pour les transporteurs, lignes et les arrêts +** ajout du fuseau horaire pour les transporteurs et les arrêts. +  h4. Version 2.5.0  * Nouvelles foctionnalités : diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb index 24450fa20..5962cd64f 100644 --- a/app/views/lines/_line.erb +++ b/app/views/lines/_line.erb @@ -12,14 +12,7 @@        <h5>          <%= check_box_tag "ids[]", line.id, false, :class => "multiple_selection", :style => "display: none;" %>          <% if line.number and line.number.length <= 3 %> -           <% if !line.text_color.blank? || !line.color.blank? %> -             <% text_color = line.text_color.blank? ? "black" : "##{line.text_color}" %> -             <% bg_color = line.color.blank? ? "white" : "##{line.color}" %> -             <% number_style = "color: #{text_color}; background-color: #{bg_color};" %> -           <% else %> -             <% number_style = "" %> -           <% end %> -           <span class="label label-default line_number" style="<%= number_style %>"><%= line.number %></span> +           <span class="label label-default line_number" style="<%= number_style(line) %>"><%= line.number %></span>          <% end %>                <%= link_to([@referential, line], :class => "preview", :title => "#{Chouette::Line.model_name.human.capitalize} #{line.name}") do %>                    <span class="name">           diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb index 12af00ff7..5983aaca0 100644 --- a/app/views/lines/show.html.erb +++ b/app/views/lines/show.html.erb @@ -12,7 +12,7 @@      <% if colors?(@line) %>  	    <p>  	    	<label><%= t('lines.index.color') %>: </label> -	    	<label class="color" style='<%="color: #{text_color(@line)}; background-color: #{background_color(@line)};"%>'><%= line_sticker(@line) %></label> +	    	<label class="color" style='<%="#{number_style(@line)}"%>'><%= line_sticker(@line) %></label>  	    </p>	      <% end %>      <p> diff --git a/app/views/routes/_form.html.erb b/app/views/routes/_form.html.erb index 658fda0ae..270c49911 100644 --- a/app/views/routes/_form.html.erb +++ b/app/views/routes/_form.html.erb @@ -26,55 +26,73 @@     <% end %>  <% end %>  <script> -var stop_point_ids = []; -var order_position = function() { -  $('#stop_points input[type="hidden"][id$="position"]').each(function(index) { -    $(this).val(index); -  }); -}; +$(document).ready( function() { +  var stop_point_ids = []; -var write_stop_point_ids = function(){ -  $('#stop_points input[type="hidden"][class~="stop_point_id"]').each(function(index,element) { +  var order_position = function() { +    $('#stop_points input[type="hidden"][id$="position"]').each(function(index) { +      $(this).val(index); +    }); +  }; +  var write_stop_point_ids = function(){ +    $('#stop_points input[type="hidden"][class~="stop_point_id"]').each(function(index,element) { -    // soit le parent a la classe added_stop_point -      if ( $(element).hasClass("added_stop_point") ){ -        $(this).attr("value", ""); -      } else { -        $(this).attr("value", stop_point_ids.shift()); -      } -  }); -} -var empty_stop_point_ids = function() { -  while(stop_point_ids.length > 0) { -    stop_point_ids.pop(); +      // soit le parent a la classe added_stop_point +        if ( $(element).hasClass("added_stop_point") ){ +          $(this).attr("value", ""); +        } else { +          $(this).attr("value", stop_point_ids.shift()); +        } +    });    } -  $('#stop_points input[type="hidden"][class="stop_point_id"]').map(function() { -    stop_point_ids.push( $(this).val()); -  }); -  // console.log(  "before-remove"); -  // console.log(  stop_point_ids); -}; -var stop_area_selection_token_input = function( element ) { -  element.tokenInput('<%= referential_stop_point_areas_path(@referential, :format => :json) %>', -        {  crossDomain: false, -           prePopulate: $(element).data('pre'), -           tokenLimit: 1, -           minChars: 3, -           hintText: '<%= t('search_hint') %>', -           noResultsText: '<%= t('no_result_text') %>', -           searchingText: '<%= t('searching_term') %>', -             resultsFormatter: function(item){ return '<li><div class=\"name\">' + item.name + '</div><div class=\"info\">' + item.area_type + '</div><div class=\"info\">' +  item.zip_code + ' ' + item.city_name + '</div></li>' }, -             tokenFormatter: function(item) { return '<li><p>' + item.name + '</p></li>' } -        }); -}; -$(document).ready( function() { +  var empty_stop_point_ids = function() { +    while(stop_point_ids.length > 0) { +      stop_point_ids.pop(); +    } +    $('#stop_points input[type="hidden"][class="stop_point_id"]').map(function() { +      stop_point_ids.push( $(this).val()); +    }); +    // console.log(  "before-remove"); +    // console.log(  stop_point_ids); +  }; +  var stop_area_selection_token_input = function( element ) { +     var item_name = function( item){ +        var result = item.name; +        if ( item.registration_number !=null && item.registration_number.length > 0) { +           result += '  (' + item.registration_number + ')'; +        } +        return result; +     }; +     var item_format = function( item ){ +        var info = ''; +        if ( item.zip_code != null ) { +           info += item.zip_code + ' '; +        } +        if ( item.city_name != null ) { +           info += item.city_name; +        } +        return '<li><div class=\"name\">' + item_name( item) + '</div><div class=\"info\">' + item.area_type + '</div><div class=\"info\">' +  info + '</div></li>' +     }; +    element.tokenInput('<%= referential_stop_point_areas_path(@referential, :format => :json) %>', +          {  crossDomain: false, +             tokenLimit: 1, +             minChars: 3, +             hintText: '<%= t('search_hint') %>', +             noResultsText: '<%= t('no_result_text') %>', +             searchingText: '<%= t('searching_term') %>', +             resultsFormatter: item_format , +             tokenFormatter: item_format +          }); +  }; +    $( ".new_stop_point" ).each( function(index, element){      stop_area_selection_token_input( $(element))    }); +    $('#stop_points').sortable({        axis: 'y',        dropOnEmpty: false, diff --git a/app/views/stop_areas/index.html.erb b/app/views/stop_areas/index.html.erb index 93406dc81..8486af7ad 100644 --- a/app/views/stop_areas/index.html.erb +++ b/app/views/stop_areas/index.html.erb @@ -20,7 +20,7 @@    <div id="advanced_search" class="panel-collapse collapse">                <div class="panel-body"> -      <%= f.text_field :country_code_cont, :placeholder => "#{t('.country_code')}", :class => 'form-control typeahead' %> +      <%= f.text_field :zip_code_cont, :placeholder => "#{t('.zip_code')}", :class => 'form-control typeahead' %>        <%= f.select(:area_type_cont, options_from_collection_for_select(Chouette::StopArea.stop_area_types, 'name', Proc.new { |stop_area_type| t("area_types.label.#{stop_area_type}") } ), { :include_blank => "#{t('.area_type')}" }, { :class => 'form-control' }) %>      </div>    </div> diff --git a/app/views/stop_areas/index.rabl b/app/views/stop_areas/index.rabl index 72b736858..d7f2365bb 100644 --- a/app/views/stop_areas/index.rabl +++ b/app/views/stop_areas/index.rabl @@ -1,9 +1,9 @@  collection @stop_areas  node do |stop_area| -  { :id => stop_area.id, :name => stop_area.name || "", :zip_code => stop_area.zip_code || "", :city_name => stop_area.city_name || "" }   +  { :id => stop_area.id, :registration_number => stop_area.registration_number || "", :name => stop_area.name || "", :zip_code => stop_area.zip_code || "", :city_name => stop_area.city_name || "" }  end  node :area_type do |area|    I18n.t("area_types.label.#{area.area_type.underscore}") || "" -end
\ No newline at end of file +end diff --git a/app/views/stop_areas/show.rabl b/app/views/stop_areas/show.rabl index a03a3511d..f406c4eff 100644 --- a/app/views/stop_areas/show.rabl +++ b/app/views/stop_areas/show.rabl @@ -1,7 +1,7 @@  object @stop_area  node do |stop_area| -  { :id => stop_area.id, :name => stop_area.name || "", :zip_code => stop_area.zip_code || "", :city_name => stop_area.city_name || "" }   +  { :id => stop_area.id, :registration_number => stop_area.registration_number || "", :name => stop_area.name || "", :zip_code => stop_area.zip_code || "", :city_name => stop_area.city_name || "" }  end  node :area_type do |area| diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 933eca4a3..017e167bd 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -6,6 +6,11 @@ en:        new:          title: Sign in          commit: Sign in +        welcome: "Welcome on Chouette" +        introduction1: "Chouette is an Open Source software that can read and edit whole public transport service for passengers." +        introduction2: "The software is delivered in Saas way and gives you :" +        introduction_item1: "map view of lines, routes, journeys, stops, connections..." +        introduction_item2: "data exchange functions in different formats like NEPTUNE, GTFS"      confirmations:        new:          title: Resend confirmation instructions @@ -42,4 +47,4 @@ en:          password: Password          password_confirmation: Password confirmation          current_password: Current password -        remember_me: Remember me
\ No newline at end of file +        remember_me: Remember me diff --git a/config/locales/devise.fr.yml b/config/locales/devise.fr.yml index cb45578e5..c5885effc 100644 --- a/config/locales/devise.fr.yml +++ b/config/locales/devise.fr.yml @@ -10,6 +10,11 @@ fr:        new:          title: Se connecter          commit: Se connecter +        welcome: "Bienvenue sur Chouette" +        introduction1: "Chouette est un logiciel Open Source d'édition et d'échange d'offre de transport public planifiée." +        introduction2: "Le logiciel est mis à disposition en mode Saas et se veut ouvert :" +        introduction_item1: "visualisation cartographique des lignes, des arrêts, des parcours..." +        introduction_item2: "échange de données selon différents formats (Neptune, GTFS)"      confirmations:        new:          title: Renvoyer le mail de confirmation diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml index 379838f6e..1974c5cb1 100644 --- a/config/locales/stop_areas.yml +++ b/config/locales/stop_areas.yml @@ -48,7 +48,7 @@ en:      index:        title: "Stop areas"        name: "Search by name" -      country_code: "Postal Code : 78000" +      zip_code: "Zip Code"        selection: "Filter on"        selection_all: "All"        area_type: "Area Type" @@ -170,7 +170,7 @@ fr:        access_link_legend_2: "cliquer sur les flêches pour créer/éditer un lien"      index:        name: "Recherche par nom" -      country_code: "Code Postal : 78000" +      zip_code: "Code Postal"        title: "Arrêts"        selection: "Filtrer sur"        selection_all: "Tous" | 
