aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpl2016-08-03 12:57:43 +0200
committerjpl2016-08-03 12:57:43 +0200
commitc77addaa884b17399e9daf25204cda583eecbedc (patch)
tree08b532a417326cc2ed39ae38718e5ebfc9b0d4c9
parent51b437f856b41fbd4935128f4611220cb5a4956f (diff)
downloadchouette-core-c77addaa884b17399e9daf25204cda583eecbedc.tar.bz2
Refs #1295: convert erb to slim (route_sections_selectors)
-rw-r--r--app/views/route_sections_selectors/_selection.js.erb28
-rw-r--r--app/views/route_sections_selectors/_selection.js.slim21
-rw-r--r--app/views/route_sections_selectors/edit.html.erb48
-rw-r--r--app/views/route_sections_selectors/edit.html.slim34
4 files changed, 55 insertions, 76 deletions
diff --git a/app/views/route_sections_selectors/_selection.js.erb b/app/views/route_sections_selectors/_selection.js.erb
deleted file mode 100644
index 70d03cf75..000000000
--- a/app/views/route_sections_selectors/_selection.js.erb
+++ /dev/null
@@ -1,28 +0,0 @@
-<div>
- <span class="departure">
- <label><%= @route_section.human_attribute_name("departure") %>:</label>
- <%= link_to @route_section.departure.name, referential_stop_area_path(@referential, @route_section.departure) %>
- </span>
-
- <span class="arrival">
- <label><%= @route_section.human_attribute_name("arrival") %>:</label>
- <%= link_to @route_section.arrival.name, referential_stop_area_path(@referential, @route_section.arrival) %>
- </span>
-
- <span class="distance">
- <label><%= @route_section.human_attribute_name("distance") %>:</label>
- <%= "#{@route_section.distance.to_i} m" if @route_section.distance > 0 %>
- </span>
-
- <% if @route_section.via_count > 0 %>
- <span class="via_count">
- <label><%= @route_section.human_attribute_name("via_count") %>:</label>
- <%= @route_section.via_count if @route_section.via_count > 0 %>
- </span>
- <% end %>
-
- <span class="actions">
- <%= link_to_edit_route_section @route_section %>
- <%= link_to_create_route_section @route_section.departure, @route_section.arrival %>
- </span>
-</div>
diff --git a/app/views/route_sections_selectors/_selection.js.slim b/app/views/route_sections_selectors/_selection.js.slim
new file mode 100644
index 000000000..6b5489171
--- /dev/null
+++ b/app/views/route_sections_selectors/_selection.js.slim
@@ -0,0 +1,21 @@
+div
+ span.departure
+ label = "#{@route_section.human_attribute_name('departure')} : "
+ = link_to @route_section.departure.name, referential_stop_area_path(@referential, @route_section.departure)
+
+ span.arrival
+ label = "#{@route_section.human_attribute_name('arrival')} : "
+ = link_to @route_section.arrival.name, referential_stop_area_path(@referential, @route_section.arrival)
+
+ span.distance
+ label = "#{@route_section.human_attribute_name('distance')} : "
+ = "#{@route_section.distance.to_i} m" if @route_section.distance > 0
+
+ - if @route_section.via_count > 0
+ span.via_count
+ label = "#{@route_section.human_attribute_name('via_count')} : "
+ = @route_section.via_count if @route_section.via_count > 0
+
+ span.actions
+ = link_to_edit_route_section @route_section
+ = link_to_create_route_section @route_section.departure, @route_section.arrival \ No newline at end of file
diff --git a/app/views/route_sections_selectors/edit.html.erb b/app/views/route_sections_selectors/edit.html.erb
deleted file mode 100644
index a60b8b95b..000000000
--- a/app/views/route_sections_selectors/edit.html.erb
+++ /dev/null
@@ -1,48 +0,0 @@
-<%= title_tag t('.title', journey_pattern: journey_name(@journey_pattern)) %>
-
-<div class = "large-map">
- <%= @map.to_html(no_fullscreen: true) %>
-</div>
-
-<%= semantic_form_for resource, url: referential_line_route_journey_pattern_route_sections_selector_path(@referential, @line, @route, @journey_pattern), method: :put do |form| %>
-
-<h3><%= t('.selection.title') %></h3>
-
-<div id="map-selection" style="display: none">
- <div>
- </div>
-</div>
-
-<div id="empty-map-selection">
- <%= t('.no_selection') %>
-</div>
-
-<h3><%= t('.form.title') %></h3>
-
-<table class="table table-hover table-striped">
- <tbody>
- <%= form.fields_for :sections do |section_form| %>
- <tr>
- <td><%= link_to section_form.object.departure.name, referential_stop_area_path(@referential, section_form.object.departure) %></td>
- <td class="route_section">
- <% if section_form.object.candidates.present? %>
- <%= section_form.input :route_section_id, as: :select, label: false, collection: section_form.object.candidates, include_blank: t('.no_selection') %>
- <% else %>
- <%= t('.no_candidate') %>
- <% end %>
- </td>
- <td class="action">
- <%= link_to_edit_route_section section_form.object.route_section %>
- <%= link_to_create_route_section section_form.object.departure, section_form.object.arrival %>
- </td>
- </tr>
- <% end %>
- </tbody>
-</table>
-
-<%= form.actions do %>
- <%= form.action :submit, as: :button, label: t('.submit') %>
- <%= form.action :cancel, as: :link, url: referential_line_route_journey_pattern_path(@referential, @line, @route, @journey_pattern) %>
-<% end %>
-
-<% end %>
diff --git a/app/views/route_sections_selectors/edit.html.slim b/app/views/route_sections_selectors/edit.html.slim
new file mode 100644
index 000000000..9dcee8af3
--- /dev/null
+++ b/app/views/route_sections_selectors/edit.html.slim
@@ -0,0 +1,34 @@
+= title_tag t('.title', journey_pattern: journey_name(@journey_pattern))
+
+.large-map
+ = @map.to_html(no_fullscreen: true)
+
+= semantic_form_for resource, url: referential_line_route_journey_pattern_route_sections_selector_path(@referential, @line, @route, @journey_pattern), method: :put do |form|
+ h3 = t('.selection.title')
+
+ #map-selection style="display: none;"
+ div
+
+ #empty-map-selection
+ = t('.no_selection')
+
+ h3 = t('.form.title')
+
+ table.table.table-hover.table-striped
+ tbody
+ = form.fields_for :sections do |section_form|
+ tr
+ td = link_to section_form.object.departure.name, referential_stop_area_path(@referential, section_form.object.departure)
+ td.route_section
+ - if section_form.object.candidates.present?
+ = section_form.input :route_section_id, as: :select, label: false, collection: section_form.object.candidates, include_blank: t('.no_selection')
+ - else
+ = t('.no_candidate')
+
+ td.action
+ = link_to_edit_route_section section_form.object.route_section
+ = link_to_create_route_section section_form.object.departure, section_form.object.arrival
+
+ = form.actions do
+ = form.action :submit, as: :button, label: t('.submit')
+ = form.action :cancel, as: :link, url: referential_line_route_journey_pattern_path(@referential, @line, @route, @journey_pattern) \ No newline at end of file