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

View File

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