add input type number

This commit is contained in:
joyqi 2024-10-24 21:54:01 +08:00
parent 169aeb401c
commit 4224adce49
6 changed files with 148 additions and 135 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
/**
* 典型配置选项
*/
.typecho-option {
list-style: none;
margin: 1em 0;
padding: 0;
&-submit li {
border-bottom: none;
}
label {
&.typecho-label {
display: block;
margin-bottom: .5em;
font-weight: bold;
}
&.required:after {
content: " *";
color: #B94A48;
}
}
span {
margin-right: 15px;
}
.description {
margin: .5em 0 0;
color: #999;
font-size: .92857em;
}
input.file {
width: 100%;
margin: .7em 0;
}
input.text {
width: 100%;
}
input.num {
width: 60px;
}
textarea {
width: 100%;
height: 100px;
}
.multiline {
display: block;
margin: .3em 0;
&.hidden {
display: none;
}
}
}

View File

@ -78,6 +78,7 @@ a.button:hover, a.balloon-button:hover {
@import "tabs";
@import "tags";
@import "write";
@import "options";
@import "header";
@import "footer";
@ -96,48 +97,6 @@ a.button:hover, a.balloon-button:hover {
background: transparent url(../img/ajax-loader.gif) no-repeat left center;
}
/**
* 典型配置选项
*/
.typecho-option {
list-style: none;
margin: 1em 0;
padding: 0;
&-submit li {
border-bottom: none;
}
label {
&.typecho-label {
display: block;
margin-bottom: .5em;
font-weight: bold;
}
&.required:after {
content: " *";
color: #B94A48;
}
}
span {
margin-right: 15px;
}
.description {
margin: .5em 0 0;
color: #999;
font-size: .92857em;
}
input.file {
width: 100%;
margin: .7em 0;
}
}
.front-archive {
padding-left: 1.5em;
}
@ -218,24 +177,29 @@ a.button:hover, a.balloon-button:hover {
display: table;
margin: 0 auto;
height: 100%;
}
.typecho-login {
display: table-cell;
padding: 30px 0 100px;
width: 280px;
text-align: center;
vertical-align: middle;
h1 {
margin: 0 0 1em;
.typecho-login {
display: table-cell;
padding: 30px 0 100px;
width: 280px;
text-align: center;
vertical-align: middle;
h1 {
margin: 0 0 1em;
}
.more-link {
margin-top: 2em;
color: #CCC;
a {
margin: 0 3px;
}
}
}
}
.typecho-login .more-link {
margin-top: 2em;
color: #CCC;
}
.typecho-login .more-link a { margin: 0 3px; }
/**
* 标题
*/
@ -273,13 +237,14 @@ a.button:hover, a.balloon-button:hover {
* 主页主体
*/
.typecho-dashboard {
}
.typecho-dashboard ul {
list-style: none;
padding: 0;
}
.typecho-dashboard li {
margin-bottom: 5px;
ul {
list-style: none;
padding: 0;
li {
margin-bottom: 5px;
}
}
}
/**
@ -335,57 +300,23 @@ a.button:hover, a.balloon-button:hover {
display: none;
}
/**
* 模板列表
*/
.typecho-theme-list {
}
img {
margin: 1em 0;
max-width: 100%;
max-height: 240px;
}
.typecho-theme-list .theme-item {
}
cite {
font-style: normal;
color: #999;
}
.typecho-theme-list td {
}
.typecho-theme-list img {
margin: 1em 0;
max-width: 100%;
max-height: 240px;
}
.typecho-theme-list cite {
font-style: normal;
color: #999;
}
.typecho-theme-list tbody tr.current td {
background-color: #FFF9E8;
}
/**
* 后台配置项
*/
.typecho-page-main .typecho-option input.text {
width: 100%;
}
.typecho-page-main .typecho-option input.num {
width: 40px;
}
.typecho-page-main .typecho-option textarea {
width: 100%;
height: 100px;
}
.typecho-page-main .typecho-option .multiline {
display: block;
margin: .3em 0;
&.hidden {
display: none;
tbody tr.current td {
background-color: #FFF9E8;
}
}
@ -394,27 +325,30 @@ a.button:hover, a.balloon-button:hover {
* 编辑模板编辑详情
*/
.typecho-edit-theme ul {
list-style: none;
margin: 0;
padding: 0;
}
.typecho-edit-theme {
ul {
list-style: none;
margin: 0;
padding: 0;
.typecho-edit-theme li {
padding: 3px 10px;
}
li {
padding: 3px 10px;
}
}
.typecho-edit-theme .current {
background-color: #E6E6E3;
}
.typecho-edit-theme .current a {
color: #444;
}
.current {
background-color: #E6E6E3;
.typecho-edit-theme textarea {
font-size: .92857em;
line-height: 1.2;
height: 500px;
a {
color: #444;
}
}
textarea {
font-size: .92857em;
line-height: 1.2;
height: 500px;
}
}
.typecho-attachment-photo {

View 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';
}
}

View File

@ -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">')
];

View File

@ -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,