diff options
| author | jpl | 2016-07-29 16:15:52 +0200 | 
|---|---|---|
| committer | jpl | 2016-07-29 16:15:52 +0200 | 
| commit | 466a7c1c60950315d0d6a17ea5d71cf152c0dc40 (patch) | |
| tree | e6ff5f144f746e3a83003c4b1ba79e3769186656 /app/views | |
| parent | 27019472a47185803ccd8abac93b4d50bc0ba671 (diff) | |
| download | chouette-core-466a7c1c60950315d0d6a17ea5d71cf152c0dc40.tar.bz2 | |
Refs #1295: convert erb to slim (group_of_lines)
Diffstat (limited to 'app/views')
22 files changed, 132 insertions, 149 deletions
| 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 %> - -<script> -  $(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') %>' -    }); -  }); -</script> 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 @@ -<div id="index_item" class="panel panel-default"> -  <div class="panel-heading"> -    <div class="panel-title clearfix"> -      <span class="pull-right"> -        <%= link_to edit_referential_group_of_line_path(@line_referential, group_of_line), :class => "btn btn-default btn-sm" do %> -          <span class="fa fa-pencil"></span> -        <% end if edit %> -        <%= link_to('<span class="fa fa-trash-o"></span>'.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 %> -      </span> -      <h5> -        <%= link_to([@line_referential, group_of_line], :class => "preview", :title => "#{Chouette::GroupOfLine.model_name.human.capitalize} #{group_of_line.name}") do %> -        <span class="name"> -          <%= truncate(group_of_line.name, :length => 20) %> -        </span> -        <% end %> -      </h5> -    </div> -  </div> -  <div class="panel-body"> -    <p> -    <%= group_of_line.human_attribute_name('line_count') %> <%=  group_of_line.lines.count %> -    </p> -  </div> -</div> 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('<span class="fa fa-trash-o"></span>'.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 @@ -<div class="page_info"> -  <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @group_of_lines %> -</div> -<div class="group_of_lines paginated_content"> -  <%= paginated_content(@group_of_lines) %> -</div> -<div class="pagination"> -  <%= will_paginate @group_of_lines, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %> -</div> 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 @@ -<div class="lines paginated_content"> -  <%= paginated_content @lines, "lines/line", :delete => false %> -</div> 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| %> -<div class="panel panel-default"> -  <div class="panel-heading"> -    <div class="input-group col-md-12"> -      <%= f.text_field :name_cont, :placeholder => "#{t('.name')}", :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> -<% end %> - -<div id="group_of_lines"><%= render 'group_of_lines' %></div> - -<% content_for :sidebar do %> -<ul class="actions"> -  <li><%= link_to t('group_of_lines.actions.new'), new_line_referential_group_of_line_path(@line_referential), :class => "add" %></li> -  <br> -</ul> -<% 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 + +      / <!-- /input-group --> +      / <!-- <a data-toggle="collapse" data-parent="#search" href="#advanced_search"> --> +      / <!--   <i class="fa fa-plus"></i> <%= "#{t('.advanced_search')}" %> --> +      / <!-- </a> --> + +#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 )%> - -<div class="group_of_line_show"> -  <%= @map.to_html %> -  <div class="summary"> -    <p> -      <label><%= @group_of_line.human_attribute_name("registration_number") %>: </label> -      <%= @group_of_line.registration_number %> -    </p> -    <p> -      <label><%= @group_of_line.human_attribute_name("comment") %>: </label> -      <%= @group_of_line.comment %> -    </p> -  </div> - -  <p class="after_map" /> -  <h3 class="group_of_line_lines"><%= t('.lines') %></h3> -  <div class="lines_detail"> -     <%= render :partial => "lines_detail"  %> -  </div> -</div> - -<% content_for :sidebar do %> -<ul class="actions"> -  <li><%= link_to t('group_of_lines.actions.new'), new_line_referential_group_of_line_path(@line_referential), :class => "add" %></li> -  <li><%= link_to t('group_of_lines.actions.edit'), edit_line_referential_group_of_line_path(@line_referential, @group_of_line), :class => "edit" %></li> -  <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" %></li> -  <br> -</ul> -  <%= 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<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 %></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/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 | 
