Some fixes

This commit is contained in:
Eduard Urbach 2017-07-21 12:55:36 +02:00
parent f30056363b
commit 1cf023e476
4 changed files with 25 additions and 11 deletions

View File

@ -56,11 +56,6 @@ component ProfileHeader(viewUser *arn.User, user *arn.User, uri string)
Icon("user-times")
span Unfollow
if user.Role == "admin" || user.Role == "editor"
a.button.profile-action(href="/api/user/" + viewUser.ID)
Icon("search-plus")
span JSON
ProfileNavigation(viewUser, uri)
component ProfileNavigation(viewUser *arn.User, uri string)
@ -131,6 +126,13 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
a.profile-watching-list-item.ajax(href=item.Anime().Link(), title=item.Anime().Title.Canonical + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")")
img.profile-watching-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical)
if user != nil && (user.Role == "admin" || user.Role == "editor")
.footer
.buttons
a.button.profile-action(href="/api/user/" + viewUser.ID, target="_blank", rel="noopener")
Icon("search-plus")
span JSON
//- .profile-category.mountable
//- h3
//- a.ajax(href="/+" + viewUser.Nick + "/threads", title="View all threads") Threads

View File

@ -68,6 +68,10 @@ export class AnimeNotifier {
}
init() {
// App init
this.app.init()
// Event listeners
document.addEventListener("readystatechange", this.onReadyStateChange.bind(this))
document.addEventListener("DOMContentLoaded", this.onContentLoaded.bind(this))
document.addEventListener("keydown", this.onKeyDown.bind(this), false)
@ -573,7 +577,6 @@ export class AnimeNotifier {
return delay(300).then(() => {
return request
.then(html => this.app.setContent(html, true))
.then(() => this.app.markActiveLinks())
.then(() => this.app.emit("DOMContentLoaded"))
.then(() => this.loading(false))
.catch(console.error)

View File

@ -23,9 +23,14 @@ export class Application {
this.fadeOutClass = "fade-out"
}
init() {
document.addEventListener("DOMContentLoaded", () => {
this.ajaxify()
this.markActiveLinks()
})
}
run() {
this.ajaxify()
this.markActiveLinks()
this.loading.classList.add(this.fadeOutClass)
}
@ -118,9 +123,6 @@ export class Application {
} else {
this.content.innerHTML = html
}
this.ajaxify(this.content)
this.markActiveLinks(this.content)
}
markActiveLinks(element?: HTMLElement) {

View File

@ -26,12 +26,19 @@ export class StatusMessage {
})
}
clearStyle() {
this.container.classList.remove("info-message")
this.container.classList.remove("error-message")
}
showError(message: string, duration?: number) {
this.clearStyle()
this.show(message, duration || 4000)
this.container.classList.add("error-message")
}
showInfo(message: string, duration?: number) {
this.clearStyle()
this.show(message, duration || 2000)
this.container.classList.add("info-message")
}