-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split up base.js into seperate modules
Create a javascript file for each function. They are not related to each other.
- Loading branch information
1 parent
c946772
commit 3ec1b2c
Showing
5 changed files
with
68 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Multiple picture select handler for the picture archive. | ||
*/ | ||
export default function PictureSelector() { | ||
const $selected_item_tools = $(".selected_item_tools") | ||
const $picture_selects = $(".picture_tool.select input") | ||
|
||
$picture_selects.on("change", function () { | ||
if ($picture_selects.filter(":checked").size() > 0) { | ||
$selected_item_tools.show() | ||
} else { | ||
$selected_item_tools.hide() | ||
} | ||
|
||
if (this.checked) { | ||
$(this).parent().addClass("visible").removeClass("hidden") | ||
} else { | ||
$(this).parent().removeClass("visible").addClass("hidden") | ||
} | ||
}) | ||
|
||
$("a#edit_multiple_pictures").on("click", function (e) { | ||
const $this = $(this) | ||
const picture_ids = $("input:checkbox", "#picture_archive").serialize() | ||
const url = $this.attr("href") + "?" + picture_ids | ||
|
||
Alchemy.openDialog(url, { | ||
title: $this.attr("title"), | ||
size: "400x295" | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* To show the "Please wait" overlay. | ||
* Pass false to hide it. | ||
* @param {boolean,null} show | ||
*/ | ||
export default function pleaseWaitOverlay(show) { | ||
if (show == null) { | ||
show = true | ||
} | ||
const $overlay = $("#overlay") | ||
if (show) { | ||
const spinner = new Alchemy.Spinner("medium") | ||
spinner.spin($overlay) | ||
$overlay.show() | ||
} else { | ||
$overlay.find(".spinner").remove() | ||
$overlay.hide() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Initializes all select tag with .alchemy_selectbox class as select2 instance | ||
* Pass a jQuery scope to only init a subset of selectboxes. | ||
* @param scope | ||
*/ | ||
export default function SelectBox(scope) { | ||
$("select.alchemy_selectbox", scope).select2({ | ||
minimumResultsForSearch: 7, | ||
dropdownAutoWidth: true | ||
}) | ||
} |