diff options
| author | jpl | 2016-10-14 10:55:26 +0200 | 
|---|---|---|
| committer | jpl | 2016-10-14 10:55:44 +0200 | 
| commit | 1812df89490c2a8833eb768478fa333c4fd9c257 (patch) | |
| tree | 1abc18f6424800dc1214086f32812ad543659eea | |
| parent | 504a817e97f067bb9399d775402d228e26246071 (diff) | |
| download | chouette-core-1812df89490c2a8833eb768478fa333c4fd9c257.tar.bz2 | |
updating table builder on companies
| -rw-r--r-- | app/controllers/companies_controller.rb | 1 | ||||
| -rw-r--r-- | app/helpers/refobjects_helper.rb | 4 | ||||
| -rw-r--r-- | app/views/companies/_companies.html.slim | 10 | ||||
| -rw-r--r-- | app/views/companies/index.html.slim | 2 | ||||
| -rw-r--r-- | spec/views/companies/index.html.erb_spec.rb | 2 | 
5 files changed, 10 insertions, 9 deletions
| diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index 78b9f43a0..842398552 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -35,6 +35,7 @@ class CompaniesController < BreadcrumbController    def collection      @q = line_referential.companies.search(params[:q])      @companies ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page]) +    @decoratedcompanies = CompanyDecorator.decorate_collection(@companies)    end diff --git a/app/helpers/refobjects_helper.rb b/app/helpers/refobjects_helper.rb index 8dbc2bc07..f7ebb65ea 100644 --- a/app/helpers/refobjects_helper.rb +++ b/app/helpers/refobjects_helper.rb @@ -6,7 +6,7 @@ module RefobjectsHelper      head = content_tag :thead do        content_tag :tr do          columns.each do |col| -          concat content_tag(:th, collection.first.respond_to?(col) ? col.to_s.titleize : "Doesn't exist") +          concat content_tag :th, col.to_s.titleize          end          concat content_tag :th, "Actions" if actions.any?        end @@ -32,7 +32,7 @@ module RefobjectsHelper      actions.each do |action|        if action == "show" -        showlink = link_to({controller: params[:controller], action: action, id: item.id}, class: 'btn btn-default') do +        showlink = link_to({controller: params[:controller], action: action, id: item}, class: 'btn btn-default') do            content_tag :span, "", class: 'fa fa-eye'          end          link << showlink diff --git a/app/views/companies/_companies.html.slim b/app/views/companies/_companies.html.slim index 187ff4d0d..4f89e8ede 100644 --- a/app/views/companies/_companies.html.slim +++ b/app/views/companies/_companies.html.slim @@ -1,11 +1,11 @@ -.page_info -  span.search = t('will_paginate.page_entries_info.search') -  = page_entries_info @companies +/ .page_info +/   span.search = t('will_paginate.page_entries_info.search') +/   = page_entries_info @companies  .companies.paginated_content style="margin-top:20px;" -  = table_builder CompanyDecorator.decorate_collection(@companies), +  = table_builder @decoratedcompanies,                    [:name, :edited_at, :published_at, :validity_period, :linecount, :transporter, :status], -                  ["show"], +                  ["show", "delete"],                    'table table-bordered'  .pagination diff --git a/app/views/companies/index.html.slim b/app/views/companies/index.html.slim index 1b616a6c8..0c69079f8 100644 --- a/app/views/companies/index.html.slim +++ b/app/views/companies/index.html.slim @@ -16,7 +16,7 @@        / <!-- </a> -->  #companies -  = render partial: 'companies', object: @companies +  = render partial: 'companies'  - content_for :sidebar do    ul.actions diff --git a/spec/views/companies/index.html.erb_spec.rb b/spec/views/companies/index.html.erb_spec.rb index 5bb528744..6f244064d 100644 --- a/spec/views/companies/index.html.erb_spec.rb +++ b/spec/views/companies/index.html.erb_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper'  describe "/companies/index", :type => :view do    let!(:line_referential) { assign :line_referential, create(:line_referential) } -  let!(:companies) { assign :companies, Array.new(2) { create(:company, line_referential: line_referential) }.paginate  } +  let!(:companies) { assign :companies, CompanyDecorator.decorate_collection(Array.new(2) { create(:company, line_referential: line_referential) }.paginate) }    let!(:search) { assign :q, Ransack::Search.new(Chouette::Company) }    # Fixme #1795 | 
