diff options
| author | jpl | 2017-02-08 10:27:01 +0100 |
|---|---|---|
| committer | jpl | 2017-02-08 10:27:01 +0100 |
| commit | 0c87977f1fba112bdd1082de8be6fde778fb53bd (patch) | |
| tree | 01bbe326934cf3b77b6336646d4f4ac55cdbf983 /app/assets/javascripts | |
| parent | de3e71567767e5fcb1de55ef852ea19454d230f7 (diff) | |
| download | chouette-core-0c87977f1fba112bdd1082de8be6fde778fb53bd.tar.bz2 | |
Refs #2535: adding selection behav. for table toolbox
Diffstat (limited to 'app/assets/javascripts')
| -rw-r--r-- | app/assets/javascripts/selectable_table.coffee | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/app/assets/javascripts/selectable_table.coffee b/app/assets/javascripts/selectable_table.coffee index 84a026d8a..1b4b95c0b 100644 --- a/app/assets/javascripts/selectable_table.coffee +++ b/app/assets/javascripts/selectable_table.coffee @@ -1,6 +1,8 @@ @selectTable = -> - $('.table').each -> + $('.select_table').each -> selection = [] + toolbox = $(this).children('.select_toolbox') + $(this).on 'click', "[type='checkbox']", (e)-> if e.currentTarget.id == '0' selection = [] @@ -26,7 +28,14 @@ elm = selection.indexOf(e.currentTarget.id) selection.splice(elm, 1) - # We log the selection (for now) - console.log selection + # Updating toolbox, according to selection + if selection.length > 0 + toolbox + .removeClass 'noselect' + .children('.info-msg').children('span').text(selection.length) + else + toolbox + .addClass 'noselect' + .children('.info-msg').children('span').text(selection.length) $(document).on 'ready page:load', selectTable |
