Added multiple rating categories

This commit is contained in:
Eduard Urbach 2017-06-26 11:43:47 +02:00
parent 3ebce24315
commit 61be2fe055
4 changed files with 24 additions and 7 deletions

View File

@ -8,10 +8,10 @@ component InputTextArea(id string, value string, label string, placeholder strin
label(for=id)= label + ":"
textarea.widget-element.action(id=id, placeholder=placeholder, title=placeholder, data-action="save", data-trigger="change")= value
component InputNumber(id string, value int, label string, placeholder string, min string, max string)
component InputNumber(id string, value float64, label string, placeholder string, min string, max string, step string)
.widget-input
label(for=id)= label + ":"
input.widget-element.action(id=id, type="number", value=value, min=min, max=max, placeholder=placeholder, title=placeholder, data-action="save", data-trigger="change")
input.widget-element.action(id=id, type="number", value=value, min=min, max=max, step=step, placeholder=placeholder, title=placeholder, data-action="save", data-trigger="change")
component InputSelection(id string, value string, label string, placeholder string)
.widget-input

View File

@ -3,9 +3,15 @@ component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.
.widget.anime-list-item-view(data-api="/api/animelist/" + viewUser.ID + "/update/" + anime.ID)
h2= anime.Title.Canonical
InputNumber("Episodes", item.Episodes, "Episodes", "Number of episodes you watched", "0", arn.EpisodeCountMax(anime.EpisodeCount))
InputNumber("Rating.Overall", int(item.Rating.Overall + 0.5), "Overall rating", "Overall rating on a scale of 0 to 10", "0", "10")
InputNumber("RewatchCount", item.RewatchCount, "Rewatched", "How often you rewatched this anime", "0", "100")
InputNumber("Episodes", float64(item.Episodes), "Episodes", "Number of episodes you watched", "0", arn.EpisodeCountMax(anime.EpisodeCount), "1")
.anime-list-item-rating-edit
InputNumber("Rating.Overall", item.Rating.Overall, "Overall", "Overall rating on a scale of 0 to 10", "0", "10", "0.1")
InputNumber("Rating.Story", item.Rating.Story, "Story", "Story rating on a scale of 0 to 10", "0", "10", "0.1")
InputNumber("Rating.Visuals", item.Rating.Visuals, "Visuals", "Visuals rating on a scale of 0 to 10", "0", "10", "0.1")
InputNumber("Rating.Soundtrack", item.Rating.Soundtrack, "Soundtrack", "Soundtrack rating on a scale of 0 to 10", "0", "10", "0.1")
InputNumber("RewatchCount", float64(item.RewatchCount), "Rewatched", "How often you rewatched this anime", "0", "100", "1")
InputTextArea("Notes", item.Notes, "Notes", "Your notes")

View File

@ -4,4 +4,11 @@
.anime-list-item-view-image
max-width 55px
margin-bottom 1rem
margin-bottom 1rem
.anime-list-item-rating-edit
horizontal-wrap
justify-content space-between
width 100%
.widget-input
max-width 120px

View File

@ -11,7 +11,11 @@ export function save(arn: AnimeNotifier, input: HTMLInputElement | HTMLTextAreaE
let value = input.value
if(input.type === "number") {
obj[input.id] = parseInt(value)
if(input.getAttribute("step") === "1") {
obj[input.id] = parseInt(value)
} else {
obj[input.id] = parseFloat(value)
}
} else {
obj[input.id] = value
}