more ublog menus and integrations

pull/9764/head
Thibault Duplessis 2021-09-09 13:01:57 +02:00
parent 52aa48bf56
commit 4282b6bcf3
5 changed files with 142 additions and 116 deletions

View File

@ -28,26 +28,40 @@ object blog {
).some,
robots = netConfig.crawlable && blog.listed
) {
main(cls := "box box-pad page page-small ublog-index")(
div(cls := "box__top")(
h1(trans.ublog.xBlog(userLink(user))),
if (ctx is user)
main(cls := "page-menu")(
views.html.blog.bits.menu(none, (if (ctx is user) "mine" else "community").some),
div(cls := "page-menu__content box box-pad ublog-index")(
div(cls := "box__top")(
h1(trans.ublog.xBlog(userLink(user))),
div(cls := "box__top__actions")(
a(href := routes.Ublog.drafts(user.username))(trans.ublog.drafts()),
postView.newPostLink
if (ctx is user)
frag(
a(href := routes.Ublog.drafts(user.username))(trans.ublog.drafts()),
postView.newPostLink
)
else
frag(
isGranted(_.ModerateBlog) option tierForm(blog),
a(
cls := "atom",
st.title := "Atom RSS feed",
href := routes.Ublog.userAtom(user.username),
dataIcon := ""
)
)
)
else isGranted(_.ModerateBlog) option tierForm(blog)
),
standardFlash(),
if (posts.nbResults > 0)
div(cls := "ublog-index__posts ublog-post-cards infinite-scroll")(
posts.currentPageResults map { postView.card(_) },
pagerNext(posts, np => s"${routes.Ublog.index(user.username, np).url}")
)
else
div(cls := "ublog-index__posts--empty")(
trans.ublog.noPostsInThisBlogYet()
)
),
standardFlash(),
if (posts.nbResults > 0)
div(cls := "ublog-index__posts ublog-post-cards infinite-scroll")(
posts.currentPageResults map { postView.card(_) },
pagerNext(posts, np => s"${routes.Ublog.index(user.username, np).url}")
)
else
div(cls := "ublog-index__posts--empty")(
trans.ublog.noPostsInThisBlogYet()
)
)
)
}
}

View File

@ -24,11 +24,14 @@ object form {
moreJs = frag(jsModule("ublogForm"), captchaTag),
title = s"${trans.ublog.xBlog.txt(user.username)}${trans.ublog.newPost.txt()}"
) {
main(cls := "box box-pad page page-small ublog-post-form")(
standardFlash(),
h1(trans.ublog.newPost()),
etiquette,
inner(user, f, none, captcha.some)
main(cls := "page-menu")(
views.html.blog.bits.menu(none, "mine".some),
div(cls := "page-menu__content box box-pad ublog-post-form")(
standardFlash(),
h1(trans.ublog.newPost()),
etiquette,
inner(user, f, none, captcha.some)
)
)
}
@ -38,20 +41,23 @@ object form {
moreJs = jsModule("ublogForm"),
title = s"${trans.ublog.xBlog.txt(user.username)} blog • ${post.title}"
) {
main(cls := "box box-pad page page-small ublog-post-form")(
standardFlash(),
h1(trans.ublog.editYourBlogPost()),
imageForm(user, post),
inner(user, f, post.some, none),
postForm(
cls := "ublog-post-form__delete",
action := routes.Ublog.delete(post.id.value)
)(
form3.action(
submitButton(
cls := "button button-red button-empty confirm",
title := "Delete this blog post definitively"
)(trans.delete())
main(cls := "page-menu")(
views.html.blog.bits.menu(none, "mine".some),
div(cls := "page-menu__content box box-pad ublog-post-form")(
standardFlash(),
h1(trans.ublog.editYourBlogPost()),
imageForm(user, post),
inner(user, f, post.some, none),
postForm(
cls := "ublog-post-form__delete",
action := routes.Ublog.delete(post.id.value)
)(
form3.action(
submitButton(
cls := "button button-red button-empty confirm",
title := "Delete this blog post definitively"
)(trans.delete())
)
)
)
)

View File

@ -20,23 +20,26 @@ object index {
moreJs = posts.hasNextPage option infiniteScrollTag,
title = s"${trans.ublog.drafts()}"
) {
main(cls := "box box-pad page page-small ublog-index")(
div(cls := "box__top")(
h1(trans.ublog.drafts()),
div(cls := "box__top__actions")(
a(href := routes.Ublog.index(user.username))(trans.ublog.published()),
postView.newPostLink
)
),
if (posts.nbResults > 0)
div(cls := "ublog-index__posts ublog-index__posts--drafts ublog-post-cards infinite-scroll")(
posts.currentPageResults map { postView.card(_, postView.editUrlOfPost) },
pagerNext(posts, np => routes.Ublog.drafts(user.username, np).url)
)
else
div(cls := "ublog-index__posts--empty")(
trans.ublog.noDrafts()
)
main(cls := "page-menu")(
views.html.blog.bits.menu(none, "mine".some),
div(cls := "page-menu__content box box-pad ublog-index")(
div(cls := "box__top")(
h1(trans.ublog.drafts()),
div(cls := "box__top__actions")(
a(href := routes.Ublog.index(user.username))(trans.ublog.published()),
postView.newPostLink
)
),
if (posts.nbResults > 0)
div(cls := "ublog-index__posts ublog-index__posts--drafts ublog-post-cards infinite-scroll")(
posts.currentPageResults map { postView.card(_, postView.editUrlOfPost) },
pagerNext(posts, np => routes.Ublog.drafts(user.username, np).url)
)
else
div(cls := "ublog-index__posts--empty")(
trans.ublog.noDrafts()
)
)
)
}
@ -86,7 +89,7 @@ object index {
) {
main(cls := "page-menu")(
views.html.blog.bits.menu(none, menuItem.some),
main(cls := "page-menu__content box box-pad ublog-index")(
div(cls := "page-menu__content box box-pad ublog-index")(
div(cls := "box__top")(h1(title)),
if (posts.nbResults > 0)
div(cls := "ublog-index__posts ublog-post-cards infinite-scroll")(

View File

@ -40,67 +40,70 @@ object post {
.some,
robots = netConfig.crawlable && blog.listed && (post.indexable || blog.tier >= UblogBlog.Tier.HIGH)
) {
main(cls := "box box-pad page page-small ublog-post")(
thumbnail(post, _.Large)(cls := "ublog-post__image"),
ctx.is(user) option standardFlash(),
h1(cls := "ublog-post__title")(post.title),
div(cls := "ublog-post__meta")(
a(
href := routes.Ublog.index(user.username),
cls := userClass(user.id, none, withOnline = true),
dataHref := routes.User.show(user.username)
)(
lineIcon(user),
titleTag(user.title),
user.username,
isGranted(_.ModerateBlog) option (if (blog.tier <= UblogBlog.Tier.VISIBLE) badTag else goodTag)(
cls := "ublog-post__tier"
)(UblogBlog.Tier.name(blog.tier))
),
post.lived map { live =>
span(cls := "ublog-post__meta__date")(semanticDate(live.at))
},
button(
tpe := "button",
cls := List(
"ublog-post__like button-link is" -> true,
"ublog-post__like--liked" -> liked
),
dataRel := post.id.value,
title := trans.study.like.txt()
)(post.likes.value),
span(cls := "ublog-post__views")(
trans.ublog.nbViews.plural(post.views.value, strong(post.views.value))
),
if (ctx is user)
frag(
(if (post.live) goodTag else badTag)(cls := "ublog-post__meta__publish")(
if (post.live) trans.ublog.thisPostIsPublished() else trans.ublog.thisIsADraft()
),
a(
href := editUrlOfPost(post),
cls := "button button-empty text",
dataIcon := ""
)(trans.edit())
)
else
main(cls := "page-menu")(
views.html.blog.bits.menu(none, (if (ctx is user) "mine" else "community").some),
div(cls := "page-menu__content box box-pad ublog-post")(
thumbnail(post, _.Large)(cls := "ublog-post__image"),
ctx.is(user) option standardFlash(),
h1(cls := "ublog-post__title")(post.title),
div(cls := "ublog-post__meta")(
a(
titleOrText(trans.reportXToModerators.txt(user.username)),
cls := "button button-empty ublog-post__meta__report",
href := s"${routes.Report.form}?username=${user.username}&postUrl=${urlencode(s"${netBaseUrl}${urlOfPost(post).url}")}&reason=comm",
dataIcon := ""
)
),
div(cls := "ublog-post__topics")(
post.topics.map { topic =>
a(href := routes.Ublog.topic(topic.url, 1))(topic.value)
}
),
strong(cls := "ublog-post__intro")(post.intro),
div(cls := "ublog-post__markup expand-text")(markup),
div(cls := "ublog-post__footer")(
h2(a(href := routes.Ublog.index(user.username))(trans.ublog.moreBlogPostsBy(user.username))),
others.size > 0 option div(cls := "ublog-post-cards")(others map { card(_) })
href := routes.Ublog.index(user.username),
cls := userClass(user.id, none, withOnline = true),
dataHref := routes.User.show(user.username)
)(
lineIcon(user),
titleTag(user.title),
user.username,
isGranted(_.ModerateBlog) option (if (blog.tier <= UblogBlog.Tier.VISIBLE) badTag else goodTag)(
cls := "ublog-post__tier"
)(UblogBlog.Tier.name(blog.tier))
),
post.lived map { live =>
span(cls := "ublog-post__meta__date")(semanticDate(live.at))
},
button(
tpe := "button",
cls := List(
"ublog-post__like button-link is" -> true,
"ublog-post__like--liked" -> liked
),
dataRel := post.id.value,
title := trans.study.like.txt()
)(post.likes.value),
span(cls := "ublog-post__views")(
trans.ublog.nbViews.plural(post.views.value, strong(post.views.value))
),
if (ctx is user)
frag(
(if (post.live) goodTag else badTag)(cls := "ublog-post__meta__publish")(
if (post.live) trans.ublog.thisPostIsPublished() else trans.ublog.thisIsADraft()
),
a(
href := editUrlOfPost(post),
cls := "button button-empty text",
dataIcon := ""
)(trans.edit())
)
else
a(
titleOrText(trans.reportXToModerators.txt(user.username)),
cls := "button button-empty ublog-post__meta__report",
href := s"${routes.Report.form}?username=${user.username}&postUrl=${urlencode(s"${netBaseUrl}${urlOfPost(post).url}")}&reason=comm",
dataIcon := ""
)
),
div(cls := "ublog-post__topics")(
post.topics.map { topic =>
a(href := routes.Ublog.topic(topic.url, 1))(topic.value)
}
),
strong(cls := "ublog-post__intro")(post.intro),
div(cls := "ublog-post__markup expand-text")(markup),
div(cls := "ublog-post__footer")(
h2(a(href := routes.Ublog.index(user.username))(trans.ublog.moreBlogPostsBy(user.username))),
others.size > 0 option div(cls := "ublog-post-cards")(others map { card(_) })
)
)
)
}

View File

@ -1,4 +1,4 @@
main.page {
main.page-menu {
position: relative;
.flash {
position: absolute;