14 changed files with 516 additions and 194 deletions
-
23src/stubs/resources/views/full/create-formfield.stub
-
21src/stubs/resources/views/full/create.stub
-
56src/stubs/resources/views/full/edit-formfield.stub
-
42src/stubs/resources/views/full/edit.stub
-
58src/stubs/resources/views/full/index-formfield.stub
-
22src/stubs/resources/views/full/index.stub
-
25src/stubs/resources/views/full/show-formfield.stub
-
4src/stubs/resources/views/full/show.stub
-
63src/stubs/resources/views/simple/forms-formfield.stub
-
76src/stubs/resources/views/simple/forms.stub
-
63src/stubs/resources/views/simple/index-formfield.stub
-
22src/stubs/resources/views/simple/index.stub
-
98tests/Generators/Simple/ViewsGeneratorTest.php
-
89tests/Generators/ViewsGeneratorTest.php
@ -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 |
||||
@ -0,0 +1,56 @@ |
|||||
|
@extends('layouts.app') |
||||
|
|
||||
|
@section('title', __('master.edit')) |
||||
|
|
||||
|
@section('content') |
||||
|
<div class="row"> |
||||
|
<div class="col-md-6 col-md-offset-3"> |
||||
|
@if (request('action') == 'delete' && $singleMstr) |
||||
|
@can('delete', $singleMstr) |
||||
|
<div class="panel panel-default"> |
||||
|
<div class="panel-heading"><h3 class="panel-title">{{ __('master.delete') }}</h3></div> |
||||
|
<div class="panel-body"> |
||||
|
<label class="control-label">{{ __('master.name') }}</label> |
||||
|
<p>{{ $singleMstr->name }}</p> |
||||
|
<label class="control-label">{{ __('master.description') }}</label> |
||||
|
<p>{{ $singleMstr->description }}</p> |
||||
|
{!! $errors->first('master_id', '<span class="form-error small">:message</span>') !!} |
||||
|
</div> |
||||
|
<hr style="margin:0"> |
||||
|
<div class="panel-body">{{ __('master.delete_confirm') }}</div> |
||||
|
<div class="panel-footer"> |
||||
|
{!! FormField::delete( |
||||
|
['route' => ['masters.destroy', $singleMstr]], |
||||
|
__('app.delete_confirm_button'), |
||||
|
['class'=>'btn btn-danger'], |
||||
|
[ |
||||
|
'master_id' => $singleMstr->id, |
||||
|
'page' => request('page'), |
||||
|
'q' => request('q'), |
||||
|
] |
||||
|
) !!} |
||||
|
{{ link_to_route('masters.edit', __('app.cancel'), [$singleMstr], ['class' => 'btn btn-default']) }} |
||||
|
</div> |
||||
|
</div> |
||||
|
@endcan |
||||
|
@else |
||||
|
<div class="panel panel-default"> |
||||
|
<div class="panel-heading"><h3 class="panel-title">{{ __('master.edit') }}</h3></div> |
||||
|
{!! Form::model($singleMstr, ['route' => ['masters.update', $singleMstr],'method' => 'patch']) !!} |
||||
|
<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.update'), ['class' => 'btn btn-success']) !!} |
||||
|
{{ link_to_route('masters.show', __('app.cancel'), [$singleMstr], ['class' => 'btn btn-default']) }} |
||||
|
@can('delete', $singleMstr) |
||||
|
{{ link_to_route('masters.edit', __('app.delete'), [$singleMstr, 'action' => 'delete'], ['class' => 'btn btn-danger pull-right', 'id' => 'del-master-'.$singleMstr->id]) }} |
||||
|
@endcan |
||||
|
</div> |
||||
|
{!! Form::close() !!} |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endif |
||||
|
@endsection |
||||
@ -0,0 +1,58 @@ |
|||||
|
@extends('layouts.app') |
||||
|
|
||||
|
@section('title', __('master.list')) |
||||
|
|
||||
|
@section('content') |
||||
|
<h1 class="page-header"> |
||||
|
<div class="pull-right"> |
||||
|
@can('create', new fullMstr) |
||||
|
{{ link_to_route('masters.create', __('master.create'), [], ['class' => 'btn btn-success']) }} |
||||
|
@endcan |
||||
|
</div> |
||||
|
{{ __('master.list') }} |
||||
|
<small>{{ __('app.total') }} : {{ $mstrCollections->total() }} {{ __('master.master') }}</small> |
||||
|
</h1> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-12"> |
||||
|
<div class="panel panel-default table-responsive"> |
||||
|
<div class="panel-heading"> |
||||
|
{{ Form::open(['method' => 'get','class' => 'form-inline']) }} |
||||
|
{!! FormField::text('q', ['label' => __('master.search'), 'placeholder' => __('master.search_text'), 'class' => 'input-sm']) !!} |
||||
|
{{ Form::submit(__('master.search'), ['class' => 'btn btn-sm']) }} |
||||
|
{{ link_to_route('masters.index', __('app.reset')) }} |
||||
|
{{ Form::close() }} |
||||
|
</div> |
||||
|
<table class="table table-condensed"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th class="text-center">{{ __('app.table_no') }}</th> |
||||
|
<th>{{ __('master.name') }}</th> |
||||
|
<th>{{ __('master.description') }}</th> |
||||
|
<th class="text-center">{{ __('app.action') }}</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
@foreach($mstrCollections as $key => $singleMstr) |
||||
|
<tr> |
||||
|
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td> |
||||
|
<td>{{ $singleMstr->name_link }}</td> |
||||
|
<td>{{ $singleMstr->description }}</td> |
||||
|
<td class="text-center"> |
||||
|
@can('view', $singleMstr) |
||||
|
{!! link_to_route( |
||||
|
'masters.show', |
||||
|
__('app.show'), |
||||
|
[$singleMstr], |
||||
|
['class' => 'btn btn-default btn-xs', 'id' => 'show-master-' . $singleMstr->id] |
||||
|
) !!} |
||||
|
@endcan |
||||
|
</td> |
||||
|
</tr> |
||||
|
@endforeach |
||||
|
</tbody> |
||||
|
</table> |
||||
|
<div class="panel-body">{{ $mstrCollections->appends(Request::except('page'))->render() }}</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
||||
@ -0,0 +1,25 @@ |
|||||
|
@extends('layouts.app') |
||||
|
|
||||
|
@section('title', __('master.detail')) |
||||
|
|
||||
|
@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.detail') }}</h3></div> |
||||
|
<table class="table table-condensed"> |
||||
|
<tbody> |
||||
|
<tr><td>{{ __('master.name') }}</td><td>{{ $singleMstr->name }}</td></tr> |
||||
|
<tr><td>{{ __('master.description') }}</td><td>{{ $singleMstr->description }}</td></tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
<div class="panel-footer"> |
||||
|
@can('update', $singleMstr) |
||||
|
{{ link_to_route('masters.edit', __('master.edit'), [$singleMstr], ['class' => 'btn btn-warning', 'id' => 'edit-master-'.$singleMstr->id]) }} |
||||
|
@endcan |
||||
|
{{ link_to_route('masters.index', __('master.back_to_index'), [], ['class' => 'btn btn-default']) }} |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
||||
@ -0,0 +1,63 @@ |
|||||
|
@if (Request::get('action') == 'create') |
||||
|
@can('create', new fullMstr) |
||||
|
{{ Form::open(['route' => 'masters.store']) }} |
||||
|
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} |
||||
|
{!! FormField::textarea('description', ['label' => __('master.description')]) !!} |
||||
|
{{ Form::submit(__('master.create'), ['class' => 'btn btn-success']) }} |
||||
|
{{ link_to_route('masters.index', __('app.cancel'), [], ['class' => 'btn btn-default']) }} |
||||
|
{{ Form::close() }} |
||||
|
@endcan |
||||
|
@endif |
||||
|
@if (Request::get('action') == 'edit' && $editableMaster) |
||||
|
@can('update', $editableMaster) |
||||
|
{{ Form::model($editableMaster, ['route' => ['masters.update', $editableMaster], 'method' => 'patch']) }} |
||||
|
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!} |
||||
|
{!! FormField::textarea('description', ['label' => __('master.description')]) !!} |
||||
|
@if (request('q')) |
||||
|
{{ Form::hidden('q', request('q')) }} |
||||
|
@endif |
||||
|
@if (request('page')) |
||||
|
{{ Form::hidden('page', request('page')) }} |
||||
|
@endif |
||||
|
{{ Form::submit(__('master.update'), ['class' => 'btn btn-success']) }} |
||||
|
{{ link_to_route('masters.index', __('app.cancel'), Request::only('page', 'q'), ['class' => 'btn btn-default']) }} |
||||
|
@can('delete', $editableMaster) |
||||
|
{{ link_to_route( |
||||
|
'masters.index', |
||||
|
__('app.delete'), |
||||
|
['action' => 'delete', 'id' => $editableMaster->id] + Request::only('page', 'q'), |
||||
|
['id' => 'del-master-'.$editableMaster->id, 'class' => 'btn btn-danger pull-right'] |
||||
|
) }} |
||||
|
@endcan |
||||
|
{{ Form::close() }} |
||||
|
@endcan |
||||
|
@endif |
||||
|
@if (Request::get('action') == 'delete' && $editableMaster) |
||||
|
@can('delete', $editableMaster) |
||||
|
<div class="panel panel-default"> |
||||
|
<div class="panel-heading"><h3 class="panel-title">{{ __('master.delete') }}</h3></div> |
||||
|
<div class="panel-body"> |
||||
|
<label class="control-label">{{ __('master.name') }}</label> |
||||
|
<p>{{ $editableMaster->name }}</p> |
||||
|
<label class="control-label">{{ __('master.description') }}</label> |
||||
|
<p>{{ $editableMaster->description }}</p> |
||||
|
{!! $errors->first('master_id', '<span class="form-error small">:message</span>') !!} |
||||
|
</div> |
||||
|
<hr style="margin:0"> |
||||
|
<div class="panel-body">{{ __('master.delete_confirm') }}</div> |
||||
|
<div class="panel-footer"> |
||||
|
{!! FormField::delete( |
||||
|
['route' => ['masters.destroy', $editableMaster]], |
||||
|
__('app.delete_confirm_button'), |
||||
|
['class'=>'btn btn-danger'], |
||||
|
[ |
||||
|
'master_id' => $editableMaster->id, |
||||
|
'page' => request('page'), |
||||
|
'q' => request('q'), |
||||
|
] |
||||
|
) !!} |
||||
|
{{ link_to_route('masters.index', __('app.cancel'), Request::only('page', 'q'), ['class' => 'btn btn-default']) }} |
||||
|
</div> |
||||
|
</div> |
||||
|
@endcan |
||||
|
@endif |
||||
@ -0,0 +1,63 @@ |
|||||
|
@extends('layouts.app') |
||||
|
|
||||
|
@section('title', __('master.list')) |
||||
|
|
||||
|
@section('content') |
||||
|
<h1 class="page-header"> |
||||
|
<div class="pull-right"> |
||||
|
@can('create', new fullMstr) |
||||
|
{{ link_to_route('masters.index', __('master.create'), ['action' => 'create'], ['class' => 'btn btn-success']) }} |
||||
|
@endcan |
||||
|
</div> |
||||
|
{{ __('master.list') }} |
||||
|
<small>{{ __('app.total') }} : {{ $mstrCollections->total() }} {{ __('master.master') }}</small> |
||||
|
</h1> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-8"> |
||||
|
<div class="panel panel-default table-responsive"> |
||||
|
<div class="panel-heading"> |
||||
|
{{ Form::open(['method' => 'get', 'class' => 'form-inline']) }} |
||||
|
{!! FormField::text('q', ['label' => __('master.search'), 'placeholder' => __('master.search_text'), 'class' => 'input-sm']) !!} |
||||
|
{{ Form::submit(__('master.search'), ['class' => 'btn btn-sm']) }} |
||||
|
{{ link_to_route('masters.index', __('app.reset')) }} |
||||
|
{{ Form::close() }} |
||||
|
</div> |
||||
|
<table class="table table-condensed"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th class="text-center">{{ __('app.table_no') }}</th> |
||||
|
<th>{{ __('master.name') }}</th> |
||||
|
<th>{{ __('master.description') }}</th> |
||||
|
<th class="text-center">{{ __('app.action') }}</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
@foreach($mstrCollections as $key => $singleMstr) |
||||
|
<tr> |
||||
|
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td> |
||||
|
<td>{{ $singleMstr->name }}</td> |
||||
|
<td>{{ $singleMstr->description }}</td> |
||||
|
<td class="text-center"> |
||||
|
@can('update', $singleMstr) |
||||
|
{!! link_to_route( |
||||
|
'masters.index', |
||||
|
__('app.edit'), |
||||
|
['action' => 'edit', 'id' => $singleMstr->id] + Request::only('page', 'q'), |
||||
|
['id' => 'edit-master-'.$singleMstr->id] |
||||
|
) !!} |
||||
|
@endcan |
||||
|
</td> |
||||
|
</tr> |
||||
|
@endforeach |
||||
|
</tbody> |
||||
|
</table> |
||||
|
<div class="panel-body">{{ $mstrCollections->appends(Request::except('page'))->render() }}</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-md-4"> |
||||
|
@if(Request::has('action')) |
||||
|
@include('masters.forms') |
||||
|
@endif |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue