diff options
| author | jpl | 2016-08-01 16:15:30 +0200 | 
|---|---|---|
| committer | jpl | 2016-08-01 16:15:53 +0200 | 
| commit | 9476ef8d8d93914b6bcb64ed6eb65b60e8beb086 (patch) | |
| tree | a6c8fa1c5886f00b7954e154f9ad7feb9bbb81c7 /app/views | |
| parent | e270eb3a515d897b2157897e83bc5d4cdb670d62 (diff) | |
| download | chouette-core-9476ef8d8d93914b6bcb64ed6eb65b60e8beb086.tar.bz2 | |
Refs #1295: convert erb to slim (lines)
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/group_of_lines/_lines_detail.html.slim | 2 | ||||
| -rw-r--r-- | app/views/lines/_form.erb | 54 | ||||
| -rw-r--r-- | app/views/lines/_form.html.slim | 45 | ||||
| -rw-r--r-- | app/views/lines/_line.erb | 52 | ||||
| -rw-r--r-- | app/views/lines/_line.html.slim | 50 | ||||
| -rw-r--r-- | app/views/lines/_lines.html.erb | 9 | ||||
| -rw-r--r-- | app/views/lines/_lines.html.slim | 9 | ||||
| -rw-r--r-- | app/views/lines/edit.html.erb | 3 | ||||
| -rw-r--r-- | app/views/lines/edit.html.slim | 3 | ||||
| -rw-r--r-- | app/views/lines/index.html.erb | 52 | ||||
| -rw-r--r-- | app/views/lines/index.html.slim | 49 | ||||
| -rw-r--r-- | app/views/lines/index.js.erb | 1 | ||||
| -rw-r--r-- | app/views/lines/index.js.slim | 1 | ||||
| -rw-r--r-- | app/views/lines/new.html.erb | 3 | ||||
| -rw-r--r-- | app/views/lines/new.html.slim | 3 | ||||
| -rw-r--r-- | app/views/lines/show.html.erb | 141 | ||||
| -rw-r--r-- | app/views/lines/show.html.slim | 144 | ||||
| -rw-r--r-- | app/views/lines/show.kml.erb | 14 | ||||
| -rw-r--r-- | app/views/lines/show.kml.slim | 10 | 
19 files changed, 315 insertions, 330 deletions
| 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 }  %> - -    <div class="footnotes_block"> -      <h3><%= t("footnotes.index.title") %></h3> -      <div id="footnotes"> -        <%= form.semantic_fields_for :footnotes do |f| %> -          <%= render "footnotes/footnote_fields",  :f => f %> -        <% end %> -      </div> -      <div class="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" %> -      </div> -    </div> -  <% end %> - -   <%= form.actions do %> -     <%= form.action :submit, :as => :button %> -     <%= form.action :cancel, :as => :link %> -   <% end %> -<% end %> - -<script> -	$(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: '<%= t('search_hint') %>', -       noResultsText: '<%= t('no_result_text') %>', -       searchingText: '<%= t('searching_term') %>' -    }); -	}); -</script> 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 @@ -<div id="index_item" class="panel panel-default line ce-LineBlock"> -  <div class="panel-heading ce-LineBlock-header"> -    <ul class="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 class="label label-default line_number" style="<%= number_style(line) %>"><%= line.number %></span> -        <% end %> -      </li> -      <li> -        <%= link_to([line.line_referential, line], class: 'preview', title: "#{Chouette::Line.model_name.human.capitalize} #{line.name}") do %> -          <h5 class="ce-LineBlock-header-title"><%= truncate(line.name, length: 24) %></h5> -        <% end %> -      </li> -      <li> -        <%= link_to edit_line_referential_line_path(line.line_referential, line), class: 'btn btn-default btn-sm' do %> -          <span class="fa fa-pencil"></span> -        <% end if edit %> -        <%= 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 class="fa fa-trash-o"></span> -        <% end if delete %> -      </li> -    </ul> -  </div> -  <div class="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}" %> -    <% end %> -    </p> -    <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}" )  %> -    <% end %> -    </p> -    <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) %> -    <% end %> -    </p> -  </div> -</div> 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 @@ -<div class="page_info"> -  <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @lines %> -</div> -<div class="lines paginated_content"> -    <%= paginated_content(@lines) %> -</div> -<div class="pagination"> -  <%= will_paginate @lines, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %> -</div> 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| %> -<div class="panel panel-default"> -  <div class="panel-heading"> -    <div class="input-group col-md-9"> -      <%= f.text_field :name_or_number_cont, :placeholder => "#{t('.name_or_number')}", :class => 'form-control' %> -      <div class="input-group-btn"> -        <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button> -      </div> -    </div><!-- /input-group --> -    <a data-toggle="collapse" data-parent="#search" href="#advanced_search"> -      <i class="fa fa-plus"></i> <%= "#{t('.advanced_search')}" %> -    </a> -  </div> - -  <div id="advanced_search" class="panel-collapse collapse"> -    <div class="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' }) %> -    </div> -  </div> -</div> -<% end %> - -<div id="lines"><%= render 'lines' %></div> - -<% content_for :sidebar do %> -<ul class="actions"> -  <li><%= link_to t('lines.actions.new'), new_line_referential_line_path(@line_referential), :class => "add" %></li> -</ul> - -<div id="multiple_selection_menu"> -  <h4><%= t(".multi_selection") %> </h4> -  <div class="disabled"> -    <a class="enable" href="#"><%= t(".multi_selection_enable") %></a> -  </div> - -  <div class="enabled" style="display: none;"> -    <a class="disable" href="#"><%= t(".multi_selection_disable") %></a> - -    <ul class="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") %> -    </ul> - -    <a class="select_all" href="#"><%= t(".select_all") %></a> | <a class="deselect_all" href="#"><%= t(".deselect_all") %></a> -  </div> -</div> - -<% 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 ) %> - -<div class="line_show"> -  <%= @map.to_html %> - -  <div class="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> -	    	<label class="color" style='<%="#{number_style(@line)}"%>'><%= line_sticker(@line) %></label> -	    </p> -    <% end %> -    <p> -      <label><%= @line.human_attribute_name(:network) %>: </label> -  	<% if @line.network.nil? %> -  	   <%= t('lines.index.unset') %> -  	<% else %> -      <!-- FIXME #825 --> -      <%#= link_to @line.network.name, [@referential, @line.network] %> -    <% end %> -    </p> -    <p> -      <label><%= @line.human_attribute_name(:company) %>: </label> -  	<% if @line.company.nil? %> -  	   <%= t('lines.index.unset') %> -  	<% else %> -      <!-- FIXME #825 --> -      <%#= link_to @line.company.name, [@referential, @line.company] %> -    <% end %> -    </p> -    <p> -      <label><%= @line.human_attribute_name("number") %>: </label> -      <%= @line.number %> -    </p> -    <p> -      <label><%= @line.human_attribute_name("published_name") %>: </label> -      <%= @line.published_name %> -    </p> -    <p> -      <label><%= @line.human_attribute_name("registration_number") %>: </label> -      <%= @line.registration_number %> -    </p> -    <p> -      <label><%= @line.human_attribute_name("transport_mode") %>: </label> -      <%= t("transport_modes.label.#{@line.transport_mode}") %> -    </p> -    <p> -      <label><%= @line.human_attribute_name("stable_id") %>: </label> -      <%= @line.stable_id %> -    </p> - -    <p> -      <label><%= @line.human_attribute_name("url") %>: </label> -      <%= @line.url %> -    </p> - -    <p> -      <label><%= @line.human_attribute_name("mobility_restricted_suitability") %> : </label> -      <% 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 %> -      <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> -    <p> -      <label><%= @line.human_attribute_name("flexible_service") %> : </label> -      <% 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 %> -      <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") %>) -      <% end %> -      : <%= @line.vehicle_journeys.count - -	    (@line.vehicle_journeys.where("flexible_service = ?", true).count + -	    @line.vehicle_journeys.where("flexible_service = ?", false).count) %> -    </p> -    <p> -      <label><%= @line.human_attribute_name("footnotes") %>: </label> -      <ul> -        <% @line.footnotes.each do |footnote| %> -        <li><%= footnote.code %> : <%= footnote.label %></li> -      <% end %> -      </ul> -    </p> -    <p> -      <label><%= @line.human_attribute_name("comment") %>: </label> -      <%= @line.comment %> -    </p> -  </div> - -  <div class="row"> -    <div id="mobility_restricted_suitability" class="col-md-6"></div> -    <div id="flexible_service" class="col-md-6"></div> -  </div> -</div> - -<p class="after_map" /> -<h3 class="routes"><%= t('.itineraries') %></h3> -<div class="routes paginated_content"> -  <!-- FIXME #825 --> -  <%#= paginated_content @routes, "routes/route" %> -</div> - -<% if @line.group_of_lines.any? %> -  <h3 class="line_group_of_lines"><%= t('.group_of_lines') %></h3> -  <div class="group_of_lines paginated_content"> -     <%= paginated_content @group_of_lines, "group_of_lines/group_of_line", :delete => false %> -  </div> -<% end %> - -<% content_for :sidebar do %> -<ul class="actions"> -  <li><%= link_to t('lines.actions.new'), new_line_referential_line_path(@line_referential), :class => "add" %></li> -  <li><%= link_to t('lines.actions.edit'), edit_line_referential_line_path(@line_referential, @line), :class => "edit" %></li> -  <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" %></li> -  <% 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" %></li> -  <% end %> -</ul> -  <%= 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<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 %></name> -      <stop_area_type><%= stop_area.area_type.underscore %></stop_area_type> -      <stop_area_type_label><%= t("area_types.label.#{stop_area.stop_area_type}") %></stop_area_type_label> -      <%= (stop_area.position or stop_area.default_position).kml_representation.html_safe %> -    </Placemark> -  <% end %> -  </Document> -</kml> - 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 | 
