Added list item status

This commit is contained in:
Eduard Urbach 2017-06-29 15:55:04 +02:00
parent 7f9d599b50
commit dc4d4ae34c
8 changed files with 33 additions and 10 deletions

View File

@ -13,7 +13,7 @@ component InputNumber(id string, value float64, label string, placeholder string
label(for=id)= label + ":" label(for=id)= label + ":"
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") 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) component InputSelection(id string, value string, label string, placeholder string, values []string)
.widget-input .widget-input
label(for=id)= label + ":" label(for=id)= label + ":"
select.widget-element.action(id=id, value=value, title=placeholder, data-action="save", data-trigger="change") select.widget-element.action(id=id, value=value, title=placeholder, data-action="save", data-trigger="change")

View File

@ -1,7 +1,7 @@
.anime-list .anime-list
vertical vertical
width 100% width 100%
max-width 1100px max-width 1200px
margin 0 auto margin 0 auto
tr tr

View File

@ -5,6 +5,14 @@ component AnimeListItem(viewUser *arn.User, item *arn.AnimeListItem, anime *arn.
InputNumber("Episodes", float64(item.Episodes), "Episodes", "Number of episodes you watched", "0", arn.EpisodeCountMax(anime.EpisodeCount), "1") InputNumber("Episodes", float64(item.Episodes), "Episodes", "Number of episodes you watched", "0", arn.EpisodeCountMax(anime.EpisodeCount), "1")
label(for="Status") Status:
select.widget-element.action(id="Status", value=item.Status, data-action="save", data-trigger="change")
option(value=arn.AnimeListStatusWatching) Watching
option(value=arn.AnimeListStatusCompleted) Completed
option(value=arn.AnimeListStatusPlanned) Plan to watch
option(value=arn.AnimeListStatusHold) On hold
option(value=arn.AnimeListStatusDropped) Dropped
.anime-list-item-rating-edit .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.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.Story", item.Rating.Story, "Story", "Story rating on a scale of 0 to 10", "0", "10", "0.1")

View File

@ -5,7 +5,7 @@ component NewThread(user *arn.User)
textarea#text.widget-element(placeholder="Content") textarea#text.widget-element(placeholder="Content")
select#tag.widget-element select#tag.widget-element(value="general")
option(value="general") General option(value="general") General
option(value="news") News option(value="news") News
option(value="anime") Anime option(value="anime") Anime

View File

@ -71,9 +71,16 @@ export class AnimeNotifier {
// Update each of these asynchronously // Update each of these asynchronously
Promise.resolve().then(() => this.mountMountables()) Promise.resolve().then(() => this.mountMountables())
Promise.resolve().then(() => this.assignActions())
Promise.resolve().then(() => this.lazyLoadImages()) Promise.resolve().then(() => this.lazyLoadImages())
Promise.resolve().then(() => this.displayLocalDates()) Promise.resolve().then(() => this.displayLocalDates())
Promise.resolve().then(() => this.setSelectBoxValue())
Promise.resolve().then(() => this.assignActions())
}
setSelectBoxValue() {
for(let element of document.getElementsByTagName("select")) {
element.value = element.getAttribute("value")
}
} }
displayLocalDates() { displayLocalDates() {
@ -229,7 +236,7 @@ export class AnimeNotifier {
this.unmountMountables() this.unmountMountables()
this.loading(true) this.loading(true)
return delay(300).then(() => { return delay(330).then(() => {
request request
.then(html => this.app.setContent(html, true)) .then(html => this.app.setContent(html, true))
.then(() => this.app.markActiveLinks()) .then(() => this.app.markActiveLinks())

View File

@ -57,6 +57,11 @@ export class Diff {
let attrib = elemB.attributes[x] let attrib = elemB.attributes[x]
if(attrib.specified) { if(attrib.specified) {
// Skip mountables
if(attrib.name == "class" && elemA.classList.contains("mounted")) {
continue
}
elemA.setAttribute(attrib.name, elemB.getAttribute(attrib.name)) elemA.setAttribute(attrib.name, elemB.getAttribute(attrib.name))
} }
} }

View File

@ -61,4 +61,4 @@ nav-height = 3.11rem
// Timings // Timings
fade-speed = 200ms fade-speed = 200ms
transition-speed = 290ms transition-speed = 250ms

View File

@ -62,10 +62,13 @@ button, .button
// // box-shadow 0 0 6px alpha(mainColor, 20%) // // box-shadow 0 0 6px alpha(mainColor, 20%)
// border 1px solid main-color // border 1px solid main-color
// select select
// ui-element ui-element
// font-size 1rem appearance none
// padding 0.5em 1em -webkit-appearance none
-moz-appearance none
font-size 1rem
// padding 0.5em 1em
label label
width 100% width 100%