Feat/improve styles (#1868)
* improve css * fix table * fix write page * improve header nav * fix menu * fix menu * fix menu * add flex grid system * fix * fix flex * fix draft version * using main html element to replace div * improve css * add input type number * fix custom-fields * fix screen
This commit is contained in:
18
var/Typecho/Widget/Helper/Form/Element/Number.php
Normal file
18
var/Typecho/Widget/Helper/Form/Element/Number.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Typecho\Widget\Helper\Form\Element;
|
||||
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Number extends Text
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getType(): string
|
||||
{
|
||||
return 'number';
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class Contents extends Base implements QueryInterface, RowFilterInterface, Prima
|
||||
$draft = $this->db->fetchObject($this->db->select('type', 'parent')
|
||||
->from('table.contents')->where('cid = ?', $cid));
|
||||
|
||||
if (preg_match("/_draft$/", $draft->type) && $draft->parent) {
|
||||
if ('revision' === $draft->type && $draft->parent) {
|
||||
$result = '@' . $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,13 @@ class Menu extends Base
|
||||
*/
|
||||
private string $currentUrl;
|
||||
|
||||
/**
|
||||
* 当前菜单URL
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private string $currentMenuUrl;
|
||||
|
||||
/**
|
||||
* 执行函数,初始化菜单
|
||||
*/
|
||||
@@ -171,6 +178,7 @@ class Menu extends Base
|
||||
$orgHidden = $hidden;
|
||||
|
||||
// parse url
|
||||
$menuUrl = $url;
|
||||
$url = Common::url($url, $adminUrl);
|
||||
|
||||
// compare url
|
||||
@@ -241,6 +249,7 @@ class Menu extends Base
|
||||
$this->currentChild = $inKey;
|
||||
$this->title = $title;
|
||||
$this->addLink = $addLink ? Common::url($addLink, $adminUrl) : null;
|
||||
$this->currentMenuUrl = $menuUrl;
|
||||
}
|
||||
|
||||
$children[$inKey] = [
|
||||
@@ -271,6 +280,16 @@ class Menu extends Base
|
||||
return $this->currentParent > 0 ? $this->menu[$this->currentParent][3][$this->currentChild] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前菜单URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentMenuUrl(): string
|
||||
{
|
||||
return $this->currentMenuUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出父级菜单
|
||||
*/
|
||||
@@ -281,39 +300,28 @@ class Menu extends Base
|
||||
continue;
|
||||
}
|
||||
|
||||
echo "<ul class=\"root" . ($key == $this->currentParent ? ' ' . $class : null)
|
||||
. "\"><li class=\"parent\"><a href=\"{$node[2]}\">{$node[0]}</a>"
|
||||
. "</li><ul class=\"child\">";
|
||||
|
||||
$last = 0;
|
||||
foreach ($node[3] as $inKey => $inNode) {
|
||||
if (!$inNode[4]) {
|
||||
$last = $inKey;
|
||||
}
|
||||
}
|
||||
echo "<li" . ($key == $this->currentParent ? " class=\"{$class}\"" : '')
|
||||
. "><a href=\"{$node[2]}\">{$node[0]}</a>"
|
||||
. "<menu>";
|
||||
|
||||
foreach ($node[3] as $inKey => $inNode) {
|
||||
if ($inNode[4]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$classes = [];
|
||||
$focus = false;
|
||||
if ($key == $this->currentParent && $inKey == $this->currentChild) {
|
||||
$classes[] = $childClass;
|
||||
$focus = true;
|
||||
} elseif ($inNode[6]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($inKey == $last) {
|
||||
$classes[] = 'last';
|
||||
}
|
||||
|
||||
echo "<li" . (!empty($classes) ? ' class="' . implode(' ', $classes) . '"' : null) . "><a href=\""
|
||||
echo "<li" . ($focus ? " class=\"{$childClass}\"" : '') . "><a href=\""
|
||||
. ($key == $this->currentParent && $inKey == $this->currentChild ? $this->currentUrl : $inNode[2])
|
||||
. "\">{$inNode[0]}</a></li>";
|
||||
}
|
||||
|
||||
echo "</ul></ul>";
|
||||
echo '</menu></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class Discussion extends Options implements ActionInterface
|
||||
$form->addInput($commentDateFormat);
|
||||
|
||||
/** 评论列表数目 */
|
||||
$commentsListSize = new Form\Element\Text(
|
||||
$commentsListSize = new Form\Element\Number(
|
||||
'commentsListSize',
|
||||
null,
|
||||
$this->options->commentsListSize,
|
||||
@@ -158,14 +158,14 @@ class Discussion extends Options implements ActionInterface
|
||||
<option value="X"' . ('X' == $this->options->commentsAvatarRating ? ' selected="true"' : '') . '>' . _t('X - 限制级') . '</option></select>
|
||||
<label for="commentsShow-commentsAvatarRating">'),
|
||||
'commentsPageBreak' => _t('启用分页, 并且每页显示 %s 篇评论, 在列出时将 %s 作为默认显示',
|
||||
'</label><input type="text" value="' . $this->options->commentsPageSize
|
||||
'</label><input type="number" value="' . $this->options->commentsPageSize
|
||||
. '" class="text num text-s" id="commentsShow-commentsPageSize" name="commentsPageSize" /><label for="commentsShow-commentsPageSize">',
|
||||
'</label><select id="commentsShow-commentsPageDisplay" name="commentsPageDisplay">
|
||||
<option value="first"' . ('first' == $this->options->commentsPageDisplay ? ' selected="true"' : '') . '>' . _t('第一页') . '</option>
|
||||
<option value="last"' . ('last' == $this->options->commentsPageDisplay ? ' selected="true"' : '') . '>' . _t('最后一页') . '</option></select>'
|
||||
. '<label for="commentsShow-commentsPageDisplay">'),
|
||||
'commentsThreaded' => _t('启用评论回复, 以 %s 层作为每个评论最多的回复层数',
|
||||
'</label><input name="commentsMaxNestingLevels" type="text" class="text num text-s" value="' . $this->options->commentsMaxNestingLevels . '" id="commentsShow-commentsMaxNestingLevels" />
|
||||
'</label><input name="commentsMaxNestingLevels" type="number" class="text num text-s" value="' . $this->options->commentsMaxNestingLevels . '" id="commentsShow-commentsMaxNestingLevels" />
|
||||
<label for="commentsShow-commentsMaxNestingLevels">') . '</label></span><span class="multiline">'
|
||||
. _t('将 %s 的评论显示在前面', '<select id="commentsShow-commentsOrder" name="commentsOrder">
|
||||
<option value="DESC"' . ('DESC' == $this->options->commentsOrder ? ' selected="true"' : '') . '>' . _t('较新的') . '</option>
|
||||
@@ -218,10 +218,10 @@ class Discussion extends Options implements ActionInterface
|
||||
'commentsCheckReferer' => _t('检查评论来源页 URL 是否与文章链接一致'),
|
||||
'commentsAntiSpam' => _t('开启反垃圾保护'),
|
||||
'commentsAutoClose' => _t('在文章发布 %s 天以后自动关闭评论',
|
||||
'</label><input name="commentsPostTimeout" type="text" class="text num text-s" value="' . intval($this->options->commentsPostTimeout / (24 * 3600)) . '" id="commentsPost-commentsPostTimeout" />
|
||||
'</label><input name="commentsPostTimeout" type="number" class="text num text-s" value="' . intval($this->options->commentsPostTimeout / (24 * 3600)) . '" id="commentsPost-commentsPostTimeout" />
|
||||
<label for="commentsPost-commentsPostTimeout">'),
|
||||
'commentsPostIntervalEnable' => _t('同一 IP 发布评论的时间间隔限制为 %s 分钟',
|
||||
'</label><input name="commentsPostInterval" type="text" class="text num text-s" value="' . round($this->options->commentsPostInterval / (60), 1) . '" id="commentsPost-commentsPostInterval" />
|
||||
'</label><input name="commentsPostInterval" type="number" class="text num text-s" value="' . round($this->options->commentsPostInterval / (60), 1) . '" id="commentsPost-commentsPostInterval" />
|
||||
<label for="commentsPost-commentsPostInterval">')
|
||||
];
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ class Reading extends Permalink
|
||||
$form->addInput($frontPage->multiMode());
|
||||
|
||||
/** 文章列表数目 */
|
||||
$postsListSize = new Form\Element\Text(
|
||||
$postsListSize = new Form\Element\Number(
|
||||
'postsListSize',
|
||||
null,
|
||||
$this->options->postsListSize,
|
||||
@@ -206,7 +206,7 @@ class Reading extends Permalink
|
||||
$form->addInput($postsListSize->addRule('isInteger', _t('请填入一个数字')));
|
||||
|
||||
/** 每页文章数目 */
|
||||
$pageSize = new Form\Element\Text(
|
||||
$pageSize = new Form\Element\Number(
|
||||
'pageSize',
|
||||
null,
|
||||
$this->options->pageSize,
|
||||
|
||||
Reference in New Issue
Block a user