diff options
| -rw-r--r-- | app/controllers/stop_area_children_controller.rb | 10 | ||||
| -rw-r--r-- | app/controllers/stop_area_parents_controller.rb | 10 | ||||
| -rw-r--r-- | app/controllers/stop_point_areas_controller.rb | 8 | ||||
| -rw-r--r-- | app/views/routes/_form.html.erb | 6 | ||||
| -rw-r--r-- | app/views/routes/_stop_point_fields.html.erb | 2 | ||||
| -rw-r--r-- | app/views/stop_area_imports/new.html.erb | 12 | ||||
| -rw-r--r-- | app/views/stop_areas/_stop_area.html.erb | 9 | ||||
| -rw-r--r-- | app/views/stop_areas/add_children.html.erb | 8 | ||||
| -rw-r--r-- | app/views/stop_areas/index.html.erb | 9 | ||||
| -rw-r--r-- | app/views/stop_areas/select_parent.html.erb | 16 | ||||
| -rw-r--r-- | app/views/stop_points/_stop_point.html.erb | 5 | ||||
| -rw-r--r-- | config/deploy/unstable.rb | 2 | 
12 files changed, 58 insertions, 39 deletions
| diff --git a/app/controllers/stop_area_children_controller.rb b/app/controllers/stop_area_children_controller.rb index 111fcb93c..f115ff35a 100644 --- a/app/controllers/stop_area_children_controller.rb +++ b/app/controllers/stop_area_children_controller.rb @@ -11,8 +11,14 @@ class StopAreaChildrenController < ChouetteController    protected    def children_maps -    children.collect do |child| -      { :id => child.id.to_s, :name => "#{child.name} #{child.country_code}" } +    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    end diff --git a/app/controllers/stop_area_parents_controller.rb b/app/controllers/stop_area_parents_controller.rb index 526c1cd42..1dbb0796c 100644 --- a/app/controllers/stop_area_parents_controller.rb +++ b/app/controllers/stop_area_parents_controller.rb @@ -9,8 +9,14 @@ class StopAreaParentsController < ChouetteController    end    def parents_maps -    parents.collect do |parent| -      { :id => parent.id.to_s, :name => "#{parent.name} #{parent.country_code}" } +    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    end diff --git a/app/controllers/stop_point_areas_controller.rb b/app/controllers/stop_point_areas_controller.rb index b307936f0..9544d0fe6 100644 --- a/app/controllers/stop_point_areas_controller.rb +++ b/app/controllers/stop_point_areas_controller.rb @@ -10,7 +10,13 @@ class StopPointAreasController < ChouetteController    def areas_maps      areas.collect do |area| -      { :id => area.id.to_s, :name => "#{area.name} #{area.country_code}" } +      { :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    end diff --git a/app/views/routes/_form.html.erb b/app/views/routes/_form.html.erb index 004af05e3..658fda0ae 100644 --- a/app/views/routes/_form.html.erb +++ b/app/views/routes/_form.html.erb @@ -65,8 +65,10 @@ var stop_area_selection_token_input = function( element ) {             minChars: 3,             hintText: '<%= t('search_hint') %>',             noResultsText: '<%= t('no_result_text') %>', -           searchingText: '<%= t('searching_term') %>' } -        ); +           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() { diff --git a/app/views/routes/_stop_point_fields.html.erb b/app/views/routes/_stop_point_fields.html.erb index bc9d4e8db..e8b18fa87 100644 --- a/app/views/routes/_stop_point_fields.html.erb +++ b/app/views/routes/_stop_point_fields.html.erb @@ -5,7 +5,7 @@    <% if f.object.stop_area.nil? || f.object.new_record? %>      <%= f.input :id, :as => :hidden, :input_html => { :class => "stop_point_id added_stop_point", :value => "" } %>      <%= f.input :position, :as => :hidden, :input_html => { :class => "position" } %> -    <% data_pre = (f.object.stop_area.nil?) ? [] : [ :id => f.object.stop_area.id, :name => "#{f.object.stop_area.name} #{f.object.stop_area.country_code}" ] %> +    <% data_pre = (f.object.stop_area.nil?) ? [] : [ :id => f.object.stop_area.id, :name => "#{f.object.stop_area.name}" ] %>      <%= f.input :stop_area_id, :label => false, :input_html => { :class => "new_stop_point stop_area_id", :"data-pre" => data_pre.to_json }  %>    <% else %>      <%= f.input :id, :as => :hidden, :input_html => { :class => "stop_point_id" } %> diff --git a/app/views/stop_area_imports/new.html.erb b/app/views/stop_area_imports/new.html.erb index 54ca1c57a..d94f1c08b 100644 --- a/app/views/stop_area_imports/new.html.erb +++ b/app/views/stop_area_imports/new.html.erb @@ -1,17 +1,5 @@  <%= title_tag t('stop_area_imports.new.title') %> -<div class="main_actions"> -  <div class="btn-group"> -    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> -       <%= t('stop_area_imports.new.export_stop_areas') %><span class="caret"></span> -    </button> -    <ul class="dropdown-menu" role="menu"> -      <li><%= link_to image_tag("icons/file_csv.png") + " Csv" , referential_stop_area_exports_path(@referential, :format => :csv) %></li> -      <li><%= link_to image_tag("icons/file_excel.png") + " Excel", referential_stop_area_exports_path(@referential, :format => :xls) %></li> -    </ul> -  </div> -</div> -  <%= semantic_form_for [@referential, @stop_area_import] do |form| %>    <br>    <%= form.inputs do %>  diff --git a/app/views/stop_areas/_stop_area.html.erb b/app/views/stop_areas/_stop_area.html.erb index 4f2a1a695..8f8d0f966 100644 --- a/app/views/stop_areas/_stop_area.html.erb +++ b/app/views/stop_areas/_stop_area.html.erb @@ -10,6 +10,15 @@        <% unless stop_area.area_type == 'ITL' || stop_area.geometry %>        <span class="warning"><%= t('.no_position') %></span> -        <% end %> +      <span class="warning"> +      	<% if stop_area.zip_code.blank? %> +      	   <%=  stop_area.human_attribute_name('country_code')+' '+stop_area.country_code unless stop_area.country_code.blank? %> +      	<% else %> +      	   <%=  stop_area.zip_code %> +      	<% end %> +      	<%=  stop_area.city_name %> +      	  +      </span>	      </p>      <p>         <% if stop_area.area_type == 'ITL' %> diff --git a/app/views/stop_areas/add_children.html.erb b/app/views/stop_areas/add_children.html.erb index acf4ff603..3f7c3461a 100644 --- a/app/views/stop_areas/add_children.html.erb +++ b/app/views/stop_areas/add_children.html.erb @@ -3,7 +3,7 @@  <%= semantic_form_for [@referential, @stop_area] do |form| %>  <div>    <%= form.inputs do %> -    <%= form.input :children_ids, :as => :text, :input_html => { :"data-pre" => ( @children.map { |child| { :id => child.id.to_s, :name => "#{child.name} #{child.country_code}" } } ).to_json }  %> +    <%= form.input :children_ids, :as => :text, :input_html => { :"data-pre" => ( @children.map { |child| { :id => child.id.to_s, :name => "#{child.name}" } } ).to_json }  %>    <% end %>     <%= form.actions do %> @@ -21,8 +21,10 @@         minChars: 3,         hintText: '<%= t('search_hint') %>',         noResultsText: '<%= t('no_result_text') %>', -       searchingText: '<%= t('searching_term') %>' -    }); +       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>' } +           });  	});  </script> diff --git a/app/views/stop_areas/index.html.erb b/app/views/stop_areas/index.html.erb index 005b36fa3..a186a33ac 100644 --- a/app/views/stop_areas/index.html.erb +++ b/app/views/stop_areas/index.html.erb @@ -45,5 +45,14 @@      <%= link_to t('stop_area_imports.new.title'), new_referential_stop_area_import_path( @referential ), :class => "import" %>    </li>  </ul> +  <div class="btn-group"> +    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> +       <%= t('stop_area_imports.new.export_stop_areas') %><span class="caret"></span> +    </button> +    <ul class="dropdown-menu" role="menu"> +      <li><%= link_to image_tag("icons/file_csv.png") + " Csv" , referential_stop_area_exports_path(@referential, :format => :csv) %></li> +      <li><%= link_to image_tag("icons/file_excel.png") + " Excel", referential_stop_area_exports_path(@referential, :format => :xls) %></li> +    </ul> +  </div>  <% end %> diff --git a/app/views/stop_areas/select_parent.html.erb b/app/views/stop_areas/select_parent.html.erb index 2e5f4ca94..dbc5b0b13 100644 --- a/app/views/stop_areas/select_parent.html.erb +++ b/app/views/stop_areas/select_parent.html.erb @@ -3,7 +3,7 @@  <%= semantic_form_for [@referential, @stop_area] do |form| %>  <div>    <%= form.inputs do %> -    <%= form.input :parent_id, :as => :text, :input_html => { :"data-pre" => ( @parent.present? ? [ { :id => @parent.id.to_s, :name => "#{@parent.name} #{@parent.country_code}" } ]: [] ).to_json }  %> +    <%= form.input :parent_id, :as => :search_stop_area, :json => referential_stop_area_stop_area_parents_path(@referential, @stop_area, :format => :json), :hint_text => t('search_hint'), :no_result_text => t('no_result_text'),:searching_text => t('searching_term'), :input_html => { :"data-pre" => ( @parent.present? ? [ { :id => @parent.id.to_s, :name => "#{@parent.name}" } ]: [] ).to_json }  %>    <% end %>     <%= form.actions do %> @@ -13,20 +13,6 @@  </div>  <% end %> -<script> -	$(function() { -		$( "#stop_area_parent_id" ).tokenInput('<%= referential_stop_area_stop_area_parents_path(@referential, @stop_area, :format => :json) %>', { -       crossDomain: false, -       prePopulate: $('#stop_area_parent_id').data('pre'), -       tokenLimit: 1, -       minChars: 3, -       hintText: '<%= t('search_hint') %>', -       noResultsText: '<%= t('no_result_text') %>', -       searchingText: '<%= t('searching_term') %>' -    }); -	}); -</script> -  <% content_for :sidebar do %>  <ul class="actions">  </ul> diff --git a/app/views/stop_points/_stop_point.html.erb b/app/views/stop_points/_stop_point.html.erb index 641ddf683..4fa01d060 100644 --- a/app/views/stop_points/_stop_point.html.erb +++ b/app/views/stop_points/_stop_point.html.erb @@ -13,7 +13,12 @@        <%= t('.lines') %> <% stop_point.stop_area.lines.reject { |l| l.id==@line.id}.each do |line| %>          <span class="line"><%= line.number %></span>        <% end %> - +      <% if stop_point.stop_area.zip_code.blank? %>        <%= stop_point.stop_area.human_attribute_name('country_code') %> <%= stop_point.stop_area.country_code %> +      <% else %> +      <%= stop_point.stop_area.zip_code %> +      <% end %>  +      <%= stop_point.stop_area.city_name %>      </p>    </div>  <% end %> diff --git a/config/deploy/unstable.rb b/config/deploy/unstable.rb index 82b4724db..0c19b9fbc 100644 --- a/config/deploy/unstable.rb +++ b/config/deploy/unstable.rb @@ -1,2 +1,2 @@  server "chouette-p.aix.cityway.fr", :app, :web, :db, :primary => true -set :branch, "master" +set :branch, "sismo" | 
