diff options
| author | jpl | 2016-08-03 15:00:41 +0200 |
|---|---|---|
| committer | jpl | 2016-08-03 15:00:41 +0200 |
| commit | cc3d149d794444fe4c504234563b32c12652d8a7 (patch) | |
| tree | 64c660a34f2694ebd4536d5ad2d22b7c37f61f1b | |
| parent | c77addaa884b17399e9daf25204cda583eecbedc (diff) | |
| download | chouette-core-cc3d149d794444fe4c504234563b32c12652d8a7.tar.bz2 | |
Refs #1295: convert erb to slim (routes)
| -rw-r--r-- | app/views/routes/_form.html.erb | 101 | ||||
| -rw-r--r-- | app/views/routes/_form.html.slim | 91 | ||||
| -rw-r--r-- | app/views/routes/_route.html.erb | 54 | ||||
| -rw-r--r-- | app/views/routes/_route.html.slim | 43 | ||||
| -rw-r--r-- | app/views/routes/_stop_point_fields.html.erb | 19 | ||||
| -rw-r--r-- | app/views/routes/_stop_point_fields.html.slim | 16 | ||||
| -rw-r--r-- | app/views/routes/edit.html.erb | 4 | ||||
| -rw-r--r-- | app/views/routes/edit.html.slim | 3 | ||||
| -rw-r--r-- | app/views/routes/edit_boarding_alighting.html.erb | 27 | ||||
| -rw-r--r-- | app/views/routes/edit_boarding_alighting.html.slim | 19 | ||||
| -rw-r--r-- | app/views/routes/new.html.erb | 4 | ||||
| -rw-r--r-- | app/views/routes/new.html.slim | 3 | ||||
| -rw-r--r-- | app/views/routes/show.html.erb | 118 | ||||
| -rw-r--r-- | app/views/routes/show.html.slim | 90 | ||||
| -rw-r--r-- | app/views/routes/show.kml.erb | 23 | ||||
| -rw-r--r-- | app/views/routes/show.kml.slim | 20 |
16 files changed, 285 insertions, 350 deletions
diff --git a/app/views/routes/_form.html.erb b/app/views/routes/_form.html.erb deleted file mode 100644 index d642efe88..000000000 --- a/app/views/routes/_form.html.erb +++ /dev/null @@ -1,101 +0,0 @@ -<%= semantic_form_for [@referential, @line, @route] do |form| %> - <%= form.inputs do %> - <%= form.input :name %> - <%= form.input :published_name %> - <%= form.input :number %> - <%= form.input :comment %> - <%= form.input :opposite_route, :as => :select, :collection => @line.routes.select { |r| r.id != @route.id } %> - <%= form.input :direction_code, :as => :select, :collection => Chouette::Route.directions, :include_blank => false, :member_label => Proc.new { |mode| t("directions.label.#{mode}") } %> - <%= form.input :wayback_code, :as => :select, :collection => Chouette::Route.waybacks, :include_blank => false, :member_label => Proc.new { |mode| t("waybacks.label.#{mode}") } %> - <%= form.input :objectid, :required => !@route.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.route.objectid")} %> - <% end %> - <div id="stop_points"> - <%= form.semantic_fields_for :stop_points, :include_id => false do |p| %> - <%= render "stop_point_fields", :f => p %> - <% end %> - <div class="links"> - <%= link_to_add_association t("routes.actions.add_stop_point"), form, :stop_points, :class => 'add_stop_point add' %> - <br/> - <%= link_to t('routes.actions.new_stop_point'), new_referential_stop_area_path(@referential), {:class => "add", :target => "_blank"} %> - </div> - </div> - - <%= form.actions do %> - <%= form.action :submit, :as => :button %> - <%= form.action :cancel, :as => :link %> - <% end %> -<% end %> -<script> - -$(document).ready( function() { - var stop_point_ids = []; - - 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() { - stop_point_ids = $.map($('#stop_points input[type="hidden"][class="stop_point_id"]'), function(element, index) { - return $(element).val(); - }); - // console.log( "before-remove"); - // console.log( stop_point_ids); - }; - - $('#stop_points').sortable({ - axis: 'y', - dropOnEmpty: false, - handle: '.handle', - cursor: 'crosshair', - items: '.stop_point', - opacity: 0.4, - scroll: true, - start: function( event, ui ) { - empty_stop_point_ids(); - }, - update: function( event, ui ) { - write_stop_point_ids(); - order_position(); - } - }); - - $('#stop_points').bind("cocoon:after-insert", function(event, insertedItem) { - - var new_stop_count = $('div.nested-fields.stop_point').size(); - var cocoonId = insertedItem.find("input.new_stop_point").attr("id").match( /route_stop_points_attributes_(\d+)_stop_area_id/)[1]; - insertedItem.find('input').each( function(index,e){ - var old = $(e).attr("name"); - if (old!=undefined) { - $(e).attr("name", old.replace( cocoonId, new_stop_count - 1)); - } - }); - - //console.log( "cocoonId="+cocoonId+", new_stop_count="+new_stop_count); - order_position(); - }); - - $('#stop_points').on("cocoon:before-remove", empty_stop_point_ids); - - $('#stop_points').on("cocoon:after-remove", function() { - write_stop_point_ids(); - order_position(); - }); -}); - - - - -</script> diff --git a/app/views/routes/_form.html.slim b/app/views/routes/_form.html.slim new file mode 100644 index 000000000..329862955 --- /dev/null +++ b/app/views/routes/_form.html.slim @@ -0,0 +1,91 @@ += semantic_form_for [@referential, @line, @route] do |form| + = form.inputs do + = form.input :name + = form.input :published_name + = form.input :number + = form.input :comment + = form.input :opposite_route, as: :select, :collection => @line.routes.select { |r| r.id != @route.id } + = form.input :direction_code, as: :select, :collection => Chouette::Route.directions, :include_blank => false, :member_label => Proc.new { |mode| t("directions.label.#{mode}") } + = form.input :wayback_code, as: :select, :collection => Chouette::Route.waybacks, :include_blank => false, :member_label => Proc.new { |mode| t("waybacks.label.#{mode}") } + = form.input :objectid, :required => !@route.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.route.objectid")} + + #stop_points + = form.semantic_fields_for :stop_points, :include_id => false do |p| + == render "stop_point_fields", f: p + + .links + = link_to_add_association t("routes.actions.add_stop_point"), form, :stop_points, class: 'add_stop_point add' + br + = link_to t('routes.actions.new_stop_point'), new_referential_stop_area_path(@referential), { class: 'add', target: '_blank' } + + = form.actions do + = form.action :submit, as: :button + = form.action :cancel, as: :link + +javascript: + $(document).ready(function() { + var stop_point_ids = []; + + 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() { + stop_point_ids = $.map($('#stop_points input[type="hidden"][class="stop_point_id"]'), function(element, index) { + return $(element).val(); + }); + // console.log( "before-remove"); + // console.log( stop_point_ids); + }; + + $('#stop_points').sortable({ + axis: 'y', + dropOnEmpty: false, + handle: '.handle', + cursor: 'crosshair', + items: '.stop_point', + opacity: 0.4, + scroll: true, + start: function( event, ui ) { + empty_stop_point_ids(); + }, + update: function( event, ui ) { + write_stop_point_ids(); + order_position(); + } + }); + + $('#stop_points').bind("cocoon:after-insert", function(event, insertedItem) { + var new_stop_count = $('div.nested-fields.stop_point').size(); + var cocoonId = insertedItem.find("input.new_stop_point").attr("id").match( /route_stop_points_attributes_(\d+)_stop_area_id/)[1]; + insertedItem.find('input').each( function(index,e){ + var old = $(e).attr("name"); + if (old!=undefined) { + $(e).attr("name", old.replace( cocoonId, new_stop_count - 1)); + } + }); + + //console.log( "cocoonId="+cocoonId+", new_stop_count="+new_stop_count); + order_position(); + }); + + $('#stop_points').on("cocoon:before-remove", empty_stop_point_ids); + + $('#stop_points').on("cocoon:after-remove", function() { + write_stop_point_ids(); + order_position(); + }); + });
\ No newline at end of file diff --git a/app/views/routes/_route.html.erb b/app/views/routes/_route.html.erb deleted file mode 100644 index d428d5b38..000000000 --- a/app/views/routes/_route.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -<div id="index_item" class="panel panel-default route"> - <div class="panel-heading"> - <div class="panel-title clearfix"> - <span class="pull-right"> - <%= link_to edit_referential_line_route_path(@referential, @line, route), :class => "btn btn-default btn-sm" do %> - <span class="fa fa-pencil"></span> - <% end %> - <%= link_to referential_line_route_path(@referential, @line, route), :method => :delete, :data => {:confirm => t('routes.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %> - <span class="fa fa-trash-o"></span> - <% end %> - </span> - <h5> - <%= link_to([@referential, @line, route], :class => "preview", :title => "#{Chouette::Route.model_name.human.capitalize} #{route.name}") do %> - <span class="name"> - <% if ( route.wayback_code ) %> - <%= fonticon_wayback(route.wayback) %> - <% end %> - <%= truncate(route.name, :length => 20) %> - </span> - <% end %> - </h5> - </div> - </div> - <div class="panel-body"> - <p> - <% if route.journey_patterns.size > 0 %> - <i class="fa fa-clock-o"></i> - <%= link_to t("vehicle_journeys.actions.index"), referential_line_route_vehicle_journeys_path(@referential, @line, route) %> - <% else %> - <%= t('.no_journey_pattern')%> - <% end%> - </p> - <% if exist_vehicle_journey_frequencies?(route) %> - <p> - <i class="fa fa-clock-o"></i> - <%= link_to t("vehicle_journey_frequencies.actions.index"), referential_line_route_vehicle_journey_frequencies_path(@referential, @line, route) %> - </p> - <% end %> - <p> - <% if route.opposite_route %> - <%= fonticon_wayback(route.opposite_route.wayback) %><%= link_to truncate(route.opposite_route.name, :length => 30), referential_line_route_path( @referential, @line, route.opposite_route) %> - <% else %> - <%= t('.no_opposite') %> - <% end %> - </p> - <p> - <% if ! route.direction.blank? %> - <%= route.human_attribute_name('direction_code') %> : <%= t('directions.label.'+route.direction_code) %> - <% else %> - <br> - <% end %> - </p> - </div> -</div> diff --git a/app/views/routes/_route.html.slim b/app/views/routes/_route.html.slim new file mode 100644 index 000000000..fd740fa9b --- /dev/null +++ b/app/views/routes/_route.html.slim @@ -0,0 +1,43 @@ +#index_item.panel.panel-default.route + .panel-heading + .panel-title.clearfix + span.pull-right + = link_to edit_referential_line_route_path(@referential, @line, route), class: 'btn btn-default btn-sm' do + span.fa.fa-pencil + + = link_to referential_line_route_path(@referential, @line, route), method: :delete, :data => {:confirm => t('routes.actions.destroy_confirm')}, class: 'btn btn-danger btn-sm' do + span.fa.fa-trash-o + + h5 + = link_to [@referential, @line, route], class: 'preview', title: "#{Chouette::Route.model_name.human.capitalize} #{route.name}" do + span.name + - if route.wayback_code + = fonticon_wayback(route.wayback) + + = truncate(route.name, length: 20) + + .panel-body + p + - if route.journey_patterns.size > 0 + i.fa.fa-clock-o + = link_to t("vehicle_journeys.actions.index"), referential_line_route_vehicle_journeys_path(@referential, @line, route) + - else + = t('.no_journey_pattern') + + - if exist_vehicle_journey_frequencies?(route) + p + i.fa.fa-clock-o + = link_to t("vehicle_journey_frequencies.actions.index"), referential_line_route_vehicle_journey_frequencies_path(@referential, @line, route) + + p + - if route.opposite_route + = fonticon_wayback(route.opposite_route.wayback) + = link_to truncate(route.opposite_route.name, :length => 30), referential_line_route_path( @referential, @line, route.opposite_route) + - else + = t('.no_opposite') + + p + - if !route.direction.blank? + = "#{route.human_attribute_name('direction_code')} : #{t('directions.label.'+route.direction_code)}" + - else + br
\ No newline at end of file diff --git a/app/views/routes/_stop_point_fields.html.erb b/app/views/routes/_stop_point_fields.html.erb deleted file mode 100644 index 73ac69152..000000000 --- a/app/views/routes/_stop_point_fields.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<div class="nested-fields stop_point row"> - <%= f.inputs do %> - <div class="col-md-1 resize"> - <%= link_to_remove_association "<i class='fa fa-trash-o'></i>".html_safe, f %> - <span class="handle" alt="<%= t('stop_points.index.move') %>" title="<%= t('stop_points.index.move') %>" ><i class='fa fa-arrows'></i></span> - </div> - <div class="col-md-11"> - <% 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" } %> - <%= f.input :stop_area_id, :label => false, :as => :search_stop_area, :json => referential_autocomplete_stop_areas_path(@referential, :format => :json)+"?filter=physical", :hint_text => t('search_hint'), :no_result_text => t('no_result_text'),:searching_text => t('searching_term'), :tokenLimit => 1, :input_html => { :class => "new_stop_point stop_area_id", :"data-pre" => Rabl::Renderer.new('autocomplete_stop_areas/index', [f.object.stop_area].compact, :view_path => 'app/views', :format => :json, :scope => self ).render } %> - <% else %> - <%= f.input :id, :as => :hidden, :input_html => { :class => "stop_point_id" } %> - <%= f.input :position, :as => :hidden, :input_html => { :class => "position" } %> - <%= f.input :stop_area_id, :label => false, :as => :search_stop_area, :json => referential_autocomplete_stop_areas_path(@referential, :format => :json)+"?filter=physical", :hint_text => t('search_hint'), :no_result_text => t('no_result_text'),:searching_text => t('searching_term'), :tokenLimit => 1, :input_html => { :class => "stop_area_id", :"data-pre" => Rabl::Renderer.new('autocomplete_stop_areas/index', [f.object.stop_area].compact, :view_path => 'app/views', :format => :json, :scope => self ).render } %> - <% end %> - </div> - <% end %> -</div> diff --git a/app/views/routes/_stop_point_fields.html.slim b/app/views/routes/_stop_point_fields.html.slim new file mode 100644 index 000000000..814e882c2 --- /dev/null +++ b/app/views/routes/_stop_point_fields.html.slim @@ -0,0 +1,16 @@ +.nested-fields.stop_point.row + = f.inputs do + .col-md-1.resize + = link_to_remove_association "<i class='fa fa-trash-o'></i>".html_safe, f + span.handle alt="#{t('stop_points.index.move')}" title="#{t('stop_points.index.move')}" > + i.fa.fa-arrows + + .col-md-11 + - 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" } + = f.input :stop_area_id, :label => false, as: :search_stop_area, :json => referential_autocomplete_stop_areas_path(@referential, :format => :json)+"?filter=physical", :hint_text => t('search_hint'), :no_result_text => t('no_result_text'),:searching_text => t('searching_term'), :tokenLimit => 1, :input_html => { :class => "new_stop_point stop_area_id", :"data-pre" => Rabl::Renderer.new('autocomplete_stop_areas/index', [f.object.stop_area].compact, :view_path => 'app/views', :format => :json, :scope => self ).render } + - else + = f.input :id, as: :hidden, :input_html => { class: 'stop_point_id' } + = f.input :position, as: :hidden, :input_html => { class: 'position' } + = f.input :stop_area_id, label: false, as: :search_stop_area, :json => referential_autocomplete_stop_areas_path(@referential, :format => :json)+"?filter=physical", :hint_text => t('search_hint'), :no_result_text => t('no_result_text'),:searching_text => t('searching_term'), :tokenLimit => 1, :input_html => { :class => "stop_area_id", :"data-pre" => Rabl::Renderer.new('autocomplete_stop_areas/index', [f.object.stop_area].compact, :view_path => 'app/views', :format => :json, :scope => self ).render }
\ No newline at end of file diff --git a/app/views/routes/edit.html.erb b/app/views/routes/edit.html.erb deleted file mode 100644 index dcfa0e8da..000000000 --- a/app/views/routes/edit.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= title_tag t('routes.edit.title', :route => @route.name ) %> - -<%= render "form" %> - diff --git a/app/views/routes/edit.html.slim b/app/views/routes/edit.html.slim new file mode 100644 index 000000000..7e2c1f982 --- /dev/null +++ b/app/views/routes/edit.html.slim @@ -0,0 +1,3 @@ += title_tag t('routes.edit.title', route: @route.name ) + +== render 'form'
\ No newline at end of file diff --git a/app/views/routes/edit_boarding_alighting.html.erb b/app/views/routes/edit_boarding_alighting.html.erb deleted file mode 100644 index 1b46cda5a..000000000 --- a/app/views/routes/edit_boarding_alighting.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= title_tag t('routes.edit_boarding_alighting.title', :route => @route.name ) %> - -<%= simple_form_for ["save_boarding_alighting", @referential, @line, @route], :method => :PUT do |form| %> -<table class="table table-hover"> - <thead> - <th><%= t(".stop_area_name") %></th> - <th><%= t(".for_boarding") %></th> - <th><%= t(".for_alighting") %></th> - </thead> - <tbody> - <%= form.simple_fields_for :stop_points do |stop_points_form| %> - <tr> - <td> - <%= explicit_name(stop_points_form.object.stop_area) %> - </td> - <td><%= stop_points_form.input :for_boarding, :label => false, include_blank: t("simple_form.include_blanks.defaults.for_boarding") %></td> - <td><%= stop_points_form.input :for_alighting, :label => false, include_blank: t("simple_form.include_blanks.defaults.for_alighting") %></td> - </tr> - <% end %> - </tbody> -</table> - - <div class="submit"> - <%= form.button :submit, :class => "" %> - <%= link_to t("cancel"), referential_line_route_path(@referential, @line, @route) %> - </div> -<% end %> diff --git a/app/views/routes/edit_boarding_alighting.html.slim b/app/views/routes/edit_boarding_alighting.html.slim new file mode 100644 index 000000000..f4de4b9e6 --- /dev/null +++ b/app/views/routes/edit_boarding_alighting.html.slim @@ -0,0 +1,19 @@ += title_tag t('routes.edit_boarding_alighting.title', :route => @route.name ) + += simple_form_for ["save_boarding_alighting", @referential, @line, @route], :method => :PUT do |form| + table.table.table-hover + thead + th = t(".stop_area_name") + th = t(".for_boarding") + th = t(".for_alighting") + + tbody + = form.simple_fields_for :stop_points do |stop_points_form| + tr + td = explicit_name(stop_points_form.object.stop_area) + td = stop_points_form.input :for_boarding, label: false, include_blank: t("simple_form.include_blanks.defaults.for_boarding") + td = stop_points_form.input :for_alighting, label: false, include_blank: t("simple_form.include_blanks.defaults.for_alighting") + + .submit + = form.button :submit, class: '' + = link_to t("cancel"), referential_line_route_path(@referential, @line, @route)
\ No newline at end of file diff --git a/app/views/routes/new.html.erb b/app/views/routes/new.html.erb deleted file mode 100644 index a144fcdee..000000000 --- a/app/views/routes/new.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= title_tag t('routes.new.title') %> - -<%= render "form" %> - diff --git a/app/views/routes/new.html.slim b/app/views/routes/new.html.slim new file mode 100644 index 000000000..e91ebf362 --- /dev/null +++ b/app/views/routes/new.html.slim @@ -0,0 +1,3 @@ += title_tag t('routes.new.title') + +== render 'form'
\ No newline at end of file diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb deleted file mode 100644 index d8c8e2498..000000000 --- a/app/views/routes/show.html.erb +++ /dev/null @@ -1,118 +0,0 @@ -<%= title_tag t('routes.show.title', :route => @route.name, :line => @route.line.name ) %> - -<div class="route_show"> - <%= @map.to_html %> - - <div class="summary"> - <p> - <label><%= @route.human_attribute_name(:name) %>: </label> - <%= @route.name %> - </p> - <p> - <label><%= @route.human_attribute_name(:published_name) %>: </label> - <%= @route.published_name %> - </p> - <p> - <label><%= @route.human_attribute_name(:number) %>: </label> - <%= @route.number %> - </p> - <p> - <label><%= @route.human_attribute_name(:comment) %>: </label> - <%= @route.comment %> - </p> - <p> - <label><%= @route.human_attribute_name(:direction_code) %>: </label> - <% if @route.direction_code %> - <%= t("directions.label.#{@route.direction_code}").capitalize %> - <% else %> - <%= t(".undefined") %> - <% end %> - </p> - <p> - <label><%= @route.human_attribute_name(:wayback_code) %>: </label> - <% if @route.wayback_code %> - <%= t("waybacks.label.#{@route.wayback_code}").capitalize %> - <% else %> - <%= t(".undefined") %> - <% end %> - </p> - <p> - <label><%= @route.human_attribute_name(:opposite_route) %>: </label> - <% if @route.opposite_route %> - <%= link_to @route.opposite_route.name, [@referential, @line, @route.opposite_route] %> - <% else %> - <%= t(".no_opposite_route") %> - <% end %> - </p> - </div> - -</div> - -<p class="after_map" /> - -<div class="panel-group" id="accordion"> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#stop_points"> - <%= t('.stop_points') %> - </a> - </h4> - </div> - <div id="stop_points" class="panel-collapse collapse"> - <div class="panel-body"> - <div class="stop_points paginated_content"> - <%= paginated_content( @route.stop_points, "stop_points/stop_point") %> - </div> - </div> - </div> - </div> -</div> - -<div class="panel-group" id="accordion"> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#journey_patterns"> - <%= t('.journey_patterns') %> - </a> - </h4> - </div> - <div id="journey_patterns" class="panel-collapse collapse"> - <div class="panel-body"> - <div class="journey_patterns paginated_content"> - <%= paginated_content( @route.journey_patterns, "journey_patterns/journey_pattern") %> - </div> - </div> - </div> - </div> -</div> - -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), :class => "add" %></li> - <li><%= link_to t('routes.actions.edit'), edit_referential_line_route_path(@referential, @line, @route), :class => "edit" %></li> - <li><%= link_to t('routes.actions.destroy'), referential_line_route_path(@referential, @line, @route), :method => :delete, :data => {:confirm => t('routes.actions.destroy_confirm')}, :class => "remove" %></li> -</ul> -<ul class="actions"> - <% if @route.stop_points.size >= 2 %> - <li><%= link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), :class => "add" %></li> - <% end %> - <% if @route.stop_points.present? %> - <li><%= link_to t('routes.actions.edit_boarding_alighting'), edit_boarding_alighting_referential_line_route_path(@referential, @line, @route), :class => "edit" %></li> - <% end %> - <% if @route.journey_patterns.size > 0 %> - <li> - <%= link_to t('vehicle_journeys.actions.index'), [@referential, @line, @route, :vehicle_journeys], :class => "clock" %> - </li> - <% end %> -</ul> - -<ul class="actions"> - <li><%= link_to t('vehicle_journey_imports.new.title'), new_referential_line_route_vehicle_journey_import_path( @referential, @line, @route ), :class => "import" %></li> - <li><%= link_to t('vehicle_journey_exports.new.title'), referential_line_route_vehicle_journey_exports_path(@referential, @line, @route, :format => :zip), :class => "export" %></li> -</ul> - -<%= creation_tag(@route) %> -<% end %> - diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim new file mode 100644 index 000000000..a4e1aa90f --- /dev/null +++ b/app/views/routes/show.html.slim @@ -0,0 +1,90 @@ += title_tag t('routes.show.title', route: @route.name, line: @route.line.name ) + +.route_show + = @map.to_html + + .summary + p + label = "#{@route.human_attribute_name(:name)} : " + = @route.name + + p + label = "#{@route.human_attribute_name(:published_name)} : " + = @route.published_name + + p + label = "#{@route.human_attribute_name(:number)} : " + = @route.number + + p + label = "#{@route.human_attribute_name(:comment)} : " + = @route.comment + + p + label = "#{@route.human_attribute_name(:direction_code)} : " + - if @route.direction_code + = t("directions.label.#{@route.direction_code}").capitalize + - else + = t(".undefined") + + p + label = "#{@route.human_attribute_name(:wayback_code)} : " + - if @route.wayback_code + = t("waybacks.label.#{@route.wayback_code}").capitalize + - else + = t(".undefined") + + p + label = "#{@route.human_attribute_name(:opposite_route)} : " + - if @route.opposite_route + = link_to @route.opposite_route.name, [@referential, @line, @route.opposite_route] + - else + = t(".no_opposite_route") + +p.after_map + +#accordion.panel-group + .panel.panel-default + .panel-heading + h4.panel-title + a data-toggle="collapse" data-parent="#accordion" href="#stop_points" + = t('.stop_points') + + #stop_points.panel-collapse.collapse + .panel-body + .stop_points.paginated_content + = paginated_content(@route.stop_points, "stop_points/stop_point") + +#accordion.panel-group + .panel.panel-default + .panel-heading + h4.panel-title + a data-toggle="collapse" data-parent="#accordion" href="#journey_patterns" + = t('.journey_patterns') + + #journey_patterns.panel-collapse.collapse + .panel-body + .journey_patterns.paginated_content + = paginated_content( @route.journey_patterns, "journey_patterns/journey_pattern") + +- content_for :sidebar do + ul.actions + li = link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), class: 'add' + li = link_to t('routes.actions.edit'), edit_referential_line_route_path(@referential, @line, @route), class: 'edit' + li = link_to t('routes.actions.destroy'), referential_line_route_path(@referential, @line, @route), method: :delete, :data => {:confirm => t('routes.actions.destroy_confirm')}, class: 'remove' + + ul.actions + - if @route.stop_points.size >= 2 + li = link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), class: 'add' + + - if @route.stop_points.present? + li = link_to t('routes.actions.edit_boarding_alighting'), edit_boarding_alighting_referential_line_route_path(@referential, @line, @route), class: 'edit' + + - if @route.journey_patterns.size > 0 + li = link_to t('vehicle_journeys.actions.index'), [@referential, @line, @route, :vehicle_journeys], class: 'clock' + + ul.actions + li = link_to t('vehicle_journey_imports.new.title'), new_referential_line_route_vehicle_journey_import_path( @referential, @line, @route ), class: 'import' + li = link_to t('vehicle_journey_exports.new.title'), referential_line_route_vehicle_journey_exports_path(@referential, @line, @route, format: :zip), class: 'export' + + = creation_tag(@route)
\ No newline at end of file diff --git a/app/views/routes/show.kml.erb b/app/views/routes/show.kml.erb deleted file mode 100644 index e6ef8b81d..000000000 --- a/app/views/routes/show.kml.erb +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<kml xmlns="http://www.opengis.net/kml/2.2"> - <Document> - <Placemark id="route_<%= @route.id %>" > - <name><%= @route.name %></name> - <inactive>true</inactive> - <%= @route.geometry.kml_representation.html_safe %> - </Placemark> - <% @route.stop_areas.where("latitude is not null and longitude is not null").each_with_index do |stop_area, index| %> - <Placemark id="<%= stop_area.id %>" > - <name><%= "#{stop_area.name} (#{index+1})" %></name> - <stop_area_type_label><%= t("area_types.label.#{stop_area.stop_area_type}") %></stop_area_type_label> - <% if stop_area.id==@route.stop_areas.first.id %> - <departure>true</departure> - <% elsif stop_area.id==@route.stop_areas.last.id %> - <arrival>true</arrival> - <% end %> - <%= stop_area.geometry.kml_representation.html_safe %> - </Placemark> - <% end %> - </Document> -</kml> - diff --git a/app/views/routes/show.kml.slim b/app/views/routes/show.kml.slim new file mode 100644 index 000000000..b597e2b66 --- /dev/null +++ b/app/views/routes/show.kml.slim @@ -0,0 +1,20 @@ +doctype XML + +kml xmlns="http://www.opengis.net/kml/2.2" + document + placemark id="route_#{@route.id}" + name = @route.name + inactive true + = @route.geometry.kml_representation.html_safe + + - @route.stop_areas.where("latitude is not null and longitude is not null").each_with_index do |stop_area, index| + placemark id="#{stop_area.id}" + name = "#{stop_area.name} (#{index+1})" + stop_area_type_label = t("area_types.label.#{stop_area.stop_area_type}") + + - if stop_area.id==@route.stop_areas.first.id + departure true + - elsif stop_area.id==@route.stop_areas.last.id + arrival true + + = stop_area.geometry.kml_representation.html_safe
\ No newline at end of file |
