From 95fa82c2df44f6ef00115c92b2a0e60b9340fc4f Mon Sep 17 00:00:00 2001 From: Aria <aria@suma-ev.de> Date: Thu, 8 Mar 2018 10:20:16 +0100 Subject: [PATCH] Alle aufklappen/zuklappen funktioniert --- resources/assets/js/focus-creator.js | 28 +++++++++++++++++-- resources/assets/js/translations.js | 8 ++++-- resources/assets/less/metager/foki.less | 13 ++++++--- .../views/modals/create-focus-modal.blade.php | 4 +-- 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/resources/assets/js/focus-creator.js b/resources/assets/js/focus-creator.js index 776e0797b..a6ec7d8e8 100644 --- a/resources/assets/js/focus-creator.js +++ b/resources/assets/js/focus-creator.js @@ -1,11 +1,13 @@ $(function () { - setFocusCreatorActionListeners(); + setLabelText(); + setKeyListeners(); + setDropdownListener(); }); /** * Sets all action listeners for this page */ -function setFocusCreatorActionListeners () { +function setKeyListeners () { $(document).keydown(function(event) { if ($("input#show-create-focus").is(':checked')) { if (event.keyCode == 27) { @@ -17,3 +19,25 @@ function setFocusCreatorActionListeners () { }); } +function setDropdownListener() { + $('input:checkbox#toggle-dropdowns').change( + function() { + if($(this).is(':checked')) { + $("#toggle-dropdowns-label").html(t('close-dropdowns')); + $(".focus-dropdown-toggle").prop('checked', true); + } else { + $("#toggle-dropdowns-label").html(t('open-dropdowns')); + $(".focus-dropdown-toggle").prop('checked', false); + } + } + ) +} + +function setLabelText() { + if($('input:checkbox#toggle-dropdowns').is(':checked')) { + $("#toggle-dropdowns-label").html(t('close-dropdowns')); + } else { + $("#toggle-dropdowns-label").html(t('open-dropdowns')); + } +} + diff --git a/resources/assets/js/translations.js b/resources/assets/js/translations.js index ec535a423..1d6ce9a98 100644 --- a/resources/assets/js/translations.js +++ b/resources/assets/js/translations.js @@ -21,7 +21,9 @@ var translations = { 'result-saver.deleteAll': '<span class="hidden-xs">Ergebnisse</span> löschen</button>', 'result-saver.save.this': 'ÖFFNEN', 'result-saver.save.newtab': 'IN NEUEM TAB', - 'result-saver.save.anonymous': 'ANONYM ÖFFNEN' + 'result-saver.save.anonymous': 'ANONYM ÖFFNEN', + 'close-dropdowns' : 'Alle zuklappen', + 'open-dropdowns' : 'Alle aufklappen' }, 'en': { @@ -39,7 +41,9 @@ var translations = { 'result-saver.deleteAll': 'delete <span class="hidden-xs">results</span>', 'result-saver.save.this': 'OPEN', 'result-saver.save.newtab': 'IN NEW TAB', - 'result-saver.save.anonymous': 'OPEN ANONYMOUSLY' + 'result-saver.save.anonymous': 'OPEN ANONYMOUSLY', + 'close-dropdowns' : 'Collapse all', + 'open-dropdowns' : 'Expand all' }, 'es': { diff --git a/resources/assets/less/metager/foki.less b/resources/assets/less/metager/foki.less index 0b0efc584..2c7de77a7 100644 --- a/resources/assets/less/metager/foki.less +++ b/resources/assets/less/metager/foki.less @@ -39,8 +39,12 @@ } } } - #toggle-dropdowns { - + #toggle-dropdowns-label { + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } .focus-dropdown-toggle { display: none; @@ -52,14 +56,15 @@ } &:checked { &~.focus-dropdown-label::after { - content: "🡡"; + content: " ➖ "; } } } .focus-dropdown-label { + cursor: pointer; &::after { font-size: 16px; - content: "🡣"; + content: " ➕ "; margin-left: 3px; } &~.row { diff --git a/resources/views/modals/create-focus-modal.blade.php b/resources/views/modals/create-focus-modal.blade.php index 0795ea2ed..7a355a372 100644 --- a/resources/views/modals/create-focus-modal.blade.php +++ b/resources/views/modals/create-focus-modal.blade.php @@ -17,8 +17,8 @@ </div> </div> <div class="modal-body"> - <input type="hidden" id="toggle-dropdowns"> - <label for="toggle=dropdowns" class="js-only"></label> + <input type="checkbox" class="hidden" id="toggle-dropdowns" checked> + <label id="toggle-dropdowns-label" for="toggle-dropdowns" class="js-only"></label> <form id="customSearchForm" method="GET" action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3 ") }}" accept-charset="UTF-8"> <input type="hidden" name="eingabe" value="@if(isset($eingabe)){{$eingabe}}@endif"> <input type="hidden" name="encoding" value="utf8"> -- GitLab