Improve forms

This commit is contained in:
Frédéric Guillot
2014-05-09 19:14:48 -04:00
parent a4335c0e52
commit 6f796a8cc1
6 changed files with 136 additions and 90 deletions

View File

@@ -110,11 +110,11 @@ td li {
/* forms */ /* forms */
form { form {
padding-top: 5px; padding: 10px;
padding-bottom: 5px;
padding-left: 15px;
margin-bottom: 20px; margin-bottom: 20px;
border-left: 2px dotted #ddd; background: #fcfcfc;
border: 1px solid #eee;
border-radius: 5px;
} }
label { label {
@@ -133,11 +133,13 @@ input[type="email"],
input[type="tel"], input[type="tel"],
input[type="password"], input[type="password"],
input[type="text"] { input[type="text"] {
color: #888;
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 3px;
line-height: 15px;
width: 400px; width: 400px;
font-size: 99%; font-size: 1.0em;
height: 25px;
padding-bottom: 0;
font-family: sans-serif;
margin-top: 5px; margin-top: 5px;
-webkit-appearance: none; -webkit-appearance: none;
appearance: none; appearance: none;
@@ -162,10 +164,10 @@ input[type="number"] {
textarea { textarea {
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 3px;
width: 400px; width: 400px;
height: 200px; height: 200px;
font-size: 99%; font-size: 1.0em;
font-family: sans-serif;
} }
::-webkit-input-placeholder { ::-webkit-input-placeholder {
@@ -184,6 +186,7 @@ textarea {
} }
.form-actions { .form-actions {
clear: both;
margin-top: 20px; margin-top: 20px;
} }
@@ -234,6 +237,22 @@ input.form-date {
margin-bottom: 20px; margin-bottom: 20px;
} }
.form-column {
float: left;
margin-bottom: 60px;
padding-right: 30px;
padding-left: 30px;
}
.form-column:first-child {
padding-left: 0;
}
.form-login {
padding-left: 20px;
width: 430px;
}
/* alerts */ /* alerts */
.alert { .alert {
padding: 8px 35px 8px 14px; padding: 8px 35px 8px 14px;

View File

@@ -5,31 +5,39 @@
<section> <section>
<form method="post" action="?controller=task&amp;action=update" autocomplete="off"> <form method="post" action="?controller=task&amp;action=update" autocomplete="off">
<?= Helper\form_hidden('id', $values) ?> <div class="form-column">
<?= Helper\form_hidden('project_id', $values) ?>
<?= Helper\form_label(t('Title'), 'title') ?> <?= Helper\form_label(t('Title'), 'title') ?>
<?= Helper\form_text('title', $values, $errors, array('required')) ?><br/> <?= Helper\form_text('title', $values, $errors, array('required')) ?><br/>
<?= Helper\form_label(t('Column'), 'column_id') ?> <?= Helper\form_label(t('Description'), 'description') ?>
<?= Helper\form_select('column_id', $columns_list, $values, $errors) ?><br/> <?= Helper\form_textarea('description', $values, $errors) ?><br/>
<div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
<?= Helper\form_label(t('Color'), 'color_id') ?> </div>
<?= Helper\form_select('color_id', $colors_list, $values, $errors) ?><br/>
<?= Helper\form_label(t('Assignee'), 'owner_id') ?> <div class="form-column">
<?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/>
<?= Helper\form_label(t('Story Points'), 'score') ?> <?= Helper\form_hidden('id', $values) ?>
<?= Helper\form_number('score', $values, $errors) ?><br/> <?= Helper\form_hidden('project_id', $values) ?>
<?= Helper\form_label(t('Due Date'), 'date_due') ?> <?= Helper\form_label(t('Assignee'), 'owner_id') ?>
<?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.t('month/day/year').'"'), 'form-date') ?><br/> <?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/>
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
<?= Helper\form_label(t('Description'), 'description') ?> <?= Helper\form_label(t('Column'), 'column_id') ?>
<?= Helper\form_textarea('description', $values, $errors) ?><br/> <?= Helper\form_select('column_id', $columns_list, $values, $errors) ?><br/>
<div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
<?= Helper\form_label(t('Color'), 'color_id') ?>
<?= Helper\form_select('color_id', $colors_list, $values, $errors) ?><br/>
<?= Helper\form_label(t('Story Points'), 'score') ?>
<?= Helper\form_number('score', $values, $errors) ?><br/>
<?= Helper\form_label(t('Due Date'), 'date_due') ?>
<?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.t('month/day/year').'"'), 'form-date') ?><br/>
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
</div>
<div class="form-actions"> <div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>

View File

@@ -5,34 +5,39 @@
<section> <section>
<form method="post" action="?controller=task&amp;action=save" autocomplete="off"> <form method="post" action="?controller=task&amp;action=save" autocomplete="off">
<?= Helper\form_label(t('Title'), 'title') ?> <div class="form-column">
<?= Helper\form_text('title', $values, $errors, array('autofocus', 'required')) ?><br/> <?= Helper\form_label(t('Title'), 'title') ?>
<?= Helper\form_text('title', $values, $errors, array('autofocus', 'required')) ?><br/>
<?= Helper\form_hidden('project_id', $values) ?> <?= Helper\form_label(t('Description'), 'description') ?>
<?= Helper\form_textarea('description', $values, $errors) ?><br/>
<div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
<?= Helper\form_label(t('Column'), 'column_id') ?> <?php if (! isset($duplicate)): ?>
<?= Helper\form_select('column_id', $columns_list, $values, $errors) ?><br/> <?= Helper\form_checkbox('another_task', t('Create another task'), 1, isset($values['another_task']) && $values['another_task'] == 1) ?>
<?php endif ?>
</div>
<?= Helper\form_label(t('Color'), 'color_id') ?> <div class="form-column">
<?= Helper\form_select('color_id', $colors_list, $values, $errors) ?><br/>
<?= Helper\form_label(t('Assignee'), 'owner_id') ?> <?= Helper\form_hidden('project_id', $values) ?>
<?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/>
<?= Helper\form_label(t('Story Points'), 'score') ?> <?= Helper\form_label(t('Assignee'), 'owner_id') ?>
<?= Helper\form_number('score', $values, $errors) ?><br/> <?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/>
<?= Helper\form_label(t('Due Date'), 'date_due') ?> <?= Helper\form_label(t('Column'), 'column_id') ?>
<?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.t('month/day/year').'"'), 'form-date') ?><br/> <?= Helper\form_select('column_id', $columns_list, $values, $errors) ?><br/>
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
<?= Helper\form_label(t('Description'), 'description') ?> <?= Helper\form_label(t('Color'), 'color_id') ?>
<?= Helper\form_textarea('description', $values, $errors) ?><br/> <?= Helper\form_select('color_id', $colors_list, $values, $errors) ?><br/>
<div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
<?php if (! isset($duplicate)): ?> <?= Helper\form_label(t('Story Points'), 'score') ?>
<?= Helper\form_checkbox('another_task', t('Create another task'), 1, isset($values['another_task']) && $values['another_task'] == 1) ?> <?= Helper\form_number('score', $values, $errors) ?><br/>
<?php endif ?>
<?= Helper\form_label(t('Due Date'), 'date_due') ?>
<?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.t('month/day/year').'"'), 'form-date') ?><br/>
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
</div>
<div class="form-actions"> <div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>

View File

@@ -8,47 +8,53 @@
<section> <section>
<form method="post" action="?controller=user&amp;action=update" autocomplete="off"> <form method="post" action="?controller=user&amp;action=update" autocomplete="off">
<?= Helper\form_hidden('id', $values) ?> <div class="form-column">
<?= Helper\form_hidden('is_ldap_user', $values) ?>
<?= Helper\form_label(t('Username'), 'username') ?> <?= Helper\form_hidden('id', $values) ?>
<?= Helper\form_text('username', $values, $errors, array('required', $values['is_ldap_user'] == 1 ? 'readonly' : '')) ?><br/> <?= Helper\form_hidden('is_ldap_user', $values) ?>
<?= Helper\form_label(t('Name'), 'name') ?> <?= Helper\form_label(t('Username'), 'username') ?>
<?= Helper\form_text('name', $values, $errors) ?><br/> <?= Helper\form_text('username', $values, $errors, array('required', $values['is_ldap_user'] == 1 ? 'readonly' : '')) ?><br/>
<?= Helper\form_label(t('Email'), 'email') ?> <?= Helper\form_label(t('Name'), 'name') ?>
<?= Helper\form_email('email', $values, $errors) ?><br/> <?= Helper\form_text('name', $values, $errors) ?><br/>
<?php if ($values['is_ldap_user'] == 0): ?> <?= Helper\form_label(t('Email'), 'email') ?>
<?= Helper\form_email('email', $values, $errors) ?><br/>
<?= Helper\form_label(t('Current password for the user "%s"', Helper\get_username()), 'current_password') ?> <?= Helper\form_label(t('Default Project'), 'default_project_id') ?>
<?= Helper\form_password('current_password', $values, $errors) ?><br/> <?= Helper\form_select('default_project_id', $projects, $values, $errors) ?><br/>
<?= Helper\form_label(t('Password'), 'password') ?> </div>
<?= Helper\form_password('password', $values, $errors) ?><br/>
<?= Helper\form_label(t('Confirmation'), 'confirmation') ?> <div class="form-column">
<?= Helper\form_password('confirmation', $values, $errors) ?><br/>
<?php endif ?> <?php if ($values['is_ldap_user'] == 0): ?>
<?= Helper\form_label(t('Default Project'), 'default_project_id') ?> <?= Helper\form_label(t('Current password for the user "%s"', Helper\get_username()), 'current_password') ?>
<?= Helper\form_select('default_project_id', $projects, $values, $errors) ?><br/> <?= Helper\form_password('current_password', $values, $errors) ?><br/>
<?php if (Helper\is_admin()): ?> <?= Helper\form_label(t('Password'), 'password') ?>
<?= Helper\form_checkbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1 ? true : false) ?><br/> <?= Helper\form_password('password', $values, $errors) ?><br/>
<?php endif ?>
<?= Helper\form_label(t('Confirmation'), 'confirmation') ?>
<?= Helper\form_password('confirmation', $values, $errors) ?><br/>
<?php if (GOOGLE_AUTH && Helper\is_current_user($values['id'])): ?>
<div class="form-row">
<?php if (empty($values['google_id'])): ?>
<a href="?controller=user&amp;action=google"><?= t('Link my Google Account') ?></a>
<?php else: ?>
<a href="?controller=user&amp;action=unlinkGoogle"><?= t('Unlink my Google Account') ?></a>
<?php endif ?> <?php endif ?>
<div>
<?php endif ?> <?php if (Helper\is_admin()): ?>
<?= Helper\form_checkbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1 ? true : false) ?><br/>
<?php endif ?>
<?php if (GOOGLE_AUTH && Helper\is_current_user($values['id'])): ?>
<?php if (empty($values['google_id'])): ?>
<a href="?controller=user&amp;action=google"><?= t('Link my Google Account') ?></a>
<?php else: ?>
<a href="?controller=user&amp;action=unlinkGoogle"><?= t('Unlink my Google Account') ?></a>
<?php endif ?>
<?php endif ?>
</div>
<div class="form-actions"> <div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <a href="?controller=user"><?= t('cancel') ?></a> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <a href="?controller=user"><?= t('cancel') ?></a>

View File

@@ -6,7 +6,7 @@
<p class="alert alert-error"><?= Helper\escape($errors['login']) ?></p> <p class="alert alert-error"><?= Helper\escape($errors['login']) ?></p>
<?php endif ?> <?php endif ?>
<form method="post" action="?controller=user&amp;action=check"> <form method="post" action="?controller=user&amp;action=check" class="form-login">
<?= Helper\form_label(t('Username'), 'username') ?> <?= Helper\form_label(t('Username'), 'username') ?>
<?= Helper\form_text('username', $values, $errors, array('autofocus', 'required')) ?><br/> <?= Helper\form_text('username', $values, $errors, array('autofocus', 'required')) ?><br/>

View File

@@ -8,25 +8,33 @@
<section> <section>
<form method="post" action="?controller=user&amp;action=save" autocomplete="off"> <form method="post" action="?controller=user&amp;action=save" autocomplete="off">
<?= Helper\form_label(t('Username'), 'username') ?> <div class="form-column">
<?= Helper\form_text('username', $values, $errors, array('autofocus', 'required')) ?><br/>
<?= Helper\form_label(t('Name'), 'name') ?> <?= Helper\form_label(t('Username'), 'username') ?>
<?= Helper\form_text('name', $values, $errors) ?><br/> <?= Helper\form_text('username', $values, $errors, array('autofocus', 'required')) ?><br/>
<?= Helper\form_label(t('Email'), 'email') ?> <?= Helper\form_label(t('Name'), 'name') ?>
<?= Helper\form_email('email', $values, $errors) ?><br/> <?= Helper\form_text('name', $values, $errors) ?><br/>
<?= Helper\form_label(t('Password'), 'password') ?> <?= Helper\form_label(t('Email'), 'email') ?>
<?= Helper\form_password('password', $values, $errors, array('required')) ?><br/> <?= Helper\form_email('email', $values, $errors) ?><br/>
<?= Helper\form_label(t('Confirmation'), 'confirmation') ?> <?= Helper\form_label(t('Default Project'), 'default_project_id') ?>
<?= Helper\form_password('confirmation', $values, $errors, array('required')) ?><br/> <?= Helper\form_select('default_project_id', $projects, $values, $errors) ?><br/>
<?= Helper\form_label(t('Default Project'), 'default_project_id') ?> </div>
<?= Helper\form_select('default_project_id', $projects, $values, $errors) ?><br/>
<?= Helper\form_checkbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1 ? true : false) ?> <div class="form-column">
<?= Helper\form_label(t('Password'), 'password') ?>
<?= Helper\form_password('password', $values, $errors, array('required')) ?><br/>
<?= Helper\form_label(t('Confirmation'), 'confirmation') ?>
<?= Helper\form_password('confirmation', $values, $errors, array('required')) ?><br/>
<?= Helper\form_checkbox('is_admin', t('Administrator'), 1, isset($values['is_admin']) && $values['is_admin'] == 1 ? true : false) ?>
</div>
<div class="form-actions"> <div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>