aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorjpl2017-02-08 10:27:01 +0100
committerjpl2017-02-08 10:27:01 +0100
commit0c87977f1fba112bdd1082de8be6fde778fb53bd (patch)
tree01bbe326934cf3b77b6336646d4f4ac55cdbf983 /app/helpers
parentde3e71567767e5fcb1de55ef852ea19454d230f7 (diff)
downloadchouette-core-0c87977f1fba112bdd1082de8be6fde778fb53bd.tar.bz2
Refs #2535: adding selection behav. for table toolbox
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/newapplication_helper.rb24
1 files changed, 16 insertions, 8 deletions
diff --git a/app/helpers/newapplication_helper.rb b/app/helpers/newapplication_helper.rb
index 88aae9432..9b743b929 100644
--- a/app/helpers/newapplication_helper.rb
+++ b/app/helpers/newapplication_helper.rb
@@ -1,14 +1,14 @@
module NewapplicationHelper
# Table Builder
- def table_builder collection, columns, actions, selectable, 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'
+ unless selectable.empty?
cbx = content_tag :div, '', class: 'checkbox' do
check_box_tag('0', 'all').concat(content_tag(:label, '', for: '0'))
end
@@ -29,7 +29,7 @@ module NewapplicationHelper
content_tag :tr do
bcont = []
- if selectable.to_s == 'selectable'
+ unless selectable.empty?
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
@@ -70,7 +70,15 @@ module NewapplicationHelper
end.join.html_safe
end
- content_tag :table, head + body, class: cls
+ if selectable.empty?
+ content_tag :table, head + body, class: cls
+ else
+ content_tag :div, '', class: 'select_table' do
+ table = content_tag :table, head + body, class: cls
+ toolbox = select_toolbox(selectable)
+ table + toolbox
+ end
+ end
end
def links_builder(item, actions)
@@ -150,8 +158,8 @@ module NewapplicationHelper
end
end
- # Actions on select toolbox
- def select_toolbox actions
+ # Actions on select toolbox (for selectables tables)
+ def select_toolbox(actions)
tools = content_tag :ul do
actions.collect do |action|
@@ -167,8 +175,8 @@ module NewapplicationHelper
end.join.html_safe
end
- content_tag :div, '', class: 'select_toolbox' do
- tools.concat(content_tag(:span, "n élément(s) sélectionné(s)", class: 'info-msg'))
+ content_tag :div, '', class: 'select_toolbox noselect' do
+ tools.concat(content_tag(:span, ("<span>0</span> élément(s) sélectionné(s)").html_safe, class: 'info-msg'))
end
end