Browse Source

Remove FormField on full CRUD create form

Move FormFieldversion of create form to new stub file
tags/1.2.0
Nafies Luthfi 7 years ago
parent
commit
dc1d4ddf16
  1. 23
      src/stubs/resources/views/full/create-formfield.stub
  2. 29
      src/stubs/resources/views/full/create.stub
  3. 29
      tests/Generators/ViewsGeneratorTest.php

23
src/stubs/resources/views/full/create-formfield.stub

@ -0,0 +1,23 @@
@extends('layouts.app')
@section('title', __('master.create'))
@section('content')
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ __('master.create') }}</h3></div>
{!! Form::open(['route' => 'masters.store']) !!}
<div class="panel-body">
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
</div>
<div class="panel-footer">
{!! Form::submit(__('master.create'), ['class' => 'btn btn-success']) !!}
{{ link_to_route('masters.index', __('app.cancel'), [], ['class' => 'btn btn-default']) }}
</div>
{!! Form::close() !!}
</div>
</div>
</div>
@endsection

29
src/stubs/resources/views/full/create.stub

@ -7,16 +7,25 @@
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ __('master.create') }}</h3></div>
{!! Form::open(['route' => 'masters.store']) !!}
<div class="panel-body">
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
</div>
<div class="panel-footer">
{!! Form::submit(__('master.create'), ['class' => 'btn btn-success']) !!}
{{ link_to_route('masters.index', __('app.cancel'), [], ['class' => 'btn btn-default']) }}
</div>
{!! Form::close() !!}
<form method="POST" action="{{ route('masters.store') }}" accept-charset="UTF-8">
{{ csrf_field() }}
<div class="panel-body">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="control-label">{{ __('master.name') }}</label>
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required>
{!! $errors->first('name', '<span class="help-block small">:message</span>') !!}
</div>
<div class="form-group{{ $errors->has('description') ? ' has-error' : '' }}">
<label for="description" class="control-label">{{ __('master.description') }}</label>
<textarea id="description" type="text" class="form-control" name="description" rows="4">{{ old('description') }}</textarea>
{!! $errors->first('description', '<span class="help-block small">:message</span>') !!}
</div>
</div>
<div class="panel-footer">
<input type="submit" value="{{ __('master.create') }}" class="btn btn-success">
<a href="{{ route('masters.index') }}" class="btn btn-default">{{ __('app.cancel') }}</a>
</div>
</form>
</div>
</div>
</div>

29
tests/Generators/ViewsGeneratorTest.php

@ -128,16 +128,25 @@ class ViewsGeneratorTest extends TestCase
<div class=\"col-md-6 col-md-offset-3\">
<div class=\"panel panel-default\">
<div class=\"panel-heading\"><h3 class=\"panel-title\">{{ __('{$this->lang_name}.create') }}</h3></div>
{!! Form::open(['route' => '{$this->table_name}.store']) !!}
<div class=\"panel-body\">
{!! FormField::text('name', ['required' => true, 'label' => __('{$this->lang_name}.name')]) !!}
{!! FormField::textarea('description', ['label' => __('{$this->lang_name}.description')]) !!}
</div>
<div class=\"panel-footer\">
{!! Form::submit(__('{$this->lang_name}.create'), ['class' => 'btn btn-success']) !!}
{{ link_to_route('{$this->table_name}.index', __('app.cancel'), [], ['class' => 'btn btn-default']) }}
</div>
{!! Form::close() !!}
<form method=\"POST\" action=\"{{ route('{$this->table_name}.store') }}\" accept-charset=\"UTF-8\">
{{ csrf_field() }}
<div class=\"panel-body\">
<div class=\"form-group{{ \$errors->has('name') ? ' has-error' : '' }}\">
<label for=\"name\" class=\"control-label\">{{ __('{$this->lang_name}.name') }}</label>
<input id=\"name\" type=\"text\" class=\"form-control\" name=\"name\" value=\"{{ old('name') }}\" required>
{!! \$errors->first('name', '<span class=\"help-block small\">:message</span>') !!}
</div>
<div class=\"form-group{{ \$errors->has('description') ? ' has-error' : '' }}\">
<label for=\"description\" class=\"control-label\">{{ __('{$this->lang_name}.description') }}</label>
<textarea id=\"description\" type=\"text\" class=\"form-control\" name=\"description\" rows=\"4\">{{ old('description') }}</textarea>
{!! \$errors->first('description', '<span class=\"help-block small\">:message</span>') !!}
</div>
</div>
<div class=\"panel-footer\">
<input type=\"submit\" value=\"{{ __('{$this->lang_name}.create') }}\" class=\"btn btn-success\">
<a href=\"{{ route('{$this->table_name}.index') }}\" class=\"btn btn-default\">{{ __('app.cancel') }}</a>
</div>
</form>
</div>
</div>
</div>

Loading…
Cancel
Save