aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpl2016-07-27 17:53:18 +0200
committerjpl2016-07-27 17:53:18 +0200
commitbb307e52c60780517a21de31ba07b4c4720c9a4f (patch)
tree7b1796f89ce95ee23fadc15f3a571f12ec090c1d
parentfa58399ce050afdcd2b7231d52df197f0eb22911 (diff)
downloadchouette-core-bb307e52c60780517a21de31ba07b4c4720c9a4f.tar.bz2
Refs #1295: convert erb to slim (companies)
-rw-r--r--app/views/companies/_companies.erb9
-rw-r--r--app/views/companies/_companies.html.slim9
-rw-r--r--app/views/companies/_company.erb26
-rw-r--r--app/views/companies/_company.html.slim16
-rw-r--r--app/views/companies/_form.erb21
-rw-r--r--app/views/companies/_form.html.slim18
-rw-r--r--app/views/companies/edit.html.erb3
-rw-r--r--app/views/companies/edit.html.slim2
-rw-r--r--app/views/companies/index.html.erb26
-rw-r--r--app/views/companies/index.html.slim25
-rw-r--r--app/views/companies/index.js.erb1
-rw-r--r--app/views/companies/index.js.slim1
-rw-r--r--app/views/companies/new.html.erb3
-rw-r--r--app/views/companies/new.html.slim2
-rw-r--r--app/views/companies/show.html.erb57
-rw-r--r--app/views/companies/show.html.slim55
16 files changed, 128 insertions, 146 deletions
diff --git a/app/views/companies/_companies.erb b/app/views/companies/_companies.erb
deleted file mode 100644
index 9464f0c1a..000000000
--- a/app/views/companies/_companies.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( @companies ) %>
-</div>
-<div class="companies paginated_content">
- <%= paginated_content(@companies) %>
-</div>
-<div class="pagination">
- <%= will_paginate @companies, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
-</div> \ No newline at end of file
diff --git a/app/views/companies/_companies.html.slim b/app/views/companies/_companies.html.slim
new file mode 100644
index 000000000..bcd471cc7
--- /dev/null
+++ b/app/views/companies/_companies.html.slim
@@ -0,0 +1,9 @@
+.page_info
+ span.search = t('will_paginate.page_entries_info.search')
+ = page_entries_info(@companies)
+
+.companies.paginated_content
+ = paginated_content(@companies)
+
+.pagination
+ = will_paginate @companies, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer \ No newline at end of file
diff --git a/app/views/companies/_company.erb b/app/views/companies/_company.erb
deleted file mode 100644
index 534c4c7a6..000000000
--- a/app/views/companies/_company.erb
+++ /dev/null
@@ -1,26 +0,0 @@
-<div id="index_item" class="company panel panel-default">
- <div class="panel-heading">
- <div class="panel-title clearfix">
- <span class="pull-right">
- <%= link_to edit_referential_company_path(@referential, company), :class => "btn btn-default btn-sm" do %>
- <span class="fa fa-pencil"></span>
- <% end %>
- <%= link_to referential_company_path(@referential, company), :method => :delete, :data => {:confirm => t('companies.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
- <span class="fa fa-trash-o"></span>
- <% end %>
- </span>
- <h5>
- <%= link_to([@referential, company], :class => "preview", :title => "#{Chouette::Company.model_name.human.capitalize} #{company.name}") do %>
- <span class="name">
- <%= truncate(company.name, :length => 20) %>
- </span>
- <% end %>
- </h5>
- </div>
- </div>
- <div class="panel-body">
- <p>
- <%= company.human_attribute_name('code') %> <%= company.code %>
- </p>
- </div>
-</div>
diff --git a/app/views/companies/_company.html.slim b/app/views/companies/_company.html.slim
new file mode 100644
index 000000000..ca1b9f366
--- /dev/null
+++ b/app/views/companies/_company.html.slim
@@ -0,0 +1,16 @@
+#index_item.company.panel.panel-default
+ .panel-heading
+ .panel-title.clearfix
+ span.pull-right
+ = link_to edit_referential_company_path(@referential, company), class: 'btn btn-default btn-sm' do
+ span.fa.fa-pencil
+ = link_to referential_company_path(@referential, company), :method => :delete, :data => {:confirm => t('companies.actions.destroy_confirm')}, class: 'btn btn-danger btn-sm' do
+ span.fa.fa-trash-o
+ h5
+ = link_to [@referential, company], class: 'preview', title: "#{Chouette::Company.model_name.human.capitalize} #{company.name}" do
+ span.name
+ = truncate(company.name, length: 20)
+ .panel-body
+ p
+ = company.human_attribute_name('code')
+ = company.code
diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb
deleted file mode 100644
index ee3f9db25..000000000
--- a/app/views/companies/_form.erb
+++ /dev/null
@@ -1,21 +0,0 @@
-<%= semantic_form_for [@referential, @company] do |form| %>
- <%= form.inputs do %>
- <%= form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.name") } %>
- <%= form.input :short_name %>
- <%= form.input :organizational_unit %>
- <%= form.input :operating_department_name %>
- <%= form.input :code %>
- <%= form.input :phone, :as => :phone %>
- <%= form.input :fax, :as => :phone %>
- <%= form.input :email, :as => :email %>
- <%= form.input :time_zone, :include_blank => true %>
- <%= form.input :url %>
- <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.registration_number")} %>
- <%= form.input :objectid, :required => !@company.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.objectid")} %>
- <% end %>
-
- <%= form.actions do %>
- <%= form.action :submit, :as => :button %>
- <%= form.action :cancel, :as => :link %>
- <% end %>
-<% end %>
diff --git a/app/views/companies/_form.html.slim b/app/views/companies/_form.html.slim
new file mode 100644
index 000000000..3f8663949
--- /dev/null
+++ b/app/views/companies/_form.html.slim
@@ -0,0 +1,18 @@
+= semantic_form_for [@referential, @company] do |form|
+ = form.inputs do
+ = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.name") }
+ = form.input :short_name
+ = form.input :organizational_unit
+ = form.input :operating_department_name
+ = form.input :code
+ = form.input :phone, as: :phone
+ = form.input :fax, as: :phone
+ = form.input :email, as: :email
+ = form.input :time_zone, include_blank: true
+ = form.input :url
+ = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.registration_number") }
+ = form.input :objectid, :required => !@company.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.objectid") }
+
+ = form.actions do
+ = form.action :submit, as: :button
+ = form.action :cancel, as: :link \ No newline at end of file
diff --git a/app/views/companies/edit.html.erb b/app/views/companies/edit.html.erb
deleted file mode 100644
index 797509787..000000000
--- a/app/views/companies/edit.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= title_tag t('companies.edit.title', :company => @company.name) %>
-
-<%= render "form" %>
diff --git a/app/views/companies/edit.html.slim b/app/views/companies/edit.html.slim
new file mode 100644
index 000000000..6c415edfb
--- /dev/null
+++ b/app/views/companies/edit.html.slim
@@ -0,0 +1,2 @@
+= title_tag t('companies.edit.title', company: @company.name)
+= render 'form' \ No newline at end of file
diff --git a/app/views/companies/index.html.erb b/app/views/companies/index.html.erb
deleted file mode 100644
index ec6ffbeb2..000000000
--- a/app/views/companies/index.html.erb
+++ /dev/null
@@ -1,26 +0,0 @@
-<%= title_tag t('companies.index.title') %>
-
-<%= search_form_for @q, :url => referential_companies_path(@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="companies"><%= render partial: "companies", object: @companies %></div>
-
-<% content_for :sidebar do %>
-<ul class="actions">
- <li><%= link_to t('companies.actions.new'), new_referential_company_path(@referential), :class => "add" %></li>
- <br>
-</ul>
-<% end %>
diff --git a/app/views/companies/index.html.slim b/app/views/companies/index.html.slim
new file mode 100644
index 000000000..711b88607
--- /dev/null
+++ b/app/views/companies/index.html.slim
@@ -0,0 +1,25 @@
+= title_tag t('companies.index.title')
+
+= search_form_for @q, :url => referential_companies_path(@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> -->
+
+#companies
+ = render partial: 'companies', object: @companies
+
+- content_for :sidebar do
+ ul.actions
+ li
+ = link_to t('companies.actions.new'), new_referential_company_path(@referential), class: 'add'
+ br \ No newline at end of file
diff --git a/app/views/companies/index.js.erb b/app/views/companies/index.js.erb
deleted file mode 100644
index 3afe2b9c5..000000000
--- a/app/views/companies/index.js.erb
+++ /dev/null
@@ -1 +0,0 @@
-$('#companies').html('<%= escape_javascript(render("companies")) %>'); \ No newline at end of file
diff --git a/app/views/companies/index.js.slim b/app/views/companies/index.js.slim
new file mode 100644
index 000000000..308b71da6
--- /dev/null
+++ b/app/views/companies/index.js.slim
@@ -0,0 +1 @@
+$('#companies').html("= escape_javascript(render('companies'))"); \ No newline at end of file
diff --git a/app/views/companies/new.html.erb b/app/views/companies/new.html.erb
deleted file mode 100644
index a1332ff3a..000000000
--- a/app/views/companies/new.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= title_tag t('companies.new.title') %>
-
-<%= render "form" %>
diff --git a/app/views/companies/new.html.slim b/app/views/companies/new.html.slim
new file mode 100644
index 000000000..1acb1786f
--- /dev/null
+++ b/app/views/companies/new.html.slim
@@ -0,0 +1,2 @@
+= title_tag t('companies.new.title')
+= render 'form' \ No newline at end of file
diff --git a/app/views/companies/show.html.erb b/app/views/companies/show.html.erb
deleted file mode 100644
index 513b0364e..000000000
--- a/app/views/companies/show.html.erb
+++ /dev/null
@@ -1,57 +0,0 @@
-<%= title_tag t('companies.show.title', :company => @company.name) %>
-
-<div class="company_show">
-
- <div class="summary">
- <p>
- <label><%= Chouette::Company.human_attribute_name("short_name") %>: </label>
- <%= @company.short_name %>
- </p>
- <p>
- <label><%= Chouette::Company.human_attribute_name("organizational_unit") %>: </label>
- <%= @company.organizational_unit %>
- </p>
- <p>
- <label><%= Chouette::Company.human_attribute_name("operating_department_name") %>: </label>
- <%= @company.operating_department_name %>
- </p>
- <p>
- <label><%= Chouette::Company.human_attribute_name("code") %>: </label>
- <%= @company.code %>
- </p>
- <p>
- <label><%= Chouette::Company.human_attribute_name("phone") %>: </label>
- <%= @company.phone %>
- </p>
- <p>
- <label><%= Chouette::Company.human_attribute_name("fax") %>: </label>
- <%= @company.fax %>
- </p>
- <p>
- <label><%= Chouette::Company.human_attribute_name("email") %>: </label>
- <%= @company.email %>
- </p>
- <p>
- <label><%= Chouette::Company.human_attribute_name("time_zone") %>: </label>
- <%= @company.time_zone %>
- </p>
- <p>
- <label><%= Chouette::Company.human_attribute_name("url") %>: </label>
- <%= @company.url %>
- </p>
- <p>
- <label><%= Chouette::Company.human_attribute_name("registration_number") %>: </label>
- <%= @company.registration_number %>
- </p>
- </div>
-</div>
-
-<% content_for :sidebar do %>
-<ul class="actions">
- <li><%= link_to t('companies.actions.new'), new_referential_company_path(@referential), :class => "add" %></li>
- <li><%= link_to t('companies.actions.edit'), edit_referential_company_path(@referential, @company), :class => "edit" %></li>
- <li><%= link_to t('companies.actions.destroy'), referential_company_path(@referential, @company), :method => :delete, :data => {:confirm => t('companies.actions.destroy_confirm')}, :class => "remove" %></li>
- <br>
-</ul>
- <%= creation_tag(@company) %>
-<% end %>
diff --git a/app/views/companies/show.html.slim b/app/views/companies/show.html.slim
new file mode 100644
index 000000000..a445dad61
--- /dev/null
+++ b/app/views/companies/show.html.slim
@@ -0,0 +1,55 @@
+= title_tag t('companies.show.title', company: @company.name)
+
+.company_show
+ .summary
+ p
+ label = "#{Chouette::Company.human_attribute_name('short_name')} : "
+ = @company.short_name
+
+ p
+ label = "#{Chouette::Company.human_attribute_name('organizational_unit')} : "
+ = @company.organizational_unit
+
+ p
+ label = "#{Chouette::Company.human_attribute_name('operating_department_name')} : "
+ = @company.operating_department_name
+
+ p
+ label = "#{Chouette::Company.human_attribute_name('code')} : "
+ = @company.code
+
+ p
+ label = "#{Chouette::Company.human_attribute_name('phone')} : "
+ = @company.phone
+
+ p
+ label = "#{Chouette::Company.human_attribute_name('fax')} : "
+ = @company.fax
+
+ p
+ label = "#{Chouette::Company.human_attribute_name('email')} : "
+ = @company.email
+
+ p
+ label = "#{Chouette::Company.human_attribute_name('time_zone')} : "
+ = @company.time_zone
+
+ p
+ label = "#{Chouette::Company.human_attribute_name('url')} : "
+ = @company.url
+
+ p
+ label = "#{Chouette::Company.human_attribute_name('registration_number')} : "
+ = @company.registration_number
+
+- content_for :sidebar do
+ ul.actions
+ li
+ = link_to t('companies.actions.new'), new_referential_company_path(@referential), class: 'add'
+ li
+ = link_to t('companies.actions.edit'), edit_referential_company_path(@referential, @company), class: 'edit'
+ li
+ = link_to t('companies.actions.destroy'), referential_company_path(@referential, @company), :method => :delete, :data => {:confirm => t('companies.actions.destroy_confirm')}, class: 'remove'
+ br
+
+ = creation_tag(@company) \ No newline at end of file