diff options
| author | jpl | 2017-02-06 18:13:30 +0100 | 
|---|---|---|
| committer | jpl | 2017-02-06 18:13:30 +0100 | 
| commit | 045650481048cf957a0ef83ed9092a94bc20c904 (patch) | |
| tree | 8154750b818bdb01868316e86f7fd8fa812bf75f /app/helpers | |
| parent | 3567bbf39d65d55c3e49b647bac4bf4b5cbb6fc3 (diff) | |
| download | chouette-core-045650481048cf957a0ef83ed9092a94bc20c904.tar.bz2 | |
Refs #2535: adding selectable feat. to table builder
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/newapplication_helper.rb | 18 | 
1 files changed, 17 insertions, 1 deletions
| diff --git a/app/helpers/newapplication_helper.rb b/app/helpers/newapplication_helper.rb index a9bd11d11..70b16ce01 100644 --- a/app/helpers/newapplication_helper.rb +++ b/app/helpers/newapplication_helper.rb @@ -1,12 +1,20 @@  module NewapplicationHelper    # Table Builder -  def table_builder collection, columns, actions, cls = nil +  def table_builder collection, columns, actions, selectable, cls = nil      return unless collection.present?      head = content_tag :thead do        content_tag :tr do          hcont = [] + +        if selectable.to_s == 'selectable' +          cbx = content_tag :div, '', class: 'checkbox' do +            check_box_tag('0', 'all').concat(content_tag(:label, '', for: '0')) +          end +          hcont << content_tag(:th, cbx) +        end +          columns.map do |k, v|            hcont << content_tag(:th, sortable_columns(collection, k))          end @@ -20,6 +28,14 @@ module NewapplicationHelper        collection.collect do |item|          content_tag :tr do            bcont = [] + +          if selectable.to_s == 'selectable' +            cbx = content_tag :div, '', class: 'checkbox' do +              check_box_tag(item.try(:id), item.try(:id)).concat(content_tag(:label, '', for: item.try(:id))) +            end +            bcont << content_tag(:td, cbx) +          end +            columns.map do |k, attribute|              value =                if Proc === attribute | 
