From 466a7c1c60950315d0d6a17ea5d71cf152c0dc40 Mon Sep 17 00:00:00 2001
From: jpl
Date: Fri, 29 Jul 2016 16:15:52 +0200
Subject: Refs #1295: convert erb to slim (group_of_lines)
---
 app/views/group_of_lines/_form.erb                 | 31 ----------------------
 app/views/group_of_lines/_form.html.slim           | 27 +++++++++++++++++++
 app/views/group_of_lines/_group_of_line.erb        | 24 -----------------
 app/views/group_of_lines/_group_of_line.html.slim  | 19 +++++++++++++
 app/views/group_of_lines/_group_of_lines.erb       |  9 -------
 app/views/group_of_lines/_group_of_lines.html.slim |  9 +++++++
 app/views/group_of_lines/_lines_detail.html.erb    |  3 ---
 app/views/group_of_lines/_lines_detail.html.slim   |  2 ++
 app/views/group_of_lines/edit.html.erb             |  3 ---
 app/views/group_of_lines/edit.html.slim            |  3 +++
 app/views/group_of_lines/index.html.erb            | 26 ------------------
 app/views/group_of_lines/index.html.slim           | 24 +++++++++++++++++
 app/views/group_of_lines/index.js.erb              |  1 -
 app/views/group_of_lines/index.js.slim             |  1 +
 app/views/group_of_lines/new.html.erb              |  3 ---
 app/views/group_of_lines/new.html.slim             |  3 +++
 app/views/group_of_lines/show.html.erb             | 31 ----------------------
 app/views/group_of_lines/show.html.slim            | 31 ++++++++++++++++++++++
 app/views/group_of_lines/show.js.erb               |  4 ---
 app/views/group_of_lines/show.js.slim              |  3 +++
 app/views/group_of_lines/show.kml.erb              | 14 ----------
 app/views/group_of_lines/show.kml.slim             | 10 +++++++
 22 files changed, 132 insertions(+), 149 deletions(-)
 delete mode 100644 app/views/group_of_lines/_form.erb
 create mode 100644 app/views/group_of_lines/_form.html.slim
 delete mode 100644 app/views/group_of_lines/_group_of_line.erb
 create mode 100644 app/views/group_of_lines/_group_of_line.html.slim
 delete mode 100644 app/views/group_of_lines/_group_of_lines.erb
 create mode 100644 app/views/group_of_lines/_group_of_lines.html.slim
 delete mode 100644 app/views/group_of_lines/_lines_detail.html.erb
 create mode 100644 app/views/group_of_lines/_lines_detail.html.slim
 delete mode 100644 app/views/group_of_lines/edit.html.erb
 create mode 100644 app/views/group_of_lines/edit.html.slim
 delete mode 100644 app/views/group_of_lines/index.html.erb
 create mode 100644 app/views/group_of_lines/index.html.slim
 delete mode 100644 app/views/group_of_lines/index.js.erb
 create mode 100644 app/views/group_of_lines/index.js.slim
 delete mode 100644 app/views/group_of_lines/new.html.erb
 create mode 100644 app/views/group_of_lines/new.html.slim
 delete mode 100644 app/views/group_of_lines/show.html.erb
 create mode 100644 app/views/group_of_lines/show.html.slim
 delete mode 100644 app/views/group_of_lines/show.js.erb
 create mode 100644 app/views/group_of_lines/show.js.slim
 delete mode 100644 app/views/group_of_lines/show.kml.erb
 create mode 100644 app/views/group_of_lines/show.kml.slim
(limited to 'app')
diff --git a/app/views/group_of_lines/_form.erb b/app/views/group_of_lines/_form.erb
deleted file mode 100644
index d8417466a..000000000
--- a/app/views/group_of_lines/_form.erb
+++ /dev/null
@@ -1,31 +0,0 @@
-<%= semantic_form_for [@line_referential, @group_of_line] do |form| %>
-  <%= form.inputs do %>
-    <%= form.input :name, :input_html => {  :title => I18n.t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.group_of_line.name") } %>
-    <%= form.input :registration_number, :input_html => {  :title => I18n.t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.group_of_line.registration_number") } %>
-    <%= form.input :comment %>
-    <%= form.input :objectid, :required => !@group_of_line.new_record?, :input_html => {  :title => I18n.t("formtastic.titles#{format_restriction_for_locales(@referential)}.group_of_line.objectid") } %>
-  <% end %>
-
-  <%= form.inputs do %>
-    <%= form.input :line_tokens, :label => t('.lines'), :as => :text,  :input_html => { :"data-pre" => ( @group_of_line.lines.map { |line| { :id => line.id, :name => line.name } } ).to_json }  %>
-  <% end %>
-
-   <%= form.actions do %>
-     <%= form.action :submit, :as => :button %>
-     <%= form.action :cancel, :as => :link %>
-   <% end %>
-<% end %>
-
-
diff --git a/app/views/group_of_lines/_form.html.slim b/app/views/group_of_lines/_form.html.slim
new file mode 100644
index 000000000..dc26087ea
--- /dev/null
+++ b/app/views/group_of_lines/_form.html.slim
@@ -0,0 +1,27 @@
+= semantic_form_for [@line_referential, @group_of_line] do |form|
+  = form.inputs do
+    = form.input :name, input_html: { title: I18n.t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.group_of_line.name") }
+    = form.input :registration_number, input_html: { title: I18n.t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.group_of_line.registration_number") }
+    = form.input :comment
+    = form.input :objectid, :required => !@group_of_line.new_record?, :input_html => {  :title => I18n.t("formtastic.titles#{format_restriction_for_locales(@referential)}.group_of_line.objectid") }
+
+  = form.inputs do
+    = form.input :line_tokens, label: t('.lines'), as: :text,  :input_html => { :"data-pre" => ( @group_of_line.lines.map { |line| { id: line.id, name: line.name } } ).to_json }
+
+  = form.actions do
+    = form.action :submit, as: :button
+    = form.action :cancel, as: :link
+
+
+javascript:
+  $(function() {
+    $('#group_of_line_line_tokens').tokenInput("#{name_filter_referential_lines_path(@line_referential, format: :json)}", {
+       crossDomain: false,
+       prePopulate: $('#line_tokens').data('pre'),
+       minChars: 1,
+       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/group_of_lines/_group_of_line.erb b/app/views/group_of_lines/_group_of_line.erb
deleted file mode 100644
index c88a3835b..000000000
--- a/app/views/group_of_lines/_group_of_line.erb
+++ /dev/null
@@ -1,24 +0,0 @@
-
-  
-    
-      
-        <%= link_to edit_referential_group_of_line_path(@line_referential, group_of_line), :class => "btn btn-default btn-sm" do %>
-          
-        <% end if edit %>
-        <%= link_to(''.html_safe, line_referential_group_of_line_path(@line_referential, group_of_line), :method => :delete, :data => {:confirm =>  t('group_of_lines.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm") if delete %>
-      
-      
-        <%= link_to([@line_referential, group_of_line], :class => "preview", :title => "#{Chouette::GroupOfLine.model_name.human.capitalize} #{group_of_line.name}") do %>
-        
-          <%= truncate(group_of_line.name, :length => 20) %>
-        
-        <% end %>
-      
-    
-  
-  
-    
-    <%= group_of_line.human_attribute_name('line_count') %> <%=  group_of_line.lines.count %>
-    
-  
-
 
diff --git a/app/views/group_of_lines/_group_of_line.html.slim b/app/views/group_of_lines/_group_of_line.html.slim
new file mode 100644
index 000000000..90a041899
--- /dev/null
+++ b/app/views/group_of_lines/_group_of_line.html.slim
@@ -0,0 +1,19 @@
+#index_item.panel.panel-default
+  .panel-heading
+    .panel-title.clearfix
+      span.pull-right
+        - if edit
+          = link_to edit_referential_group_of_line_path(@line_referential, group_of_line), class: 'btn btn-default btn-sm' do
+            span.fa.fa-pencil
+        
+        = link_to(''.html_safe, line_referential_group_of_line_path(@line_referential, group_of_line), :method => :delete, :data => {:confirm =>  t('group_of_lines.actions.destroy_confirm')}, class: 'btn btn-danger btn-sm') if delete
+
+      h5
+        = link_to([@line_referential, group_of_line], :class => "preview", :title => "#{Chouette::GroupOfLine.model_name.human.capitalize} #{group_of_line.name}") do
+          span.name
+            = truncate(group_of_line.name, :length => 20)
+          
+  .panel-body
+    p
+      = group_of_line.human_attribute_name('line_count')
+      = group_of_line.lines.count
\ No newline at end of file
diff --git a/app/views/group_of_lines/_group_of_lines.erb b/app/views/group_of_lines/_group_of_lines.erb
deleted file mode 100644
index 212507d01..000000000
--- a/app/views/group_of_lines/_group_of_lines.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-
-   <%= t("will_paginate.page_entries_info.search") %> <%= page_entries_info @group_of_lines %>
-
-
-  <%= paginated_content(@group_of_lines) %>
-
-
diff --git a/app/views/group_of_lines/_group_of_lines.html.slim b/app/views/group_of_lines/_group_of_lines.html.slim
new file mode 100644
index 000000000..7e55caebe
--- /dev/null
+++ b/app/views/group_of_lines/_group_of_lines.html.slim
@@ -0,0 +1,9 @@
+.page_info
+  span.search = t("will_paginate.page_entries_info.search")
+  = page_entries_info @group_of_lines
+
+.group_of_lines.paginated_content
+  = paginated_content(@group_of_lines)
+
+.pagination
+  = will_paginate @group_of_lines, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer
\ No newline at end of file
diff --git a/app/views/group_of_lines/_lines_detail.html.erb b/app/views/group_of_lines/_lines_detail.html.erb
deleted file mode 100644
index a6d8c6a01..000000000
--- a/app/views/group_of_lines/_lines_detail.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-
-  <%= paginated_content @lines, "lines/line", :delete => false %>
-
diff --git a/app/views/group_of_lines/_lines_detail.html.slim b/app/views/group_of_lines/_lines_detail.html.slim
new file mode 100644
index 000000000..b0a885644
--- /dev/null
+++ b/app/views/group_of_lines/_lines_detail.html.slim
@@ -0,0 +1,2 @@
+.lines.paginated_content
+  = paginated_content @lines, "lines/line", :delete => false
\ No newline at end of file
diff --git a/app/views/group_of_lines/edit.html.erb b/app/views/group_of_lines/edit.html.erb
deleted file mode 100644
index 541e708ca..000000000
--- a/app/views/group_of_lines/edit.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= title_tag t('group_of_lines.edit.title', :group_of_line => @group_of_line.name) %>
-
-<%= render "form" %>
diff --git a/app/views/group_of_lines/edit.html.slim b/app/views/group_of_lines/edit.html.slim
new file mode 100644
index 000000000..75d530b08
--- /dev/null
+++ b/app/views/group_of_lines/edit.html.slim
@@ -0,0 +1,3 @@
+= title_tag t('group_of_lines.edit.title', :group_of_line => @group_of_line.name)
+
+= render 'form'
\ No newline at end of file
diff --git a/app/views/group_of_lines/index.html.erb b/app/views/group_of_lines/index.html.erb
deleted file mode 100644
index 0f34128f4..000000000
--- a/app/views/group_of_lines/index.html.erb
+++ /dev/null
@@ -1,26 +0,0 @@
-<%= title_tag t('group_of_lines.index.title') %>
-
-<%= search_form_for @q, :url => referential_group_of_lines_path(@line_referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| %>
-
-<% end %>
-
-<%= render 'group_of_lines' %>
-
-<% content_for :sidebar do %>
-
-  - <%= link_to t('group_of_lines.actions.new'), new_line_referential_group_of_line_path(@line_referential), :class => "add" %>
 
-  
-
-<% end %>
diff --git a/app/views/group_of_lines/index.html.slim b/app/views/group_of_lines/index.html.slim
new file mode 100644
index 000000000..23d8523d9
--- /dev/null
+++ b/app/views/group_of_lines/index.html.slim
@@ -0,0 +1,24 @@
+= title_tag t('group_of_lines.index.title')
+
+= search_form_for @q, :url => referential_group_of_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-12
+        = f.text_field :name_cont, :placeholder => "#{t('.name')}", class: 'form-control'
+        .input-group-btn
+          button.btn.btn-default type="submit"
+          i.fa.fa-search
+
+      / 
+      / 
+      / 
+      / 
+
+#group_of_lines
+  = render 'group_of_lines'
+
+- content_for :sidebar do
+  ul.actions
+    li
+      = link_to t('group_of_lines.actions.new'), new_line_referential_group_of_line_path(@line_referential), class: 'add'
+    br
\ No newline at end of file
diff --git a/app/views/group_of_lines/index.js.erb b/app/views/group_of_lines/index.js.erb
deleted file mode 100644
index fe3e96b5e..000000000
--- a/app/views/group_of_lines/index.js.erb
+++ /dev/null
@@ -1 +0,0 @@
-$('#group_of_lines').html('<%= escape_javascript(render("group_of_lines")) %>');
\ No newline at end of file
diff --git a/app/views/group_of_lines/index.js.slim b/app/views/group_of_lines/index.js.slim
new file mode 100644
index 000000000..afd8a87bc
--- /dev/null
+++ b/app/views/group_of_lines/index.js.slim
@@ -0,0 +1 @@
+$('#group_of_lines').html("#{escape_javascript(render('group_of_lines'))}");
\ No newline at end of file
diff --git a/app/views/group_of_lines/new.html.erb b/app/views/group_of_lines/new.html.erb
deleted file mode 100644
index a2da652af..000000000
--- a/app/views/group_of_lines/new.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= title_tag t('group_of_lines.new.title') %>
-
-<%= render "form" %>
diff --git a/app/views/group_of_lines/new.html.slim b/app/views/group_of_lines/new.html.slim
new file mode 100644
index 000000000..3b4455ce6
--- /dev/null
+++ b/app/views/group_of_lines/new.html.slim
@@ -0,0 +1,3 @@
+= title_tag t('group_of_lines.new.title')
+
+= render 'form'
\ No newline at end of file
diff --git a/app/views/group_of_lines/show.html.erb b/app/views/group_of_lines/show.html.erb
deleted file mode 100644
index 557d8c82b..000000000
--- a/app/views/group_of_lines/show.html.erb
+++ /dev/null
@@ -1,31 +0,0 @@
-<%= title_tag t('group_of_lines.show.title', :group_of_line => @group_of_line.name )%>
-
-
-  <%= @map.to_html %>
-  
-    
-      
-      <%= @group_of_line.registration_number %>
-    
-    
-      
-      <%= @group_of_line.comment %>
-    
-  
-
-  
-  
<%= t('.lines') %>
-  
-     <%= render :partial => "lines_detail"  %>
-  
-
 
-
-<% content_for :sidebar do %>
-
-  - <%= link_to t('group_of_lines.actions.new'), new_line_referential_group_of_line_path(@line_referential), :class => "add" %>
 
-  - <%= link_to t('group_of_lines.actions.edit'), edit_line_referential_group_of_line_path(@line_referential, @group_of_line), :class => "edit" %>
 
-  - <%= link_to  t('group_of_lines.actions.destroy'), line_referential_group_of_line_path(@line_referential, @group_of_line), :method => :delete, :data => {:confirm =>  t('group_of_lines.actions.destroy_confirm')} , :class => "remove" %>
 
-  
-
-  <%= creation_tag(@group_of_line) %>
-<% end %>
diff --git a/app/views/group_of_lines/show.html.slim b/app/views/group_of_lines/show.html.slim
new file mode 100644
index 000000000..0862c88f8
--- /dev/null
+++ b/app/views/group_of_lines/show.html.slim
@@ -0,0 +1,31 @@
+= title_tag t('group_of_lines.show.title', :group_of_line => @group_of_line.name )
+
+.group_of_line_show
+  = @map.to_html
+  
+  .summary
+    p
+      label = "#{@group_of_line.human_attribute_name('registration_number')} : "
+      = @group_of_line.registration_number
+
+    p
+      label = "#{@group_of_line.human_attribute_name('comment')} : "
+      = @group_of_line.comment
+
+  p.after_map
+  
+  h3.group_of_line_lines = t('.lines')
+  .lines_detail
+    = render partial: "lines_detail" 
+
+- content_for :sidebar do
+  ul.actions
+    li
+      = link_to t('group_of_lines.actions.new'), new_line_referential_group_of_line_path(@line_referential), class: 'add'
+    li
+      = link_to t('group_of_lines.actions.edit'), edit_line_referential_group_of_line_path(@line_referential, @group_of_line), class: 'edit'
+    li
+      = link_to  t('group_of_lines.actions.destroy'), line_referential_group_of_line_path(@line_referential, @group_of_line), :method => :delete, :data => {:confirm =>  t('group_of_lines.actions.destroy_confirm')} , class: 'remove'
+    br
+
+  = creation_tag(@group_of_line)
\ No newline at end of file
diff --git a/app/views/group_of_lines/show.js.erb b/app/views/group_of_lines/show.js.erb
deleted file mode 100644
index bd8ac5a7f..000000000
--- a/app/views/group_of_lines/show.js.erb
+++ /dev/null
@@ -1,4 +0,0 @@
-$(function (){
-  $(".lines_detail").html("<%= escape_javascript(render(:partial => "lines_detail")) %>");
-});
-
diff --git a/app/views/group_of_lines/show.js.slim b/app/views/group_of_lines/show.js.slim
new file mode 100644
index 000000000..4fd1e4ad6
--- /dev/null
+++ b/app/views/group_of_lines/show.js.slim
@@ -0,0 +1,3 @@
+$(function (){
+  $('.lines_detail').html("#{escape_javascript(render(partial: 'lines_detail'))}");
+});
\ No newline at end of file
diff --git a/app/views/group_of_lines/show.kml.erb b/app/views/group_of_lines/show.kml.erb
deleted file mode 100644
index 6952db240..000000000
--- a/app/views/group_of_lines/show.kml.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-  
-  <% @group_of_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/group_of_lines/show.kml.slim b/app/views/group_of_lines/show.kml.slim
new file mode 100644
index 000000000..094d05839
--- /dev/null
+++ b/app/views/group_of_lines/show.kml.slim
@@ -0,0 +1,10 @@
+doctype XML
+
+kml xmlns="http://www.opengis.net/kml/2.2"
+  document
+    - @group_of_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_type_label = (stop_area.position or stop_area.default_position).kml_representation.html_safe
\ No newline at end of file
-- 
cgit v1.2.3