Show edit link in post cards

This commit is contained in:
Kitaiti Makoto 2021-01-17 22:29:45 +09:00
parent 46fc030df4
commit c253bdee54
2 changed files with 27 additions and 6 deletions

View File

@ -183,6 +183,8 @@ p.error {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative;
min-width: 20em; min-width: 20em;
min-height: 20em; min-height: 20em;
margin: 1em; margin: 1em;
@ -225,11 +227,14 @@ p.error {
} }
h3 { h3 {
margin: 0.75em 20px; flex-grow: 1;
margin: 0;
font-family: $playfair; font-family: $playfair;
font-size: 1.75em; font-size: 1.75em;
font-weight: normal; font-weight: normal;
line-height: 1.75;
a { a {
display: block;
transition: color 0.1s ease-in; transition: color 0.1s ease-in;
color: $text-color; color: $text-color;
@ -237,6 +242,15 @@ p.error {
} }
} }
.controls {
float: right;
.button {
margin-top: 0;
margin-bottom: 0;
}
}
main { main {
flex: 1; flex: 1;

View File

@ -8,11 +8,18 @@
@if article.cover_id.is_some() { @if article.cover_id.is_some() {
<div class="cover" style="background-image: url('@Html(article.cover_url(ctx.0).unwrap_or_default())')"></div> <div class="cover" style="background-image: url('@Html(article.cover_url(ctx.0).unwrap_or_default())')"></div>
} }
<h3 class="p-name" dir="auto"> <header>
<a class="u-url" href="@uri!(posts::details: blog = article.get_blog(ctx.0).unwrap().fqn, slug = &article.slug, responding_to = _)"> @if ctx.2.clone().and_then(|u| article.is_author(ctx.0, u.id).ok()).unwrap_or(false) {
@article.title <div class="controls">
</a> <a class="button" href="@uri!(posts::edit: blog = &article.get_blog(ctx.0).unwrap().fqn, slug = &article.slug)">@i18n!(ctx.1, "Edit")</a>
</h3> </div>
}
<h3 class="p-name" dir="auto">
<a class="u-url" href="@uri!(posts::details: blog = article.get_blog(ctx.0).unwrap().fqn, slug = &article.slug, responding_to = _)">
@article.title
</a>
</h3>
</header>
<main> <main>
<p class="p-summary" dir="auto">@article.subtitle</p> <p class="p-summary" dir="auto">@article.subtitle</p>
</main> </main>