Implemented +/- buttons for episode count (closes #72)
This commit is contained in:
parent
abfad585e8
commit
e8aed98b3c
@ -18,9 +18,9 @@ component InputNumberWithButtons(id string, value float64, label string, placeho
|
||||
label(for=id)= label + ":"
|
||||
.number-input-container
|
||||
input.widget-ui-element.action(id=id, data-field=id, type="number", value=value, min=min, max=max, step=step, placeholder=placeholder, title=placeholder, data-action="save", data-trigger="change")
|
||||
button
|
||||
button.action(data-action="addNumber", data-trigger="click", data-id=id, data-add="1")
|
||||
RawIcon("plus")
|
||||
button
|
||||
button.action(data-action="addNumber", data-trigger="click", data-id=id, data-add="-1")
|
||||
RawIcon("minus")
|
||||
|
||||
component InputSelection(id string, value string, label string, placeholder string, options []*arn.Option)
|
||||
|
@ -78,3 +78,16 @@ export function increaseEpisode(arn: AnimeNotifier, element: HTMLElement) {
|
||||
prev.innerText = String(episodes + 1)
|
||||
save(arn, prev)
|
||||
}
|
||||
|
||||
// Add number
|
||||
export function addNumber(arn: AnimeNotifier, element: HTMLElement) {
|
||||
if(arn.isLoading) {
|
||||
return
|
||||
}
|
||||
|
||||
let input = arn.app.find(element.dataset.id) as HTMLInputElement
|
||||
let add = parseInt(element.dataset.add)
|
||||
let num = parseInt(input.value)
|
||||
input.value = (num + add).toString()
|
||||
save(arn, input)
|
||||
}
|
Loading…
Reference in New Issue
Block a user