Generic TabLike component
This commit is contained in:
parent
9aa6283b6c
commit
2ca11742c1
14
mixins/TabLike.pixy
Normal file
14
mixins/TabLike.pixy
Normal file
@ -0,0 +1,14 @@
|
||||
component TabLike(label string, icon string, typeName string, likeable arn.Likeable, user *arn.User)
|
||||
if user == nil
|
||||
.tab.action(aria-label=label, title="Login to like this " + typeName)
|
||||
Icon(icon)
|
||||
span.tab-text= label
|
||||
else
|
||||
if likeable.LikedBy(user.ID)
|
||||
.tab.action(data-api="/api" + likeable.Link(), data-action="unlike", data-trigger="click", aria-label=label, title="Click to unlike this " + typeName)
|
||||
Icon(icon)
|
||||
span.tab-text= label
|
||||
else
|
||||
.tab.action(data-api="/api" + likeable.Link(), data-action="like", data-trigger="click", aria-label=label, title="Click to like this " + typeName)
|
||||
Icon(icon + "-o")
|
||||
span.tab-text= label
|
@ -1,14 +0,0 @@
|
||||
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
|
@ -1,14 +0,0 @@
|
||||
component TabLikeTrack(label string, icon string, track *arn.SoundTrack, user *arn.User)
|
||||
if user == nil
|
||||
.tab.action(aria-label=label, title="Login to like this track")
|
||||
Icon(icon)
|
||||
span.tab-text= label
|
||||
else
|
||||
if track.LikedBy(user.ID)
|
||||
.tab.action(data-api="/api" + track.Link(), data-action="unlike", data-trigger="click", aria-label=label, title="Click to unlike this track")
|
||||
Icon(icon)
|
||||
span.tab-text= label
|
||||
else
|
||||
.tab.action(data-api="/api" + track.Link(), data-action="like", data-trigger="click", aria-label=label, title="Click to like this track")
|
||||
Icon(icon + "-o")
|
||||
span.tab-text= label
|
@ -50,7 +50,7 @@ component QuoteInformation(quote *arn.Quote, user *arn.User)
|
||||
|
||||
component QuoteTabs(quote *arn.Quote, user *arn.User)
|
||||
.tabs
|
||||
TabLikeQuote(strconv.Itoa(len(quote.Likes)), "heart", quote, user)
|
||||
TabLike(strconv.Itoa(len(quote.Likes)), "heart", "quote", quote, user)
|
||||
Tab("Quote", "quote-left", quote.Link())
|
||||
Tab("Edit", "pencil", quote.Link() + "/edit")
|
||||
|
||||
|
@ -50,6 +50,6 @@ component Track(track *arn.SoundTrack, user *arn.User)
|
||||
|
||||
component SoundTrackTabs(track *arn.SoundTrack, user *arn.User)
|
||||
.tabs
|
||||
TabLikeTrack(strconv.Itoa(len(track.Likes)), "heart", track, user)
|
||||
TabLike(strconv.Itoa(len(track.Likes)), "heart", "track", track, user)
|
||||
Tab("Soundtrack", "music", track.Link())
|
||||
Tab("Edit", "pencil", track.Link() + "/edit")
|
||||
|
Loading…
Reference in New Issue
Block a user