FEATURE #1368: add form for creating new custom field

Currently, form is not saved, however it is validated.
This commit is contained in:
Michal Kváček
2016-01-25 18:59:31 +01:00
parent 4261362ea1
commit 3c8eb3c3f1
8 changed files with 163 additions and 8 deletions
+14 -4
View File
@@ -1,7 +1,17 @@
<?php
return [
'overview' => 'List of all custom fields',
'noFields' => 'No custom fields defined.',
'users' => 'Custom fields for user',
'content' => 'Custom fields for content page',
'overview' => 'List of all custom fields',
'new' => 'New custom field',
'noFields' => 'No custom fields defined.',
'users' => 'Custom fields for user',
'content' => 'Custom fields for content page',
'name' => 'Name',
'description' => 'Description',
'type' => 'Type of custom field',
'required' => 'Is field required?',
'defaultValue' => 'Default value',
'regExp' => 'Match only this regular expression',
'minLength' => 'Minimum length',
'maxLength' => 'Maximum length',
'createNew' => 'Create new field'
];
+2 -1
View File
@@ -7,6 +7,7 @@ return [
'usersOverview' => 'Overview',
'userDetail' => 'Detail',
'customFields' => 'Custom fields',
'customFieldsOverview' => 'Overvview',
'customFieldsOverview' => 'Overview',
'customFieldsNew' => 'New field',
'settings' => 'Settings'
];
@@ -0,0 +1,15 @@
@extends('admin.layout')
@section('pageName', @trans('admin/customFields.new'))
@section('content')
<div class="row">
<h2>@lang('admin/customFields.new')</h2>
</div>
<div class="row">
@include('admin.customFields.newForm')
</div>
@stop
@@ -0,0 +1,79 @@
<form method="POST" action="{{route('customfields.newPost')}}">
{!! csrf_field() !!}
<div class="row">
<div class="large-6 columns">
<label>
@lang('admin/customFields.name')
<input type="text" placeholder="@lang('admin/customFields.name')" name="name">
@if (isset($errors) && $errors->has('name'))
<div class="callout alert">
{{ $errors->first('name') }}
</div>
@endif
</label>
</div>
<div class="large-6 columns">
<label>
@lang('admin/customFields.type')
<select name="type">
@foreach($types as $type => $translation)
<option value="{{$type}}">@lang($translation)</option>
@endforeach
</select>
</label>
</div>
</div>
<div class="row">
<div class="large-6 columns">
<label>
@lang('admin/customFields.description')
<textarea rows="5" name="description" placeholder="@lang('admin/customFields.description')"></textarea>
</label>
</div>
<div class="large-6 columns">
<label>
@lang('admin/customFields.required')
<input type="checkbox" placeholder="@lang('admin/customFields.required')" name="required">
</label>
<label>
@lang('admin/customFields.defaultValue')
<input type="text" placeholder=" @lang('admin/customFields.defaultValue')" defaultValue">
</label>
<label>
@lang('admin/customFields.regExp')
<input type="text" placeholder="@lang('admin/customFields.regExp')" name="regExp">
</label>
</div>
</div>
<div class="row">
<div class="large-6 columns">
<label>
@lang('admin/customFields.minLength')
<input type="text" placeholder="@lang('admin/customFields.minLength')"name="minLength">
</label>
</div>
<div class="large-6 columns">
<label>
@lang('admin/customFields.maxLength')
<input type="text" placeholder="@lang('admin/customFields.maxLength')"name="maxLength">
</label>
</div>
</div>
<label>
<button type="submit" class="button success">@lang('admin/customFields.createNew')</button>
</label>
</form>