From 79880fd4bfc5a67fb8ade5e32e0b6af14628dee9 Mon Sep 17 00:00:00 2001 From: cookie Date: Fri, 24 Jan 2020 17:12:32 +0800 Subject: [PATCH 1/4] Fix indentation --- .../gallery/templates/components/toolbar.html | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/fotogalleri/gallery/templates/components/toolbar.html b/fotogalleri/gallery/templates/components/toolbar.html index 58eabf3..0e2bebb 100644 --- a/fotogalleri/gallery/templates/components/toolbar.html +++ b/fotogalleri/gallery/templates/components/toolbar.html @@ -12,33 +12,32 @@
- Adminverktyg
-
- {% include 'components/image_upload_form.html' %} -
- {% include 'components/styled_button.html' with button_text="Upload" style="admin" sizes="is-size-6" only %} +
+ {% include 'components/image_upload_form.html' %} +
+ {% include 'components/styled_button.html' with button_text="Upload" style="admin" sizes="is-size-6" only %} +
+ + {% with 'create-path' as modal_id %} +
+ {% include 'components/styled_button.html' with button_text="New folder" style="admin" sizes="is-size-6" only %}
- {% with 'create-path' as modal_id %} -
- {% include 'components/styled_button.html' with button_text="New folder" style="admin" sizes="is-size-6" only %} -
+ {% include "modals/create_path.html" with modalname=modal_id only %} + {% endwith %} - {% include "modals/create_path.html" with modalname=modal_id only %} - {% endwith %} +
+ {% include 'components/styled_button.html' with button_text="Select & Delete" style="admin" sizes="is-size-6" only %} +
-
- {% include 'components/styled_button.html' with button_text="Select & Delete" style="admin" sizes="is-size-6" only %} -
-
- {% include 'components/styled_button.html' with button_text="DELETE" style="secondary" sizes="is-size-6" only %} -
- +
+ {% include 'components/styled_button.html' with button_text="DELETE" style="secondary" sizes="is-size-6" only %} +
{% endif %} From 6b7edce35f174f4aced62278134e12437a015664 Mon Sep 17 00:00:00 2001 From: cookie Date: Fri, 24 Jan 2020 17:13:01 +0800 Subject: [PATCH 2/4] Add select all button to admin toolbar --- fotogalleri/gallery/static/css/components/toolbar.css | 4 ++++ fotogalleri/gallery/templates/components/toolbar.html | 3 +++ 2 files changed, 7 insertions(+) diff --git a/fotogalleri/gallery/static/css/components/toolbar.css b/fotogalleri/gallery/static/css/components/toolbar.css index 2097e36..594df00 100644 --- a/fotogalleri/gallery/static/css/components/toolbar.css +++ b/fotogalleri/gallery/static/css/components/toolbar.css @@ -13,6 +13,10 @@ font-weight: 600; } +#select-all-objects-button { + display: none; +} + #delete-button { display: none; } diff --git a/fotogalleri/gallery/templates/components/toolbar.html b/fotogalleri/gallery/templates/components/toolbar.html index 0e2bebb..444fb0f 100644 --- a/fotogalleri/gallery/templates/components/toolbar.html +++ b/fotogalleri/gallery/templates/components/toolbar.html @@ -34,6 +34,9 @@ {% include 'components/styled_button.html' with button_text="Select & Delete" style="admin" sizes="is-size-6" only %}
+
+ {% include 'components/styled_button.html' with button_text="Select all" style="secondary" sizes="is-size-6" only %} +
{% include 'components/styled_button.html' with button_text="DELETE" style="secondary" sizes="is-size-6" only %} From 960bfd1b14c7053d5f114d969b98faecbffef0a3 Mon Sep 17 00:00:00 2001 From: cookie Date: Fri, 24 Jan 2020 17:13:14 +0800 Subject: [PATCH 3/4] Add functionality for select all button --- .../gallery/static/javascript/select.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/fotogalleri/gallery/static/javascript/select.js b/fotogalleri/gallery/static/javascript/select.js index c6010e5..6db6c8e 100644 --- a/fotogalleri/gallery/static/javascript/select.js +++ b/fotogalleri/gallery/static/javascript/select.js @@ -28,10 +28,35 @@ function selectFolderLink(component) { } $(function() { + const selectAllButton = $('#select-all-objects-button'); + selectAllButton.click(function() { + const isPressed = selectAllButton.attr('pressed'); + + $('[selectable="true"]').each(function(index, selectable) { + const classNames = selectable.className.split(' '); + const filteredNames = classNames.filter(function(className) { + return className !== 'selectable'; + }); + + filteredNames.forEach(function() { + const checkbox = $(selectable).children('[type="checkbox"]'); + checkbox.prop('checked', !isPressed); + }); + }); + + selectAllButton.attr('pressed', !!isPressed ? '' : 'true') + selectAllButton.find('button').text( + !!isPressed + ? 'Select all' + : 'Disselect all' + ); + }); + const selectButton = $('#select-objects-button') selectButton.click(function() { const deleteButton = $('#delete-button'); deleteButton.toggle(); + selectAllButton.toggle(); selectButton.find("button").toggleClass("styled-button-admin-selected") $('[selectable="true"]').each(function(index, selectable) { From 1b13b60e01d632a8a13837b1b11fb8e5eb915b02 Mon Sep 17 00:00:00 2001 From: Samuel Rosas Date: Tue, 28 Jan 2020 22:47:10 +0200 Subject: [PATCH 4/4] Fix typo (disselect->deselect) --- fotogalleri/gallery/static/javascript/select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fotogalleri/gallery/static/javascript/select.js b/fotogalleri/gallery/static/javascript/select.js index 6db6c8e..40bc15a 100644 --- a/fotogalleri/gallery/static/javascript/select.js +++ b/fotogalleri/gallery/static/javascript/select.js @@ -48,7 +48,7 @@ $(function() { selectAllButton.find('button').text( !!isPressed ? 'Select all' - : 'Disselect all' + : 'Deselect all' ); });