Let button_with_confirm inherit original CSS when not specified.
This commit is contained in:
parent
b6f4874b66
commit
7609f20dd0
5 changed files with 12 additions and 10 deletions
|
@ -195,7 +195,9 @@ function init_button_with_confirm()
|
||||||
|
|
||||||
data-confirm: Text inside the confirm button. Default is to inherit the
|
data-confirm: Text inside the confirm button. Default is to inherit the
|
||||||
original button's text.
|
original button's text.
|
||||||
data-confirm-class
|
data-confirm-class: CSS class for the confirm button. Default is to
|
||||||
|
inheret all classes of the original button, except for
|
||||||
|
"button_with_confirm" of course.
|
||||||
|
|
||||||
data-cancel: Text inside the cancel button. Default is "Cancel".
|
data-cancel: Text inside the cancel button. Default is "Cancel".
|
||||||
data-cancel-class
|
data-cancel-class
|
||||||
|
@ -244,7 +246,15 @@ function init_button_with_confirm()
|
||||||
|
|
||||||
var button_confirm = document.createElement("button");
|
var button_confirm = document.createElement("button");
|
||||||
button_confirm.innerText = (button.dataset.confirm || button.innerText).trim();
|
button_confirm.innerText = (button.dataset.confirm || button.innerText).trim();
|
||||||
button_confirm.className = button.dataset.confirmClass || "";
|
if (button.dataset.confirmClass === undefined)
|
||||||
|
{
|
||||||
|
button_confirm.className = button.className;
|
||||||
|
button_confirm.classList.remove("button_with_confirm");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
button_confirm.className = button.dataset.confirmClass;
|
||||||
|
}
|
||||||
button_confirm.input_source = input_source;
|
button_confirm.input_source = input_source;
|
||||||
holder_stage2.appendChild(button_confirm);
|
holder_stage2.appendChild(button_confirm);
|
||||||
holder_stage2.appendChild(document.createTextNode(" "));
|
holder_stage2.appendChild(document.createTextNode(" "));
|
||||||
|
|
|
@ -127,7 +127,6 @@ h2, h3
|
||||||
class="green_button button_with_confirm"
|
class="green_button button_with_confirm"
|
||||||
data-is-input="1"
|
data-is-input="1"
|
||||||
data-prompt="Album title"
|
data-prompt="Album title"
|
||||||
data-confirm-class="green_button"
|
|
||||||
data-cancel-class="gray_button"
|
data-cancel-class="gray_button"
|
||||||
data-onclick="create_child(event.target.input_source.value);"
|
data-onclick="create_child(event.target.input_source.value);"
|
||||||
>
|
>
|
||||||
|
@ -181,7 +180,6 @@ ALBUM_ID = undefined;
|
||||||
class="red_button button_with_confirm"
|
class="red_button button_with_confirm"
|
||||||
data-onclick="api.albums.delete(ALBUM_ID, api.albums.callback_go_to_albums)"
|
data-onclick="api.albums.delete(ALBUM_ID, api.albums.callback_go_to_albums)"
|
||||||
data-prompt="Delete Album?"
|
data-prompt="Delete Album?"
|
||||||
data-confirm-class="red_button"
|
|
||||||
data-cancel-class="gray_button"
|
data-cancel-class="gray_button"
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
|
@ -191,7 +189,6 @@ ALBUM_ID = undefined;
|
||||||
class="green_button button_with_confirm"
|
class="green_button button_with_confirm"
|
||||||
data-is-input="1"
|
data-is-input="1"
|
||||||
data-prompt="Album title"
|
data-prompt="Album title"
|
||||||
data-confirm-class="green_button"
|
|
||||||
data-cancel-class="gray_button"
|
data-cancel-class="gray_button"
|
||||||
data-onclick="create_child(event.target.input_source.value);"
|
data-onclick="create_child(event.target.input_source.value);"
|
||||||
>
|
>
|
||||||
|
@ -202,7 +199,6 @@ ALBUM_ID = undefined;
|
||||||
class="green_button button_with_confirm"
|
class="green_button button_with_confirm"
|
||||||
data-is-input="1"
|
data-is-input="1"
|
||||||
data-prompt="Child ID"
|
data-prompt="Child ID"
|
||||||
data-confirm-class="green_button"
|
|
||||||
data-cancel-class="gray_button"
|
data-cancel-class="gray_button"
|
||||||
data-onclick="add_child(event.target.input_source.value);"
|
data-onclick="add_child(event.target.input_source.value);"
|
||||||
>
|
>
|
||||||
|
|
|
@ -79,7 +79,6 @@
|
||||||
class="red_button button_with_confirm"
|
class="red_button button_with_confirm"
|
||||||
data-onclick="api.bookmarks.delete('{{bookmark.id}}', common.refresh)"
|
data-onclick="api.bookmarks.delete('{{bookmark.id}}', common.refresh)"
|
||||||
data-prompt="Delete Bookmark?"
|
data-prompt="Delete Bookmark?"
|
||||||
data-confirm-class="red_button"
|
|
||||||
data-cancel-class="gray_button"
|
data-cancel-class="gray_button"
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
|
|
|
@ -250,7 +250,6 @@
|
||||||
class="red_button button_with_confirm"
|
class="red_button button_with_confirm"
|
||||||
data-onclick="api.photos.delete(PHOTO_ID, false, api.photos.callback_go_to_search)"
|
data-onclick="api.photos.delete(PHOTO_ID, false, api.photos.callback_go_to_search)"
|
||||||
data-prompt="Delete photo, keep file?"
|
data-prompt="Delete photo, keep file?"
|
||||||
data-confirm-class="red_button"
|
|
||||||
data-cancel-class="gray_button"
|
data-cancel-class="gray_button"
|
||||||
>
|
>
|
||||||
Remove
|
Remove
|
||||||
|
@ -260,7 +259,6 @@
|
||||||
class="red_button button_with_confirm"
|
class="red_button button_with_confirm"
|
||||||
data-onclick="api.photos.delete(PHOTO_ID, true, api.photos.callback_go_to_search)"
|
data-onclick="api.photos.delete(PHOTO_ID, true, api.photos.callback_go_to_search)"
|
||||||
data-prompt="Delete file on disk?"
|
data-prompt="Delete file on disk?"
|
||||||
data-confirm-class="red_button"
|
|
||||||
data-cancel-class="gray_button"
|
data-cancel-class="gray_button"
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
|
|
|
@ -132,7 +132,6 @@ h2, h3
|
||||||
data-onclick="api.tags.delete('{{specific_tag.name}}', api.tags.callback_go_to_tags);"
|
data-onclick="api.tags.delete('{{specific_tag.name}}', api.tags.callback_go_to_tags);"
|
||||||
data-prompt="Delete Tag?"
|
data-prompt="Delete Tag?"
|
||||||
data-confirm="Delete"
|
data-confirm="Delete"
|
||||||
data-confirm-class="red_button"
|
|
||||||
data-cancel-class="gray_button"
|
data-cancel-class="gray_button"
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
|
|
Loading…
Reference in a new issue