Skip to content

Commit

Permalink
improve: handle untitled article
Browse files Browse the repository at this point in the history
  • Loading branch information
KawaiiZapic committed Apr 16, 2024
1 parent 9d0527a commit a7ed1d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
</div>
<a title="<?php $this->title(); ?>" class="text-3xl block line-height-10 matecho-article-link" href="<?php $this->permalink(); ?>">
<?php $this->title(); ?>
<?php if (strlen($this->title) == 0) {?>
<i>无标题文章</i>
<?php } ?>
</a>
<div class="mt-4 text-sm font-300 opacity-80 line-clamp-2">
<?php if (!$this->hidden && $this->fields->description) echo $this->fields->description; else $this->excerpt(300,'...'); ?>
Expand Down
21 changes: 7 additions & 14 deletions src/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@
<?php $this->category(" | "); ?>
</div>
<div class="truncate text-3xl md:text-5xl line-height-[1.4]!">
<?php $this->archiveType === 'index' ? $this->options->title() : $this->archiveTitle(
array(
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
),
'',
''
); ?>
<?php $this->title(); ?>
</div>
<div class="text-sm opacity-80 block mt-3 truncate">
<?php
Expand Down Expand Up @@ -90,19 +81,20 @@
<?php if ($comments->___length() === 0) { ?>
<div class="my-12 text-md text-center opacity-50" id="matecho-no-comment-placeholder">没有评论</div>
<?php } ?>
<div class="pa-4 matecho-comment-form matecho-comment-form__main w-full box-border relative <?php echo $this->allowComment ? "" : "matecho-comment-form__lock"; ?>" id="<?php $this->respondId(); ?>">
<div class="pa-4 matecho-comment-form matecho-comment-form__main w-full box-border relative <?php echo $this->allowComment ? "" : "matecho-comment-form__lock"; ?>"
id="<?php $this->respondId(); ?>">
<div class="matecho-form-lock-mask text-xl">
<mdui-icon-lock class="mr-2 opacity-90"></mdui-icon-lock>
评论已关闭
</div>
</div>
<div class="matecho-form-loading-mask">
<mdui-circular-progress></mdui-circular-progress>
</div>
<div class="mb-4 text-xl matecho-comment-form-title">发表评论</div>
<!-- "data-pjax-state" prevent Pjax handle this form. -->
<form class="transition" method="post" action="<?php $this->commentUrl() ?>" role="form"
data-pjax-state>
<?php if ($this->user->hasLogin()){ ?>
<?php if ($this->user->hasLogin()) { ?>
<div class="flex items-center gap-2">
<mdui-avatar src="<?php Matecho::Gravatar($this->user->mail) ?>"></mdui-avatar>
<span><?php $this->user->screenName(); ?></span>
Expand All @@ -118,7 +110,8 @@
</div>
<?php } ?>
<div class="flex flex-gap-2 flex-col items-center mt-4">
<mdui-text-field variant="outlined" label="评论内容" rows="3" name="text" required></mdui-text-field>
<mdui-text-field variant="outlined" label="评论内容" rows="3" name="text"
required></mdui-text-field>
<div class="mt-2">
<mdui-button class="matecho-comment-submit-btn" type="submit">评论</mdui-button>
<mdui-button class="matecho-comment-cancel-btn" variant="outlined">取消回复</mdui-button>
Expand Down

0 comments on commit a7ed1d8

Please sign in to comment.