Finished the design of the quote page and added the like action.

This commit is contained in:
Scott
2018-01-25 12:26:22 +01:00
parent c51cb4743b
commit 9d41f4dc6e
3 changed files with 96 additions and 21 deletions

16
mixins/TabLikeQuote.pixy Normal file
View File

@ -0,0 +1,16 @@
// This should be made abstract for every Likeable so we avoid repeating ourselves but I'm unsure on
// how to do it
component TabLikeQuote(label string, icon string, quote *arn.Quote, user *arn.User)
if user == nil
.tab.action(aria-label=label, title="Login to like this quote")
Icon(icon)
span.tab-text= label
else
if quote.LikedBy(user.ID)
.tab.action(data-api="/api" + quote.Link(), data-action="unlike", data-trigger="click", aria-label=label, title="Click to unlike this quote")
Icon(icon)
span.tab-text= label
else
.tab.action(data-api="/api" + quote.Link(), data-action="like", data-trigger="click", aria-label=label, title="Click to like this quote")
Icon(icon + "-o")
span.tab-text= label