From 9476ef8d8d93914b6bcb64ed6eb65b60e8beb086 Mon Sep 17 00:00:00 2001 From: jpl Date: Mon, 1 Aug 2016 16:15:30 +0200 Subject: Refs #1295: convert erb to slim (lines) --- app/views/group_of_lines/_lines_detail.html.slim | 2 +- app/views/lines/_form.erb | 54 --------- app/views/lines/_form.html.slim | 45 +++++++ app/views/lines/_line.erb | 52 -------- app/views/lines/_line.html.slim | 50 ++++++++ app/views/lines/_lines.html.erb | 9 -- app/views/lines/_lines.html.slim | 9 ++ app/views/lines/edit.html.erb | 3 - app/views/lines/edit.html.slim | 3 + app/views/lines/index.html.erb | 52 -------- app/views/lines/index.html.slim | 49 ++++++++ app/views/lines/index.js.erb | 1 - app/views/lines/index.js.slim | 1 + app/views/lines/new.html.erb | 3 - app/views/lines/new.html.slim | 3 + app/views/lines/show.html.erb | 141 ---------------------- app/views/lines/show.html.slim | 144 +++++++++++++++++++++++ app/views/lines/show.kml.erb | 14 --- app/views/lines/show.kml.slim | 10 ++ 19 files changed, 315 insertions(+), 330 deletions(-) delete mode 100644 app/views/lines/_form.erb create mode 100644 app/views/lines/_form.html.slim delete mode 100644 app/views/lines/_line.erb create mode 100644 app/views/lines/_line.html.slim delete mode 100644 app/views/lines/_lines.html.erb create mode 100644 app/views/lines/_lines.html.slim delete mode 100644 app/views/lines/edit.html.erb create mode 100644 app/views/lines/edit.html.slim delete mode 100644 app/views/lines/index.html.erb create mode 100644 app/views/lines/index.html.slim delete mode 100644 app/views/lines/index.js.erb create mode 100644 app/views/lines/index.js.slim delete mode 100644 app/views/lines/new.html.erb create mode 100644 app/views/lines/new.html.slim delete mode 100644 app/views/lines/show.html.erb create mode 100644 app/views/lines/show.html.slim delete mode 100644 app/views/lines/show.kml.erb create mode 100644 app/views/lines/show.kml.slim diff --git a/app/views/group_of_lines/_lines_detail.html.slim b/app/views/group_of_lines/_lines_detail.html.slim index b0a885644..f6e9b386e 100644 --- a/app/views/group_of_lines/_lines_detail.html.slim +++ b/app/views/group_of_lines/_lines_detail.html.slim @@ -1,2 +1,2 @@ .lines.paginated_content - = paginated_content @lines, "lines/line", :delete => false \ No newline at end of file + = paginated_content @lines, "lines/line", delete: false \ No newline at end of file diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb deleted file mode 100644 index c2af9d6b8..000000000 --- a/app/views/lines/_form.erb +++ /dev/null @@ -1,54 +0,0 @@ -<%= semantic_form_for [@line_referential, @line] do |form| %> - <%= form.inputs do %> - <%= form.input :network, :as => :select, :collection => Chouette::Network.all, :include_blank => false %> - <%= form.input :company, :as => :select, :collection => Chouette::Company.all, :include_blank => false%> - <%= form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.name") } %> - <%= form.input :published_name %> - <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.registration_number")} %> - <%= form.input :number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.number") } %> - <%= form.input :transport_mode, :as => :select, :collection => Chouette::Line.transport_modes, :include_blank => false, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") } %> - <%= form.input :color, :as => :string %> - <%= form.input :text_color %> - <%= form.input :stable_id %> - <%= form.input :url %> - <%= form.input :mobility_restricted_suitability, :as => :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true %> - <%= form.input :flexible_service, :as => :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true %> - <%= form.input :comment %> - <%= form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.objectid")} %> - <%= form.input :group_of_line_tokens, :label => t('.group_of_lines'), :as => :text, :input_html => { :"data-pre" => ( @line.group_of_lines.map { |group_of_line| { :id => group_of_line.id, :name => group_of_line.name } } ).to_json } %> - -
-

<%= t("footnotes.index.title") %>

-
- <%= form.semantic_fields_for :footnotes do |f| %> - <%= render "footnotes/footnote_fields", :f => f %> - <% end %> -
-
- <%= link_to_add_association t("footnotes.actions.add_footnote"), form, :footnotes , - :partial => "footnotes/footnote_fields", - :"data-association-insertion-method" => "append", - :"data-association-insertion-node" => "div#footnotes", :class => "add" %> -
-
- <% end %> - - <%= form.actions do %> - <%= form.action :submit, :as => :button %> - <%= form.action :cancel, :as => :link %> - <% end %> -<% end %> - - diff --git a/app/views/lines/_form.html.slim b/app/views/lines/_form.html.slim new file mode 100644 index 000000000..113a5c46c --- /dev/null +++ b/app/views/lines/_form.html.slim @@ -0,0 +1,45 @@ += semantic_form_for [@line_referential, @line] do |form| + = form.inputs do + = form.input :network, as: :select, :collection => Chouette::Network.all, include_blank: false + = form.input :company, as: :select, :collection => Chouette::Company.all, include_blank: false + = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.name") } + = form.input :published_name + = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.registration_number")} + = form.input :number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.number") } + = form.input :transport_mode, as: :select, :collection => Chouette::Line.transport_modes, :include_blank => false, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") } + = form.input :color, as: :string + = form.input :text_color + = form.input :stable_id + = form.input :url + = form.input :mobility_restricted_suitability, as: :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true + = form.input :flexible_service, as: :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true + = form.input :comment + = form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.objectid")} + = form.input :group_of_line_tokens, :label => t('.group_of_lines'), as: :text, :input_html => { :"data-pre" => ( @line.group_of_lines.map { |group_of_line| { :id => group_of_line.id, :name => group_of_line.name } } ).to_json } + + .footnotes_block + h3 = t("footnotes.index.title") + + #footnotes + = form.semantic_fields_for :footnotes do |f| + = render "footnotes/footnote_fields", :f => f + + .add_footnote + = link_to_add_association t("footnotes.actions.add_footnote"), form, :footnotes , :partial => "footnotes/footnote_fields", :"data-association-insertion-method" => "append", :"data-association-insertion-node" => "div#footnotes", class: 'add' + + = form.actions do + = form.action :submit, as: :button + = form.action :cancel, as: :link + +javascript: + $(function() { + $("#line_group_of_line_tokens").tokenInput("#{name_filter_referential_group_of_lines_path(@line_referential, format: :json)}", { + crossDomain: false, + prePopulate: $('#group_of_line_tokens').data('pre'), + minChars: 3, + preventDuplicates: true, + hintText: "#{I18n.t('search_hint')}", + noResultsText: "#{I18n.t('no_result_text')}", + searchingText: "#{I18n.t('searching_term')}" + }); + }); \ No newline at end of file diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb deleted file mode 100644 index bd3a79d0e..000000000 --- a/app/views/lines/_line.erb +++ /dev/null @@ -1,52 +0,0 @@ -
-
- -
-
-

- <% if line.network.nil? %> - <%= line.human_attribute_name('network') %> <%= t('lines.index.unset') %> - <% else %> - - <%= line.human_attribute_name('network') %> <%#= link_to_if line.network, line.network.name, line_referential_network_path(line.line_referential, line.network), :title => "#{line.human_attribute_name('network')} #{line.network.name}" %> - <% end %> -

-

- <% if line.company.nil? %> - <%= line.human_attribute_name('company') %> <%= t('lines.index.unset') %> - <% else %> - <%= line.human_attribute_name('company') %> <%#= link_to_if( line.company, line.company.name, line_referential_company_path(line.line_referential, line.company), :title => "#{line.human_attribute_name('company')} #{line.company.name}" ) %> - <% end %> -

-

- <% if line.group_of_lines.count == 0 %> -
<%# t('lines.form.no_group_of_line') %> - <% elsif line.group_of_lines.count == 1 %> - <%= line.human_attribute_name('group_of_line') %> - <%= link_to_if( line.group_of_lines.first, line.group_of_lines.first.name, line_referential_group_of_line_path(line.line_referential, line.group_of_lines.first), :title => "#{line.human_attribute_name('group_of_line')} #{line.group_of_lines.first.name}") %> - <% else %> - <%= t('lines.form.several_group_of_lines', :count => line.group_of_lines.count) %> - <% end %> -

-
-
diff --git a/app/views/lines/_line.html.slim b/app/views/lines/_line.html.slim new file mode 100644 index 000000000..26c630338 --- /dev/null +++ b/app/views/lines/_line.html.slim @@ -0,0 +1,50 @@ +#index_item.panel.panel-default.line.ce-LineBlock + .panel-heading.ce-LineBlock-header + ul.ce-LineBlock-header-list + li + = check_box_tag "ids[]", line.id, false, class: "multiple_selection", style: "display: none;" + + - if (line.number && line.number.length <= 3) + span.label.label-default.line_number style="#{number_style(line)}" + = line.number + + li + = link_to([line.line_referential, line], class: 'preview', title: "#{Chouette::Line.model_name.human.capitalize} #{line.name}") do + h5.ce-LineBlock-header-title = truncate(line.name, length: 24) + + li + - if edit + = link_to edit_line_referential_line_path(line.line_referential, line), class: 'btn btn-default btn-sm' do + span.fa.fa-pencil + + - if delete + = link_to line_referential_line_path(line.line_referential, line), method: :delete, data: { confirm: t('lines.actions.destroy_confirm') }, class: 'btn btn-danger btn-sm' do + span.fa.fa-trash-o + + .panel-body + p + - if line.network.nil? + = line.human_attribute_name('network') + = t('lines.index.unset') + - else + / FIXME #825 + = line.human_attribute_name('network') + / = link_to_if line.network, line.network.name, line_referential_network_path(line.line_referential, line.network), :title => "#{line.human_attribute_name('network')} #{line.network.name}" + + p + - if line.company.nil? + = line.human_attribute_name('company') + = t('lines.index.unset') + - else + = line.human_attribute_name('company') + / = link_to_if( line.company, line.company.name, line_referential_company_path(line.line_referential, line.company), :title => "#{line.human_attribute_name('company')} #{line.company.name}" ) + + p + - if line.group_of_lines.count == 0 + br + / = t('lines.form.no_group_of_line') + - elsif line.group_of_lines.count == 1 + = line.human_attribute_name('group_of_line') + = link_to_if( line.group_of_lines.first, line.group_of_lines.first.name, line_referential_group_of_line_path(line.line_referential, line.group_of_lines.first), :title => "#{line.human_attribute_name('group_of_line')} #{line.group_of_lines.first.name}") + - else + = t('lines.form.several_group_of_lines', :count => line.group_of_lines.count) \ No newline at end of file diff --git a/app/views/lines/_lines.html.erb b/app/views/lines/_lines.html.erb deleted file mode 100644 index a4d9a3f0b..000000000 --- a/app/views/lines/_lines.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
- <%= t("will_paginate.page_entries_info.search") %> <%= page_entries_info @lines %> -
-
- <%= paginated_content(@lines) %> -
- diff --git a/app/views/lines/_lines.html.slim b/app/views/lines/_lines.html.slim new file mode 100644 index 000000000..7de88c2c3 --- /dev/null +++ b/app/views/lines/_lines.html.slim @@ -0,0 +1,9 @@ +.page_info + span.search = t("will_paginate.page_entries_info.search") + = page_entries_info @lines + +.lines.paginated_content + = paginated_content(@lines) + +.pagination + = will_paginate @lines, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer \ No newline at end of file diff --git a/app/views/lines/edit.html.erb b/app/views/lines/edit.html.erb deleted file mode 100644 index d2c9880ae..000000000 --- a/app/views/lines/edit.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= title_tag t('lines.edit.title', :line => @line.name ) %> - -<%= render "form" %> diff --git a/app/views/lines/edit.html.slim b/app/views/lines/edit.html.slim new file mode 100644 index 000000000..0036d023b --- /dev/null +++ b/app/views/lines/edit.html.slim @@ -0,0 +1,3 @@ += title_tag t('lines.edit.title', line: @line.name) + += render 'form' \ No newline at end of file diff --git a/app/views/lines/index.html.erb b/app/views/lines/index.html.erb deleted file mode 100644 index 0995d0021..000000000 --- a/app/views/lines/index.html.erb +++ /dev/null @@ -1,52 +0,0 @@ -<%= title_tag t('lines.index.title') %> - -<%= search_form_for @q, :url => line_referential_lines_path(@line_referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| %> -
-
-
- <%= f.text_field :name_or_number_cont, :placeholder => "#{t('.name_or_number')}", :class => 'form-control' %> -
- -
-
- - <%= "#{t('.advanced_search')}" %> - -
- - -
-<% end %> - -
<%= render 'lines' %>
- -<% content_for :sidebar do %> - - -
-

<%= t(".multi_selection") %>

-
- <%= t(".multi_selection_enable") %> -
- - -
- -<% end %> diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim new file mode 100644 index 000000000..5892dba36 --- /dev/null +++ b/app/views/lines/index.html.slim @@ -0,0 +1,49 @@ += title_tag t('lines.index.title') + += search_form_for @q, :url => line_referential_lines_path(@line_referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| + .panel.panel-default + .panel-heading + .input-group.col-md-9 + = f.text_field :name_or_number_cont, placeholder: "#{t('.name_or_number')}", class: 'form-control' + .input-group-btn + button.btn.btn-default type="submit" + i.fa.fa-search + + a data-toggle="collapse" data-parent="#search" href="#advanced_search" + i.fa.fa-plus + = "#{t('.advanced_search')}" + + #advanced_search.panel-collapse.collapse + .panel-body + / FIXME #825 + / = f.select(:network_id_eq, @line_referential.networks.collect {|n| [ n.name, n.id ] }.unshift([t('.no_networks'), -1]), {include_blank: t('.all_networks')}, { :class => 'form-control' }) + / = f.select(:company_id_eq, @line_referential.companies.collect {|c| [ c.name, c.id ] }.unshift([t('.no_companies'), -1]), { include_blank: t('.all_companies')}, { :class => 'form-control' }) + / = f.select(:group_of_lines_id_eq, @line_referential.group_of_lines.collect {|c| [ c.name, c.id ] }.unshift([t('.no_group_of_lines'), -1]), {include_blank: t('.all_group_of_lines')}, { :class => 'form-control' }) + +#lines + = render 'lines' + +- content_for :sidebar do + ul.actions + li + = link_to t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'add' + + #multiple_selection_menu + h4 = t('.multi_selection') + + .disabled + a.enable href="#" + = t('.multi_selection_enable') + + .enabled style="display: none;" + a.disable href="#" + = t('.multi_selection_disable') + + ul.actions + = link_to t('.delete_selected'), line_referential_lines_path(@line_referential), "data-multiple-method" => "delete", class: 'remove', "confirmation-text" => t("lines.actions.destroy_selection_confirm") + + a.select_all href="#" + = t('.select_all') + = " | " + a.deselect_all href="#" + = t('.deselect_all') \ No newline at end of file diff --git a/app/views/lines/index.js.erb b/app/views/lines/index.js.erb deleted file mode 100644 index 97595d5e9..000000000 --- a/app/views/lines/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('#lines').html('<%= escape_javascript(render("lines")) %>'); \ No newline at end of file diff --git a/app/views/lines/index.js.slim b/app/views/lines/index.js.slim new file mode 100644 index 000000000..6f760a2e6 --- /dev/null +++ b/app/views/lines/index.js.slim @@ -0,0 +1 @@ +$('#lines').html("#{escape_javascript(render('lines'))}"); \ No newline at end of file diff --git a/app/views/lines/new.html.erb b/app/views/lines/new.html.erb deleted file mode 100644 index 452ec5df2..000000000 --- a/app/views/lines/new.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= title_tag t('lines.new.title') %> - -<%= render "form" %> diff --git a/app/views/lines/new.html.slim b/app/views/lines/new.html.slim new file mode 100644 index 000000000..56da24d7c --- /dev/null +++ b/app/views/lines/new.html.slim @@ -0,0 +1,3 @@ += title_tag t('lines.new.title') + += render 'form' \ No newline at end of file diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb deleted file mode 100644 index 8426319b6..000000000 --- a/app/views/lines/show.html.erb +++ /dev/null @@ -1,141 +0,0 @@ -<% text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" %> -<% bg_color = @line.color.blank? ? "white" : "#"+@line.color %> - -<%= title_tag t('lines.show.title', :line => @line.name ) %> - -
- <%= @map.to_html %> - -
- <% text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" %> - <% bg_color = @line.color.blank? ? "white" : "#"+@line.color %> - <% if colors?(@line) %> -

- - -

- <% end %> -

- - <% if @line.network.nil? %> - <%= t('lines.index.unset') %> - <% else %> - - <%#= link_to @line.network.name, [@referential, @line.network] %> - <% end %> -

-

- - <% if @line.company.nil? %> - <%= t('lines.index.unset') %> - <% else %> - - <%#= link_to @line.company.name, [@referential, @line.company] %> - <% end %> -

-

- - <%= @line.number %> -

-

- - <%= @line.published_name %> -

-

- - <%= @line.registration_number %> -

-

- - <%= t("transport_modes.label.#{@line.transport_mode}") %> -

-

- - <%= @line.stable_id %> -

- -

- - <%= @line.url %> -

- -

- - <% if @line.mobility_restricted_suitability.nil? %> - <%= @line.human_attribute_name("unspecified_mrs") %> - <% elsif @line.mobility_restricted_suitability? %> - <%= @line.human_attribute_name("accessible") %> - <% else %> - <%= @line.human_attribute_name("not_accessible") %> - <% end %> -
  <%= @line.human_attribute_name("number_of_mrs_vj") %> : <%= @line.vehicle_journeys.where("mobility_restricted_suitability = ?", true).count %> -
  <%= @line.human_attribute_name("number_of_non_mrs_vj") %> : <%= @line.vehicle_journeys.where("mobility_restricted_suitability = ?", false).count %> -
  <%= @line.human_attribute_name("number_of_null_mrs_vj") %> : <%= @line.vehicle_journeys.count - - (@line.vehicle_journeys.where("mobility_restricted_suitability = ?", true).count + - @line.vehicle_journeys.where("mobility_restricted_suitability = ?", false).count) %> -

-

- - <% if @line.flexible_service.nil? %> - <%= @line.human_attribute_name("unspecified_fs") %> - <% elsif @line.flexible_service? %> - <%= @line.human_attribute_name("on_demaond_fs") %> - <% else %> - <%= @line.human_attribute_name("regular_fs") %> - <% end %> -
  <%= @line.human_attribute_name("number_of_fs_vj") %> : <%= @line.vehicle_journeys.where("flexible_service = ?", true).count %> -
  <%= @line.human_attribute_name("number_of_non_fs_vj") %> : <%= @line.vehicle_journeys.where("flexible_service = ?", false).count %> -
  <%= @line.human_attribute_name("number_of_null_fs_vj") %> - <% if @line.flexible_service.nil? %> - (<%= @line.human_attribute_name("default_fs_msg") %>) - <% end %> - : <%= @line.vehicle_journeys.count - - (@line.vehicle_journeys.where("flexible_service = ?", true).count + - @line.vehicle_journeys.where("flexible_service = ?", false).count) %> -

-

- -

-

-

- - <%= @line.comment %> -

-
- -
-
-
-
-
- -

-

<%= t('.itineraries') %>

-
- - <%#= paginated_content @routes, "routes/route" %> -
- -<% if @line.group_of_lines.any? %> -

<%= t('.group_of_lines') %>

-
- <%= paginated_content @group_of_lines, "group_of_lines/group_of_line", :delete => false %> -
-<% end %> - -<% content_for :sidebar do %> - - <%= creation_tag(@line) %> -<% end %> diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim new file mode 100644 index 000000000..b559df842 --- /dev/null +++ b/app/views/lines/show.html.slim @@ -0,0 +1,144 @@ +- text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" +- bg_color = @line.color.blank? ? "white" : "##{@line.color}" + += title_tag t('lines.show.title', line: @line.name) + +.line_show + = @map.to_html + + .summary + - text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" + - bg_color = @line.color.blank? ? "white" : "##{@line.color}" + + - if colors?(@line) + p + label = "#{t('lines.index.color')} : " + label.color style="#{number_style(@line)}" + = line_sticker(@line) + + p + label = "#{@line.human_attribute_name(:network)} : " + + - if @line.network.nil? + = t('lines.index.unset') + - else + / FIXME #825 + / = link_to @line.network.name, [@referential, @line.network] + + p + label = "#{@line.human_attribute_name(:company)} : " + + - if @line.company.nil? + = t('lines.index.unset') + - else + / FIXME #825 + / = link_to @line.company.name, [@referential, @line.company] + + p + label = "#{@line.human_attribute_name('number')} : " + = @line.number + + p + label = "#{@line.human_attribute_name('published_name')} : " + = @line.published_name + + p + label = "#{@line.human_attribute_name('registration_number')} : " + = @line.registration_number + + p + label = "#{@line.human_attribute_name('transport_mode')} : " + = t("transport_modes.label.#{@line.transport_mode}") + + p + label = "#{@line.human_attribute_name('stable_id')} : " + = @line.stable_id + + p + label = "#{@line.human_attribute_name('url')} : " + = @line.url + + p + label = "#{@line.human_attribute_name('mobility_restricted_suitability')} : " + + - if @line.mobility_restricted_suitability.nil? + = @line.human_attribute_name("unspecified_mrs") + - elsif @line.mobility_restricted_suitability? + = @line.human_attribute_name("accessible") + - else + = @line.human_attribute_name("not_accessible") + + br + = "#{@line.human_attribute_name('number_of_mrs_vj')} : #{@line.vehicle_journeys.where('mobility_restricted_suitability = ?', true).count}" + br + = "#{@line.human_attribute_name('number_of_non_mrs_vj')} : #{@line.vehicle_journeys.where('mobility_restricted_suitability = ?', false).count}" + br + = @line.human_attribute_name("number_of_null_mrs_vj") + = " : " + = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("mobility_restricted_suitability = ?", true).count + @line.vehicle_journeys.where("mobility_restricted_suitability = ?", false).count) + + p + label = "#{@line.human_attribute_name('flexible_service')} : " + + - if @line.flexible_service.nil? + = @line.human_attribute_name("unspecified_fs") + - elsif @line.flexible_service? + = @line.human_attribute_name("on_demaond_fs") + - else + = @line.human_attribute_name("regular_fs") + + br + = "#{@line.human_attribute_name('number_of_fs_vj')} : #{@line.vehicle_journeys.where('flexible_service = ?', true).count}" + br + = "#{@line.human_attribute_name('number_of_non_fs_vj')} : #{@line.vehicle_journeys.where('flexible_service = ?', false).count}" + br + = @line.human_attribute_name("number_of_null_fs_vj") + + - if @line.flexible_service.nil? + = "(#{@line.human_attribute_name('default_fs_msg')})" + + = " : " + = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("flexible_service = ?", true).count + @line.vehicle_journeys.where("flexible_service = ?", false).count) + + p + label = "#{@line.human_attribute_name('footnotes')} : " + ul + - @line.footnotes.each do |footnote| + li = "#{footnote.code} : #{footnote.label}" + + p + label = "#{@line.human_attribute_name('comment')} : " + = @line.comment + + .row + #mobility_restricted_suitability.col-md-6 + #flexible_service.col-md-6 + +p.after_map + +h3.routes = t('.itineraries') + +.routes.paginated_content + / FIXME #825 + / = paginated_content @routes, "routes/route" + +- if @line.group_of_lines.any? + h3.line_group_of_lines = t('.group_of_lines') + .group_of_lines.paginated_content + = paginated_content @group_of_lines, "group_of_lines/group_of_line", delete: false + +- content_for :sidebar do + ul.actions + li + = link_to t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'add' + li + = link_to t('lines.actions.edit'), edit_line_referential_line_path(@line_referential, @line), class: 'edit' + li + = link_to t('lines.actions.destroy'), line_referential_line_path(@line_referential, @line), method: :delete, :data => {:confirm => t('lines.actions.destroy_confirm')}, class: 'remove' + + - if !@line.hub_restricted? || (@line.hub_restricted? && @line.routes.size < 2) + / FIXME #825 + li + / = link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), class: 'add' + + = creation_tag(@line) \ No newline at end of file diff --git a/app/views/lines/show.kml.erb b/app/views/lines/show.kml.erb deleted file mode 100644 index 8e1c82eef..000000000 --- a/app/views/lines/show.kml.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - <% @line.commercial_stop_areas.each do |stop_area| %> - - <%= stop_area.name %> - <%= stop_area.area_type.underscore %> - <%= t("area_types.label.#{stop_area.stop_area_type}") %> - <%= (stop_area.position or stop_area.default_position).kml_representation.html_safe %> - - <% end %> - - - diff --git a/app/views/lines/show.kml.slim b/app/views/lines/show.kml.slim new file mode 100644 index 000000000..97f589e31 --- /dev/null +++ b/app/views/lines/show.kml.slim @@ -0,0 +1,10 @@ +doctype XML + +kml xmlns="http://www.opengis.net/kml/2.2" + document + - @line.commercial_stop_areas.each do |stop_area| + placemark id="#{stop_area.id}" + name = stop_area.name + stop_area_type = stop_area.area_type.underscore + stop_area_type_label = t("area_types.label.#{stop_area.stop_area_type}") + = (stop_area.position or stop_area.default_position).kml_representation.html_safe \ No newline at end of file -- cgit v1.2.3