Implemented +/- buttons for episode count (closes #72)
This commit is contained in:
@ -18,9 +18,9 @@ component InputNumberWithButtons(id string, value float64, label string, placeho
|
|||||||
label(for=id)= label + ":"
|
label(for=id)= label + ":"
|
||||||
.number-input-container
|
.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")
|
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")
|
RawIcon("plus")
|
||||||
button
|
button.action(data-action="addNumber", data-trigger="click", data-id=id, data-add="-1")
|
||||||
RawIcon("minus")
|
RawIcon("minus")
|
||||||
|
|
||||||
component InputSelection(id string, value string, label string, placeholder string, options []*arn.Option)
|
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)
|
prev.innerText = String(episodes + 1)
|
||||||
save(arn, prev)
|
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)
|
||||||
|
}
|
Reference in New Issue
Block a user