|
@ -4,6 +4,7 @@ |
|
|
|
|
|
|
|
|
<input type="hidden" name="_token" value={ state.csrfToken } if={ state.csrfToken } /> |
|
|
<input type="hidden" name="_token" value={ state.csrfToken } if={ state.csrfToken } /> |
|
|
|
|
|
|
|
|
|
|
|
<!-- title --> |
|
|
<div class="field is-horizontal"> |
|
|
<div class="field is-horizontal"> |
|
|
<div class="field-label is-normal"> |
|
|
<div class="field-label is-normal"> |
|
|
<label class="label" for="title"> |
|
|
<label class="label" for="title"> |
|
@ -20,6 +21,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- is public --> |
|
|
<div class="field is-horizontal"> |
|
|
<div class="field is-horizontal"> |
|
|
<div class="field-label is-normal"> |
|
|
<div class="field-label is-normal"> |
|
|
<label class="label" for="public"> |
|
|
<label class="label" for="public"> |
|
@ -28,11 +30,12 @@ |
|
|
</div> |
|
|
</div> |
|
|
<div class="field-body"> |
|
|
<div class="field-body"> |
|
|
<div class="field"> |
|
|
<div class="field"> |
|
|
<input id="public" type="checkbox"> |
|
|
|
|
|
|
|
|
<input id="public" type="checkbox" name="public" value="1" checked={ props.public }> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- submit --> |
|
|
<div class="field"> |
|
|
<div class="field"> |
|
|
<div class="control"> |
|
|
<div class="control"> |
|
|
<button class="button is-primary" type="submit" disabled={ state.validator.errors().length > 0 }> |
|
|
<button class="button is-primary" type="submit" disabled={ state.validator.errors().length > 0 }> |
|
@ -57,6 +60,13 @@ |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* |
|
|
|
|
|
* @param {[type]} props [description] |
|
|
|
|
|
* @param {[type]} state [description] |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
onBeforeMount(props, state) { |
|
|
onBeforeMount(props, state) { |
|
|
state.validator = new Validator({ |
|
|
state.validator = new Validator({ |
|
|
title: { |
|
|
title: { |
|
@ -72,14 +82,22 @@ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* |
|
|
|
|
|
* |
|
|
|
|
|
* @param {[type]} key |
|
|
|
|
|
* @param {[type]} defaultClass |
|
|
|
|
|
* @return {[type]} |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
getClasses(key, defaultClass) { |
|
|
getClasses(key, defaultClass) { |
|
|
const classes = [ |
|
|
const classes = [ |
|
|
defaultClass |
|
|
defaultClass |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
console.log(this.state.validator) |
|
|
|
|
|
|
|
|
const errors = this.state.validator.errors(key) |
|
|
|
|
|
|
|
|
if (this.state.validator.errors(key).length > 0) { |
|
|
|
|
|
|
|
|
if (errors && errors.length > 0) { |
|
|
classes.push('is-danger') |
|
|
classes.push('is-danger') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|