mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 09:38:42 +00:00
feat(web): add form type
This commit is contained in:
parent
71a82c3a28
commit
3964f64c14
@ -35,6 +35,7 @@
|
||||
$change_realname_form->runAtServer();
|
||||
|
||||
$user_form = new UOJForm('user');
|
||||
$user_form->submit_button_config['align'] = 'compressed';
|
||||
$user_form->addInput('username', 'text', '用户名', '',
|
||||
function ($username) {
|
||||
if (!validateUsername($username)) {
|
||||
|
@ -392,7 +392,19 @@ EOD
|
||||
|
||||
public function printHTML() {
|
||||
$form_entype_str = $this->is_big ? ' enctype="multipart/form-data"' : '';
|
||||
echo '<form action="', $_SERVER['REQUEST_URI'], '" method="post" class="form-horizontal" id="form-', $this->form_name, '"', $form_entype_str, '>';
|
||||
|
||||
$form_class = "form-horizontal";
|
||||
if ($this->submit_button_config['align'] == 'inline') {
|
||||
$form_class .= " uoj-form-inline";
|
||||
}
|
||||
if ($this->submit_button_config['align'] == 'compressed') {
|
||||
$form_class .= " uoj-form-compressed";
|
||||
}
|
||||
if (isset($this->submit_button_config['narrow']) && $this->submit_button_config['narrow']) {
|
||||
$form_class .= " uoj-form-narrow";
|
||||
}
|
||||
echo '<form action="', $_SERVER['REQUEST_URI'], '" method="post" class="', $form_class, '" id="form-', $this->form_name, '"', $form_entype_str, '>';
|
||||
|
||||
echo HTML::hiddenToken();
|
||||
echo $this->main_html;
|
||||
|
||||
|
@ -393,3 +393,56 @@ pre {
|
||||
padding-left:10px;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
|
||||
form.uoj-form-inline {
|
||||
display: inline-block;
|
||||
margin-right: 0.3em;
|
||||
}
|
||||
|
||||
form.uoj-form-narrow label.col-sm-2 {
|
||||
max-width: 100% !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
form.uoj-form-narrow div.col-sm-3 {
|
||||
max-width: 100% !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
form.form-horizontal {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
form.uoj-form-compressed {
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
form.uoj-form-compressed div.form-group {
|
||||
display: inline-block;
|
||||
width: 24em;
|
||||
}
|
||||
|
||||
form.uoj-form-compressed div.form-group label.col-sm-2 {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
width: 6em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
form.uoj-form-compressed div.form-group div.col-sm-3 {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
width: 16em;
|
||||
}
|
||||
|
||||
form.uoj-form-compressed div.text-center,
|
||||
form.uoj-form-compressed div.text-compressed,
|
||||
form.uoj-form-compressed button {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
form.uoj-form-compressed button {
|
||||
position: relative;
|
||||
top: -6px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user