diff options
| author | jpl | 2016-08-03 12:45:03 +0200 |
|---|---|---|
| committer | jpl | 2016-08-03 12:45:03 +0200 |
| commit | 51b437f856b41fbd4935128f4611220cb5a4956f (patch) | |
| tree | 40aafc502c17d26c3a29ea5d34b01686796a7ee1 | |
| parent | f20659ad8cf97d42c9043ecde56eabf35218a174 (diff) | |
| download | chouette-core-51b437f856b41fbd4935128f4611220cb5a4956f.tar.bz2 | |
Refs #1295: convert erb to slim (route_sections)
| -rw-r--r-- | app/views/route_sections/_form.html.erb | 24 | ||||
| -rw-r--r-- | app/views/route_sections/_form.html.slim | 21 | ||||
| -rw-r--r-- | app/views/route_sections/edit.html.erb | 4 | ||||
| -rw-r--r-- | app/views/route_sections/edit.html.slim | 4 | ||||
| -rw-r--r-- | app/views/route_sections/index.html.erb | 58 | ||||
| -rw-r--r-- | app/views/route_sections/index.html.slim | 48 | ||||
| -rw-r--r-- | app/views/route_sections/new.html.erb | 3 | ||||
| -rw-r--r-- | app/views/route_sections/new.html.slim | 3 | ||||
| -rw-r--r-- | app/views/route_sections/show.html.erb | 28 | ||||
| -rw-r--r-- | app/views/route_sections/show.html.slim | 26 | ||||
| -rw-r--r-- | app/views/route_sections/show.kml.erb | 8 | ||||
| -rw-r--r-- | app/views/route_sections/show.kml.slim | 6 |
12 files changed, 108 insertions, 125 deletions
diff --git a/app/views/route_sections/_form.html.erb b/app/views/route_sections/_form.html.erb deleted file mode 100644 index 28a1dd47a..000000000 --- a/app/views/route_sections/_form.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<%= semantic_form_for [@referential, @route_section] do |form| %> - <%= form.inputs do %> - <% if @route_section.new_record? %> - <%= form.input :departure, as: :select, collection: @stop_areas, include_blank: false %> - <%= form.input :arrival, as: :select, collection: @stop_areas, include_blank: false %> - <% else %> - <li class="input optional"> - <label class="label"><%= @route_section.human_attribute_name("departure") %></label> - <%= @route_section.departure.name %> - </li> - <li class="input optional"> - <label class="label"><%= @route_section.human_attribute_name("arrival") %></label> - <%= @route_section.arrival.name %> - </li> - <%= form.input :editable_geometry, as: :hidden %> - <% end %> - - <%= form.input :no_processing, label: t('.no_processing'), as: :select, collection: { t('.standard_processor') => false, t('.no_processor') => true }, include_blank: false %> - <% end %> - <%= form.actions do %> - <%= form.action :submit, :as => :button, label: t('.submit') %> - <%= form.action :cancel, :as => :link %> - <% end %> -<% end %> diff --git a/app/views/route_sections/_form.html.slim b/app/views/route_sections/_form.html.slim new file mode 100644 index 000000000..51e4fdcf6 --- /dev/null +++ b/app/views/route_sections/_form.html.slim @@ -0,0 +1,21 @@ += semantic_form_for [@referential, @route_section] do |form| + = form.inputs do + - if @route_section.new_record? + = form.input :departure, as: :select, collection: @stop_areas, include_blank: false + = form.input :arrival, as: :select, collection: @stop_areas, include_blank: false + - else + li.input.optional + label.label = @route_section.human_attribute_name('departure') + = @route_section.departure.name + + li.input.optional + label.label = @route_section.human_attribute_name('arrival') + = @route_section.arrival.name + + = form.input :editable_geometry, as: :hidden + + = form.input :no_processing, label: t('.no_processing'), as: :select, collection: { t('.standard_processor') => false, t('.no_processor') => true }, include_blank: false + + = form.actions do + = form.action :submit, as: :button, label: t('.submit') + = form.action :cancel, as: :link
\ No newline at end of file diff --git a/app/views/route_sections/edit.html.erb b/app/views/route_sections/edit.html.erb deleted file mode 100644 index 1e8133344..000000000 --- a/app/views/route_sections/edit.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= title_tag t('route_sections.edit.title') %> - -<%= @map.to_html if @map %> -<%= render "form" %> diff --git a/app/views/route_sections/edit.html.slim b/app/views/route_sections/edit.html.slim new file mode 100644 index 000000000..15944fd75 --- /dev/null +++ b/app/views/route_sections/edit.html.slim @@ -0,0 +1,4 @@ += title_tag t('route_sections.edit.title') + += @map.to_html if @map +== render 'form'
\ No newline at end of file diff --git a/app/views/route_sections/index.html.erb b/app/views/route_sections/index.html.erb deleted file mode 100644 index 763ea360e..000000000 --- a/app/views/route_sections/index.html.erb +++ /dev/null @@ -1,58 +0,0 @@ -<%= title_tag t('.title') %> - -<%= form_for search, url: referential_route_sections_path(@referential), method: :get, class: "form-inline" do |form| %> - <div class="panel panel-default"> - <div class="panel-heading"> - <div class="col-md-6"> - <%= form.text_field :departure_name, class: 'form-control', placeholder: Chouette::RouteSection.human_attribute_name(:departure) %> - </div> - - <div class="input-group col-md-6"> - <%= form.text_field :arrival_name, class: 'form-control', placeholder: Chouette::RouteSection.human_attribute_name(:arrival) %> - <div class="input-group-btn"> - <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button> - </div> - </div> - </div> - - <div class="panel-body"> - <div class="col-md-4"> - <%= form.select :line_id, @referential.lines.order(:name).pluck(:name, :id), { include_blank: t('.all_lines')}, class: 'form-control' %> - </div> - </div> - </div> -<% end %> - -<table class="table table-hover table-striped"> - <thead> - <tr> - <th><%= Chouette::RouteSection.human_attribute_name :departure %></th> - <th><%= Chouette::RouteSection.human_attribute_name :arrival %></th> - <th class="distance"><%= Chouette::RouteSection.human_attribute_name :distance %></th> - <th class="points"><%= Chouette::RouteSection.human_attribute_name :points %></th> - <th class="points"><%= Chouette::RouteSection.human_attribute_name :quantity %></th> - <th class="actions"></th> - </tr> - </thead> - <tbody> - <% @route_sections.each do |route_section| %> - <tr> - <td><%= route_section.departure.name %> <%= link_to content_tag(:i, "", class: "fa fa-external-link"), referential_stop_area_path(@referential, route_section.departure) %></td> - <td><%= route_section.arrival.name %> <%= link_to content_tag(:i, "", class: "fa fa-external-link"), referential_stop_area_path(@referential, route_section.arrival) %></td> - <td class="distance"><%= route_section.distance.to_i if route_section.distance %></td> - <td class="points"><%= route_section.via_count if route_section.via_count > 0 %></td> - <td class="journey_patterns"><%= route_section.journey_pattern_sections.count(:journey_pattern_id, distinct: true) %></td> - <td class="actions"> - <%= link_to t('.actions.show'), referential_route_section_path(@referential, route_section), class: "view" %> - <%= link_to t('.actions.edit'), edit_referential_route_section_path(@referential, route_section), class: "edit" %> - <%= link_to t('.actions.destroy'), referential_route_section_path(@referential, route_section), method: :delete, data: { confirm: t('route_sections.actions.destroy_confirm') }, class: "remove" %> - </td> - </tr> - <% end %> - </tbody> - -</table> - -<div class="pagination"> - <%= will_paginate @route_sections, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %> -</div> diff --git a/app/views/route_sections/index.html.slim b/app/views/route_sections/index.html.slim new file mode 100644 index 000000000..b1eeebabe --- /dev/null +++ b/app/views/route_sections/index.html.slim @@ -0,0 +1,48 @@ += title_tag t('.title') + += form_for search, url: referential_route_sections_path(@referential), method: :get, class: 'form-inline' do |form| + .panel.panel-default + .panel-heading + .col-md-6 + = form.text_field :departure_name, class: 'form-control', placeholder: Chouette::RouteSection.human_attribute_name(:departure) + + .input-group.col-md-6 + = form.text_field :arrival_name, class: 'form-control', placeholder: Chouette::RouteSection.human_attribute_name(:arrival) + + .input-group-btn + button.btn.btn-default type="submit + i.fa.fa-search + + .panel-body + .col-md-4 + = form.select :line_id, @referential.lines.order(:name).pluck(:name, :id), { include_blank: t('.all_lines')}, class: 'form-control' + +table.table.table-hover.table-striped + thead + tr + th = Chouette::RouteSection.human_attribute_name :departure + th = Chouette::RouteSection.human_attribute_name :arrival + th.distance = Chouette::RouteSection.human_attribute_name :distance + th.points = Chouette::RouteSection.human_attribute_name :points + th.points = Chouette::RouteSection.human_attribute_name :quantity + th.actions + + tbody + - @route_sections.each do |route_section| + tr + td + = route_section.departure.name + = link_to content_tag(:i, "", class: "fa fa-external-link"), referential_stop_area_path(@referential, route_section.departure) + td + = route_section.arrival.name + = link_to content_tag(:i, "", class: "fa fa-external-link"), referential_stop_area_path(@referential, route_section.arrival) + td.distance = route_section.distance.to_i if route_section.distance + td.points = route_section.via_count if route_section.via_count > 0 + td.journey_patterns = route_section.journey_pattern_sections.count(:journey_pattern_id, distinct: true) + td.actions + = link_to t('.actions.show'), referential_route_section_path(@referential, route_section), class: 'view' + = link_to t('.actions.edit'), edit_referential_route_section_path(@referential, route_section), class: 'edit' + = link_to t('.actions.destroy'), referential_route_section_path(@referential, route_section), method: :delete, data: { confirm: t('route_sections.actions.destroy_confirm') }, class: 'remove' + +.pagination + = will_paginate @route_sections, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer
\ No newline at end of file diff --git a/app/views/route_sections/new.html.erb b/app/views/route_sections/new.html.erb deleted file mode 100644 index 1ff3c74d0..000000000 --- a/app/views/route_sections/new.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= title_tag t('route_sections.new.title') %> - -<%= render "form" %> diff --git a/app/views/route_sections/new.html.slim b/app/views/route_sections/new.html.slim new file mode 100644 index 000000000..a41db0254 --- /dev/null +++ b/app/views/route_sections/new.html.slim @@ -0,0 +1,3 @@ += title_tag t('route_sections.new.title') + +== render 'form'
\ No newline at end of file diff --git a/app/views/route_sections/show.html.erb b/app/views/route_sections/show.html.erb deleted file mode 100644 index 61c7c8149..000000000 --- a/app/views/route_sections/show.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -<%= title_tag t('.title') %> - -<div class="route_section"> - <%= @map.to_html %> - - <div class="summary"> - <p> - <label><%= @route_section.human_attribute_name("departure") %>: </label> - <%= @route_section.departure.name %> - </p> - <p> - <label><%= @route_section.human_attribute_name("arrival") %>: </label> - <%= @route_section.arrival.name %> - </p> - <p> - <label><%= @route_section.human_attribute_name("distance") %>: </label> - <%= "#{@route_section.distance.round}m" if @route_section.distance %> - </p> - </div> -</div> - -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('route_sections.actions.edit'), edit_referential_route_section_path(@referential, @route_section), :class => "edit" %></li> - <li><%= link_to t('route_sections.actions.destroy'), referential_route_section_path(@referential, @route_section), :method => :delete, :data => {:confirm => t('route_sections.actions.destroy_confirm')}, :class => "remove" %></li> -</ul> - <%= creation_tag(@route_section) %> -<% end %> diff --git a/app/views/route_sections/show.html.slim b/app/views/route_sections/show.html.slim new file mode 100644 index 000000000..f02f7de80 --- /dev/null +++ b/app/views/route_sections/show.html.slim @@ -0,0 +1,26 @@ += title_tag t('.title') + +.route_section + = @map.to_html + + .summary + p + label = "#{@route_section.human_attribute_name('departure')} : " + = @route_section.departure.name + + p + label = "#{@route_section.human_attribute_name('arrival')} : " + = @route_section.arrival.name + + p + label = "#{@route_section.human_attribute_name('distance')} : " + = "#{@route_section.distance.round}m" if @route_section.distance + +- content_for :sidebar do + ul.actions + li + = link_to t('route_sections.actions.edit'), edit_referential_route_section_path(@referential, @route_section), class: 'edit' + li + = link_to t('route_sections.actions.destroy'), referential_route_section_path(@referential, @route_section), :method => :delete, :data => {:confirm => t('route_sections.actions.destroy_confirm')}, class: 'remove' + + = creation_tag(@route_section)
\ No newline at end of file diff --git a/app/views/route_sections/show.kml.erb b/app/views/route_sections/show.kml.erb deleted file mode 100644 index 0d41f0fdb..000000000 --- a/app/views/route_sections/show.kml.erb +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<kml xmlns="http://www.opengis.net/kml/2.2"> - <Document> - <Placemark id="route-section-<%= @route_section.id %>"> - <%= @route_section.geometry(params[:mode]).kml_representation.html_safe %> - </Placemark> - </Document> -</kml> diff --git a/app/views/route_sections/show.kml.slim b/app/views/route_sections/show.kml.slim new file mode 100644 index 000000000..9dbb4957b --- /dev/null +++ b/app/views/route_sections/show.kml.slim @@ -0,0 +1,6 @@ +doctype XML + +kml xmlns="http://www.opengis.net/kml/2.2" + document + placemark id="route-section-#{@route_section.id}" + = @route_section.geometry(params[:mode]).kml_representation.html_safe
\ No newline at end of file |
