diff options
| author | jpl | 2016-07-27 15:42:15 +0200 |
|---|---|---|
| committer | jpl | 2016-07-27 15:42:15 +0200 |
| commit | fa58399ce050afdcd2b7231d52df197f0eb22911 (patch) | |
| tree | 77ed9e5bf16f1b658b36105ef2da117f929fc957 | |
| parent | 589c53ed96d42eab707841f69411261670dbc471 (diff) | |
| download | chouette-core-fa58399ce050afdcd2b7231d52df197f0eb22911.tar.bz2 | |
Refs #1295: convert erb to slim (access_points)
| -rw-r--r-- | app/views/access_links/edit.html.slim | 2 | ||||
| -rw-r--r-- | app/views/access_links/new.html.slim | 2 | ||||
| -rw-r--r-- | app/views/access_points/_access_point.html.erb | 29 | ||||
| -rw-r--r-- | app/views/access_points/_access_point.html.slim | 20 | ||||
| -rw-r--r-- | app/views/access_points/_form.html.erb | 54 | ||||
| -rw-r--r-- | app/views/access_points/_form.html.slim | 44 | ||||
| -rw-r--r-- | app/views/access_points/edit.html.erb | 3 | ||||
| -rw-r--r-- | app/views/access_points/edit.html.slim | 2 | ||||
| -rw-r--r-- | app/views/access_points/index.html.erb | 26 | ||||
| -rw-r--r-- | app/views/access_points/index.html.slim | 25 | ||||
| -rw-r--r-- | app/views/access_points/index.kml.erb | 12 | ||||
| -rw-r--r-- | app/views/access_points/index.kml.slim | 9 | ||||
| -rw-r--r-- | app/views/access_points/new.html.erb | 3 | ||||
| -rw-r--r-- | app/views/access_points/new.html.slim | 2 | ||||
| -rw-r--r-- | app/views/access_points/show.html.erb | 116 | ||||
| -rw-r--r-- | app/views/access_points/show.html.slim | 105 | ||||
| -rw-r--r-- | app/views/access_points/show.kml.erb | 10 | ||||
| -rw-r--r-- | app/views/access_points/show.kml.slim | 8 |
18 files changed, 217 insertions, 255 deletions
diff --git a/app/views/access_links/edit.html.slim b/app/views/access_links/edit.html.slim index ca9cfb47f..c25f46432 100644 --- a/app/views/access_links/edit.html.slim +++ b/app/views/access_links/edit.html.slim @@ -1,2 +1,2 @@ = title_tag t("access_links.edit.title_#{@orientation}", access_point: @access_point.name, stop_area: @stop_area.name ) -= render "form"
\ No newline at end of file += render 'form'
\ No newline at end of file diff --git a/app/views/access_links/new.html.slim b/app/views/access_links/new.html.slim index 85b3c886f..e99f8f9de 100644 --- a/app/views/access_links/new.html.slim +++ b/app/views/access_links/new.html.slim @@ -1,2 +1,2 @@ = title_tag t("access_links.new.title_#{@orientation}", access_point: @access_point.name, stop_area: @stop_area.name ) -= render "form"
\ No newline at end of file += render 'form'
\ No newline at end of file diff --git a/app/views/access_points/_access_point.html.erb b/app/views/access_points/_access_point.html.erb deleted file mode 100644 index 714e7dc12..000000000 --- a/app/views/access_points/_access_point.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<div id="index_item" class="panel panel-default access_point"> - <div class="panel-heading"> - <div class="panel-title clearfix"> - <span class="pull-right"> - <%= link_to edit_referential_stop_area_access_point_path(@referential, @stop_area, access_point), :class => "btn btn-default btn-sm" do %> - <span class="fa fa-pencil"></span> - <% end %> - <%= link_to referential_stop_area_access_point_path(@referential, @stop_area, access_point), :method => :delete, :data => {:confirm => t('access_points.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %> - <span class="fa fa-trash-o"></span> - <% end %> - </span> - <h5> - <%= link_to([@referential, @stop_area, access_point], :class => "preview", :title => "#{Chouette::StopArea.model_name.human.capitalize} #{access_point.name}") do %> - <span class="name"> - <%= image_tag "map/access_" + access_point.access_point_type + ".png" %> <%= truncate(access_point.name, :length => 20) %> - </span> - <% end %> - </h5> - </div> - </div> - <div class="panel-body"> - <% unless access_point.geometry %> - <p> - <span class="warning"><%= t('.no_position') %></span> - - </p> - <% end %> - <p><%= t("access_types.label.#{access_point.access_point_type}") %></p> - </div> -</div> diff --git a/app/views/access_points/_access_point.html.slim b/app/views/access_points/_access_point.html.slim new file mode 100644 index 000000000..b10883eba --- /dev/null +++ b/app/views/access_points/_access_point.html.slim @@ -0,0 +1,20 @@ +#index_item.panel.panel-default.access_point + .panel-heading + .panel-title.clearfix + span.pull-right + = link_to edit_referential_stop_area_access_point_path(@referential, @stop_area, access_point), class: 'btn btn-default btn-sm' do + span.fa.fa-pencil + = link_to referential_stop_area_access_point_path(@referential, @stop_area, access_point), method: :delete, data: {:confirm => t('access_points.actions.destroy_confirm')}, class: 'btn btn-danger btn-sm' do + span.fa.fa-trash-o + h5 + = link_to [@referential, @stop_area, access_point], class: 'preview', title: "#{Chouette::StopArea.model_name.human.capitalize} #{access_point.name}" do + span.name + = image_tag "map/access_#{access_point.access_point_type}.png" + = truncate(access_point.name, :length => 20) + + .panel-body + - unless access_point.geometry + p + span.warning = t('.no_position') + = " -" + p = t("access_types.label.#{access_point.access_point_type}")
\ No newline at end of file diff --git a/app/views/access_points/_form.html.erb b/app/views/access_points/_form.html.erb deleted file mode 100644 index 9057bb7bb..000000000 --- a/app/views/access_points/_form.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -<div class="container-fluid"> - <% if @map %> - <%= @map.to_html %> - <% end %> - <%= semantic_form_for [@referential, @stop_area, @access_point] do |form| %> - <%= form.inputs do %> - <%= form.input :id, :as => :hidden %> - <%= form.input :name %> - <%= form.input :access_point_type, :as => :select, - :input_html => {:disabled => !@access_point.new_record? }, - :collection => Chouette::AccessPoint.access_point_types, - :include_blank => false, - :member_label => Proc.new { |access_point_type| t("access_types.label.#{access_point_type}") } %> - <%= form.input :street_name %> - <%= form.input :country_code %> - <%= form.input :zip_code %> - <%= form.input :city_name %> - <%= form.input :comment %> - <%= form.input :openning_time, :as => :time_picker, - :input_html => { :class => "form-control input-sm timepicker_basic"}, - :wrapper_html => { :class => "input-append bootstrap-timepicker" } %> - <%= form.input :closing_time, :as => :time_picker, - :input_html => { :class => "form-control input-sm timepicker_basic"}, - :wrapper_html => { :class => "input-append bootstrap-timepicker" } %> - <%= form.input :mobility_restricted_suitability,:as => :boolean %> - <%= form.input :stairs_availability,:as => :boolean %> - <%= form.input :lift_availability,:as => :boolean %> - <%= form.input :objectid, :required => !@access_point.new_record?, - :input_html => { :title => t("formtastic.titles.access_point.objectid")} %> - - <%= form.inputs :name => t('access_points.show.geographic_data') do %> - <% if ! @referential.projection_type_label.empty? %> - <div class="panel panel-default"> - <div class="panel-heading"><%= @referential.projection_type_label %></div> - <div class="panel-body"> - <%= form.input :projection_xy, :input_html => { :title => t("formtastic.titles.access_point.projection_xy")} %> - </div> - </div> - <% end %> - <div class="panel panel-default"> - <div class="panel-heading">WGS84</div> - <div class="panel-body"> - <%= form.input :coordinates, :input_html => { :title => t("formtastic.titles.access_point.coordinates")} %> - </div> - </div> - <% end %> - <% end %> - - <%= form.actions do %> - <%= form.action :submit, :as => :button %> - <%= form.action :cancel, :as => :link %> - <% end %> - <% end %> -</div> diff --git a/app/views/access_points/_form.html.slim b/app/views/access_points/_form.html.slim new file mode 100644 index 000000000..1874644d5 --- /dev/null +++ b/app/views/access_points/_form.html.slim @@ -0,0 +1,44 @@ +.container-fluid + = @map.to_html if @map + + = semantic_form_for [@referential, @stop_area, @access_point] do |form| + = form.inputs do + = form.input :id, as: :hidden + = form.input :name + = form.input :access_point_type, as: :select, + :input_html => {:disabled => !@access_point.new_record? }, + :collection => Chouette::AccessPoint.access_point_types, + include_blank: false, + :member_label => Proc.new { |access_point_type| t("access_types.label.#{access_point_type}") } + = form.input :street_name + = form.input :country_code + = form.input :zip_code + = form.input :city_name + = form.input :comment + = form.input :openning_time, as: :time_picker, + :input_html => { class: 'form-control input-sm timepicker_basic'}, + :wrapper_html => { class: 'input-append bootstrap-timepicker' } + = form.input :closing_time, as: :time_picker, + :input_html => { :class => "form-control input-sm timepicker_basic"}, + :wrapper_html => { :class => "input-append bootstrap-timepicker" } + = form.input :mobility_restricted_suitability, as: :boolean + = form.input :stairs_availability,as: :boolean + = form.input :lift_availability, as: :boolean + = form.input :objectid, :required => !@access_point.new_record?, + :input_html => { :title => t('formtastic.titles.access_point.objectid')} + + = form.inputs :name => t('access_points.show.geographic_data') do + - if !@referential.projection_type_label.empty? + .panel.panel-default + .panel-heading = @referential.projection_type_label + .panel-body + = form.input :projection_xy, :input_html => { :title => t("formtastic.titles.access_point.projection_xy")} + + .panel.panel-default + .panel-heading = "WGS84" + .panel-body + = form.input :coordinates, :input_html => { :title => t("formtastic.titles.access_point.coordinates")} + + = form.actions do + = form.action :submit, as: :button + = form.action :cancel, as: :link
\ No newline at end of file diff --git a/app/views/access_points/edit.html.erb b/app/views/access_points/edit.html.erb deleted file mode 100644 index cc5dc217f..000000000 --- a/app/views/access_points/edit.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= title_tag t('access_points.edit.title', :access_point => @access_point.name ) %> - -<%= render "form" %> diff --git a/app/views/access_points/edit.html.slim b/app/views/access_points/edit.html.slim new file mode 100644 index 000000000..a19765998 --- /dev/null +++ b/app/views/access_points/edit.html.slim @@ -0,0 +1,2 @@ += title_tag t('access_points.edit.title', access_point: @access_point.name ) += render 'form'
\ No newline at end of file diff --git a/app/views/access_points/index.html.erb b/app/views/access_points/index.html.erb deleted file mode 100644 index 164169205..000000000 --- a/app/views/access_points/index.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<%= title_tag t('access_points.index.title', :stop_area => @stop_area.name) %> - -<%= search_form_for @q, :url => referential_stop_area_access_points_path(@referential,@stop_area), :html => {:method => :get} do |f| %> - <%= f.label :name_or_country_code_cont, "#{t('.name_or_country_code')} :" %> - <%= f.text_field :name_or_country_code_cont %> - - <%= f.submit t('actions.search') %> <%= t("or") %> - <%= link_to t("cancel"), referential_stop_area_access_points_path(@referential,@stop_area) %> -<% end %> - -<div class="page_info"> - <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @access_points %> -</div> -<div class="access_points paginated_content"> - <%= render :partial => "access_point", :collection => @access_points %> -</div> -<div class="pagination"> - <%= will_paginate @access_points, :container => false %> -</div> - -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('access_points.actions.new'), new_referential_stop_area_access_point_path(@referential,@stop_area), :class => "add" %></li> -</ul> - -<% end %> diff --git a/app/views/access_points/index.html.slim b/app/views/access_points/index.html.slim new file mode 100644 index 000000000..b48abc970 --- /dev/null +++ b/app/views/access_points/index.html.slim @@ -0,0 +1,25 @@ += title_tag t('access_points.index.title', stop_area: @stop_area.name) + += search_form_for @q, :url => referential_stop_area_access_points_path(@referential,@stop_area), :html => {:method => :get} do |f| + = f.label :name_or_country_code_cont, "#{t('.name_or_country_code')} :" + = f.text_field :name_or_country_code_cont + + = f.submit t('actions.search') + = t('or') + + = link_to t("cancel"), referential_stop_area_access_points_path(@referential,@stop_area) + +.page_info + span.search = t('will_paginate.page_entries_info.search') + = page_entries_info @access_points + +.access_points.paginated_content + = render partial: 'access_point', collection: @access_points + +.pagination + = will_paginate @access_points, container: false + +- content_for :sidebar do + ul.actions + li + = link_to t('access_points.actions.new'), new_referential_stop_area_access_point_path(@referential,@stop_area), class: 'add'
\ No newline at end of file diff --git a/app/views/access_points/index.kml.erb b/app/views/access_points/index.kml.erb deleted file mode 100644 index bbcf19d23..000000000 --- a/app/views/access_points/index.kml.erb +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<kml xmlns="http://www.opengis.net/kml/2.2"> - <Document> - <% @access_points.where("latitude is not null and longitude is not null").each do |access_point| %> - <Placemark id="<%= access_point.id %>" > - <name><%= access_point.name %></name> - <access_point_type><%= access_pointaccess_point_type %></access_point_type> - <%= access_point.geometry.kml_representation.html_safe %> - </Placemark> - <% end %> - </Document> -</kml> diff --git a/app/views/access_points/index.kml.slim b/app/views/access_points/index.kml.slim new file mode 100644 index 000000000..65dacbd17 --- /dev/null +++ b/app/views/access_points/index.kml.slim @@ -0,0 +1,9 @@ +doctype XML + +kml xmlns="http://www.opengis.net/kml/2.2" + document + - @access_points.where("latitude is not null and longitude is not null").each do |access_point| + placemark id="#{access_point.id}" + name = access_point.name + access_point_type = access_pointaccess_point_type + = access_point.geometry.kml_representation.html_safe diff --git a/app/views/access_points/new.html.erb b/app/views/access_points/new.html.erb deleted file mode 100644 index 3b9c8a397..000000000 --- a/app/views/access_points/new.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= title_tag t('access_points.new.title') %> - -<%= render "form" %> diff --git a/app/views/access_points/new.html.slim b/app/views/access_points/new.html.slim new file mode 100644 index 000000000..25612564e --- /dev/null +++ b/app/views/access_points/new.html.slim @@ -0,0 +1,2 @@ += title_tag t('access_points.new.title') += render 'form'
\ No newline at end of file diff --git a/app/views/access_points/show.html.erb b/app/views/access_points/show.html.erb deleted file mode 100644 index 9f5e600e6..000000000 --- a/app/views/access_points/show.html.erb +++ /dev/null @@ -1,116 +0,0 @@ -<%= title_tag t('access_points.show.title', :access_point => @access_point.name) %> -<div class="access_point_show"> - <% if @access_point.long_lat_type != nil %> - <%= @map.to_html %> - <% end %> - <div class="summary"> - <p> - <label><%= @access_point.human_attribute_name("comment") %>: </label> - <%= @access_point.comment %> - </p> - <p> - <label><%= @access_point.human_attribute_name("street_name") %>: </label> - <%= @access_point.street_name %> - </p> - <p> - <label><%= @access_point.human_attribute_name("country_code") %>: </label> - <%= @access_point.country_code %> - </p> - <p> - <label><%= @access_point.human_attribute_name("zip_code") %>: </label> - <%= @access_point.zip_code %> - </p> - <p> - <label><%= @access_point.human_attribute_name("city_name") %>: </label> - <%= @access_point.city_name %> - </p> - <p> - <label><%= @access_point.human_attribute_name("access_point_type") %>: </label> - <%= t("access_types.label.#{@access_point.access_point_type}") %> - </p> - <p> - <label><%= @access_point.human_attribute_name("openning_time") %>: </label> - <% if (@access_point.openning_time.present?) %> - <%= @access_point.openning_time.strftime('%Hh %Mm') %> - <% end %> - </p> - <p> - <label><%= @access_point.human_attribute_name("closing_time") %>: </label> - <% if (@access_point.closing_time.present?) %> - <%= @access_point.closing_time.strftime('%Hh %Mm') %> - <% end %> - </p> - <p> - <label><%= @access_point.human_attribute_name("mobility_restricted_suitability") %>: </label> - <%= t((@access_point.mobility_restricted_suitability == true).to_s) %> - </p> - <p> - <label><%= @access_point.human_attribute_name("stairs_availability") %>: </label> - <%= t((@access_point.stairs_availability == true).to_s) %> - </p> - <p> - <label><%= @access_point.human_attribute_name("lift_availability") %>: </label> - <%= t((@access_point.lift_availability == true).to_s) %> - </p> - <p> <label><%= t('access_points.show.geographic_data') %> </label></p> - <% if @access_point.long_lat_type == nil %> - <span class='geo_data'><%= t('access_points.show.no_geographic_data') %></span> - <% else %> - <% if !@access_point.projection.nil? %> - <p> - <span class='geo_data'><%= @access_point.human_attribute_name("projection") %>: </span> - <%= @referential.projection_type_label %> - </p> - <p> - <span class='geo_data'><%= @access_point.human_attribute_name("projection_x") %>: </span> - <%= @access_point.projection_x %> - </p> - <p> - <span class='geo_data'><%= @access_point.human_attribute_name("projection_y") %>: </span> - <%= @access_point.projection_y %> - </p> - <% end %> - <% if !@access_point.long_lat_type.nil? %> - <p> - <span class='geo_data'><%= @access_point.human_attribute_name("long_lat_type") %>: </span> - <%= @access_point.long_lat_type %> - </p> - <p> - <span class='geo_data'><%= @access_point.human_attribute_name("longitude") %>: </span> - <%= @access_point.longitude %> - </p> - <p> - <span class='geo_data'><%= @access_point.human_attribute_name("latitude") %>: </span> - <%= @access_point.latitude %> - </p> - <% end %> - <% end %> - </div> -</div> - -<div> - <h3 class="access_point_generics"><%= t('.generic_access_links') %></h3> - <div class="access_link_pairs"> - <table> - <%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@generic_access_links) %> - </table> - </div> - - <h3 class="access_point_details"><%= t('.detail_access_links') %></h3> - <div class="access_link_pairs"> - <table> - <%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@detail_access_links) %> - </table> - </div> -</div> - - -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('access_points.actions.new'), new_referential_stop_area_access_point_path(@referential,@stop_area), :class => "add" %></li> - <li><%= link_to t('access_points.actions.edit'), edit_referential_stop_area_access_point_path(@referential, @stop_area, @access_point), :class => "edit" %></li> - <li><%= link_to t('access_points.actions.destroy'), referential_stop_area_access_point_path(@referential, @stop_area, @access_point), :method => :delete, :data => {:confirm => t('access_points.actions.destroy_confirm')}, :class => "remove" %></li> -</ul> - <br> - <%= creation_tag(@access_point) %> -<% end %> diff --git a/app/views/access_points/show.html.slim b/app/views/access_points/show.html.slim new file mode 100644 index 000000000..7c87fa16e --- /dev/null +++ b/app/views/access_points/show.html.slim @@ -0,0 +1,105 @@ += title_tag t('access_points.show.title', access_point: @access_point.name) + +.access_point_show + = @map.to_html if @access_point.long_lat_type != nil + + .summary + p + label = "#{@access_point.human_attribute_name('comment')} : " + = @access_point.comment + + p + label = "#{@access_point.human_attribute_name('street_name')} : " + = @access_point.street_name + + p + label = "#{@access_point.human_attribute_name('country_code')} : " + = @access_point.country_code + + p + label = "#{@access_point.human_attribute_name('zip_code')} : " + = @access_point.zip_code + + p + label = "#{@access_point.human_attribute_name('city_name')} : " + = @access_point.city_name + + p + label = "#{@access_point.human_attribute_name('access_point_type')} : " + = t("access_types.label.#{@access_point.access_point_type}") + + p + label = "#{@access_point.human_attribute_name('openning_time')} : " + - if @access_point.openning_time.present? + = @access_point.openning_time.strftime('%Hh %Mm') + + p + label = "#{@access_point.human_attribute_name('closing_time')} : " + - if @access_point.closing_time.present? + = @access_point.closing_time.strftime('%Hh %Mm') + + p + label = "#{@access_point.human_attribute_name('mobility_restricted_suitability')} : " + = t((@access_point.mobility_restricted_suitability == true).to_s) + + p + label = "#{@access_point.human_attribute_name('stairs_availability')} : " + = t((@access_point.stairs_availability == true).to_s) + + p + label = "#{@access_point.human_attribute_name('lift_availability')} : " + = t((@access_point.lift_availability == true).to_s) + + p + label = t('access_points.show.geographic_data') + + - if @access_point.long_lat_type == nil + span.geo_data = t('access_points.show.no_geographic_data') + - else + - if !@access_point.projection.nil? + p + span.geo_data = "#{@access_point.human_attribute_name('projection')} : " + = @referential.projection_type_label + + p + span.geo_data = "#{@access_point.human_attribute_name('projection_x')} : " + = @access_point.projection_x + + p + span.geo_data = "#{@access_point.human_attribute_name('projection_y')} : " + = @access_point.projection_y + + - if !@access_point.long_lat_type.nil? + p + span.geo_data = "#{@access_point.human_attribute_name('long_lat_type')} : " + = @access_point.long_lat_type + + p + span.geo_data = "#{@access_point.human_attribute_name('longitude')} : " + = @access_point.longitude + + p + span.geo_data = "#{@access_point.human_attribute_name('latitude')} : " + = @access_point.latitude + +div + h3.access_point_generics = t('.generic_access_links') + div.access_link_pairs + table + = render partial: 'access_link_pairs/access_link_pair', collection: access_links_pairs(@generic_access_links) + + h3.access_point_details = t('.detail_access_links') + div.access_link_pairs + table + = render partial: 'access_link_pairs/access_link_pair', collection: access_links_pairs(@detail_access_links) + +- content_for :sidebar do + ul.actions + li + = link_to t('access_points.actions.new'), new_referential_stop_area_access_point_path(@referential,@stop_area), class: 'add' + li + = link_to t('access_points.actions.edit'), edit_referential_stop_area_access_point_path(@referential, @stop_area, @access_point), class: 'edit' + li + = link_to t('access_points.actions.destroy'), referential_stop_area_access_point_path(@referential, @stop_area, @access_point), :method => :delete, :data => {:confirm => t('access_points.actions.destroy_confirm')}, class: 'remove' + br + = creation_tag(@access_point) diff --git a/app/views/access_points/show.kml.erb b/app/views/access_points/show.kml.erb deleted file mode 100644 index f54e6340e..000000000 --- a/app/views/access_points/show.kml.erb +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<kml xmlns="http://www.opengis.net/kml/2.2"> - <Document> - <Placemark id="<%= @access_point.id %>" > - <name><%= @access_point.name %></name> - <access_point_type><%= @access_point.access_point_type %></access_point_type> - <%= (@access_point.position or @access_point.default_position).kml_representation.html_safe %> - </Placemark> - </Document> -</kml> diff --git a/app/views/access_points/show.kml.slim b/app/views/access_points/show.kml.slim new file mode 100644 index 000000000..6cbc7e036 --- /dev/null +++ b/app/views/access_points/show.kml.slim @@ -0,0 +1,8 @@ +doctype XML + +kml xmlns="http://www.opengis.net/kml/2.2" + document + placemark id="#{@access_point.id}" + name = @access_point.name + access_point_type = @access_point.access_point_type + = (@access_point.position or @access_point.default_position).kml_representation.html_safe |
