Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/ublog/src/main/UblogForm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class UblogForm(val captcher: CaptchaApi, langList: LangList):
"live" -> boolean,
"discuss" -> boolean,
"sticky" -> boolean,
"ads" -> boolean,
"gameId" -> of[GameId],
"move" -> text
)(UblogPostData.apply)(unapply)
Expand All @@ -43,6 +44,7 @@ final class UblogForm(val captcher: CaptchaApi, langList: LangList):
live = post.live,
discuss = ~post.discuss,
sticky = ~post.sticky,
ads = ~post.ads,
gameId = GameId(""),
move = ""
)
Expand All @@ -60,6 +62,7 @@ object UblogForm:
live: Boolean,
discuss: Boolean,
sticky: Boolean,
ads: Boolean,
gameId: GameId,
move: String
) extends WithCaptcha:
Expand All @@ -77,6 +80,7 @@ object UblogForm:
live = false,
discuss = Option(false),
sticky = Option(false),
ads = Option(false),
created = UblogPost.Recorded(user.id, nowInstant),
updated = none,
lived = none,
Expand All @@ -98,6 +102,7 @@ object UblogForm:
live = live,
discuss = Option(discuss),
sticky = Option(sticky),
ads = Option(ads),
updated = UblogPost.Recorded(user.id, nowInstant).some,
lived = prev.lived.orElse(live.option(UblogPost.Recorded(user.id, nowInstant)))
)
Expand Down
1 change: 1 addition & 0 deletions modules/ublog/src/main/UblogPost.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ case class UblogPost(
live: Boolean,
discuss: Option[Boolean],
sticky: Option[Boolean],
ads: Option[Boolean], // boo!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

created: UblogPost.Recorded,
updated: Option[UblogPost.Recorded],
lived: Option[UblogPost.Recorded],
Expand Down
12 changes: 12 additions & 0 deletions modules/ublog/src/main/ui/UblogFormUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ final class UblogFormUi(helpers: Helpers, ui: UblogUi)(
form("sticky"),
trans.ublog.stickyPost(),
help = trans.ublog.stickyPostHelp().some
),
form3.checkbox(
form("ads"),
"Includes promoted/sponsored content or referral links",
help = ads.some
)
)
)
Expand Down Expand Up @@ -195,3 +200,10 @@ final class UblogFormUi(helpers: Helpers, ui: UblogUi)(
cls := "text",
targetBlank
)(trans.ublog.blogTips())

val ads = a(
dataIcon := Icon.InfoCircle,
href := routes.Cms.lonePage(CmsPageKey("blog-etiquette")),
cls := "text",
targetBlank
)("Mandatory for sponsored content, affiliate links or commercial advertisement")
5 changes: 5 additions & 0 deletions modules/ublog/src/main/ui/UblogPostUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ final class UblogPostUi(helpers: Helpers, ui: UblogUi)(
post.topics.map: topic =>
a(href := routes.Ublog.topic(topic.url, 1))(topic.value)
),
(~post.ads).option(
div(dataIcon := Icon.InfoCircle, cls := "ublog-post__ads-disclosure text")(
"Contains sponsored content, affiliate links or commercial advertisement"
)
),
strong(cls := "ublog-post__intro")(post.intro),
div(cls := "ublog-post__markup expand-text")(markup),
post.isLichess.option(
Expand Down
9 changes: 7 additions & 2 deletions ui/bits/css/ublog/_post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
&__topics {
@extend %flex-wrap;
justify-content: center;
margin-bottom: 6vh;
line-height: 2em;

a {
Expand All @@ -64,6 +63,12 @@
&__tier {
margin-inline-start: 1em;
}
&__ads-disclosure {
@extend %box-radius;
padding: 1rem 1.5rem;
margin-top: 3vh;
background: $c-bg-zebra;
}
&__like {
font-weight: bold;
cursor: pointer;
Expand Down Expand Up @@ -105,7 +110,7 @@
&__intro {
@extend %break-word;
font-size: 1.2em;
margin-bottom: 4vh;
margin: 5vh 0 5vh 0;
display: block;
}

Expand Down
Loading