gocron/templates/user/user_form.html

142 lines
5.3 KiB
Go

{% template "common/header" . %}
<div class="ui grid">
{% template "user/menu" . %}
<div class="twelve wide column">
<div class="pageHeader">
<div class="segment">
<h3 class="ui dividing header">
<div class="content">
</div>
</h3>
</div>
</div>
<form class="ui form fluid vertical segment">
<input type="hidden" name="id" value="{%.User.Id%}">
<div class="three fields">
<div class="field">
<label></label>
<div class="ui small input">
<input type="text" name="name" value="{%.User.Name%}" placeholder="请输入用户名">
</div>
</div>
<div class="field">
<label></label>
<div class="ui small input">
<input type="text" name="email" value="{%.User.Email%}" placeholder="请输入邮箱">
</div>
</div>
</div>
{%if eq .User.Id 0%}
<div class="three fields">
<div class="field">
<label></label>
<input type="password" name="password" placeholder="请输入密码">
</div>
<div class="field">
<label></label>
<input type="password" name="confirm_password" placeholder="请再次输入密码">
</div>
</div>
{%end%}
<div class="three fields">
<div class="field">
<label></label>
<input type="radio" name="is_admin" value="0" {%if eq .User.IsAdmin 0%}checked{%end%}>
<input type="radio" name="is_admin" value="1" {%if eq .User.IsAdmin 1%}checked{%end%}>
</div>
<div class="field">
<label></label>
<input type="radio" name="status" value="1" {%if eq .User.Status 1%}checked{%end%}>
<input type="radio" name="status" value="0"
{%if eq .User.Status 0%}checked{%end%}
>
</div>
</div>
<div class="ui primary submit button"></div>
<a class="ui button" onclick="location.href='/user';"></a>
</form>
</div>
</div>
<script type="text/javascript">
var $uiForm = $('.ui.form');
$($uiForm).form(
{
onSuccess: function(event, fields) {
util.post('/user/store', fields, function(code, message) {
location.href = "/user"
});
return false;
},
fields: {
name: {
identifier : 'name',
rules: [
{
type : 'empty',
prompt : ''
},
{
type : 'minLength[3]',
prompt : '3'
},
{
type : 'maxLength[32]',
prompt : '32'
}
]
},
password: {
identifier : 'password',
rules: [
{
type : 'empty',
prompt : ''
},
{
type : 'minLength[6]',
prompt : '6'
}
]
},
confirmPassword: {
identifier : 'confirm_password',
rules: [
{
type : 'empty',
prompt : ''
},
{
type : 'match[password]',
prompt : ''
}
]
},
email: {
identifier : 'email',
rules: [
{
type : 'empty',
prompt : ''
},
{
type : 'email',
prompt : ''
}
]
}
},
inline : true
});
</script>
{% template "common/footer" . %}