Permalink
Browse files

Merge pull request #12 from dog-ears/edit_give_each_app_common_parts_…

…view

give each app common parts view
  • Loading branch information...
dog-ears committed May 30, 2016
2 parents 4a390e1 + dc96cff commit d18013ebcee7bd69ffb8c9d566504b386d6352e3
@@ -66,7 +66,7 @@ class ScaffoldMakeCommand extends Command
*
* @var array
*/
private $views = ['index', 'create', 'show', 'edit', 'duplicate', '_form'];
private $views = ['index', 'create', 'show', 'edit', 'duplicate', '_form', '_common'];
/**
* Store name from Model
@@ -166,7 +166,7 @@ private function makeViewLayout()
private function makeViews()
{
foreach ($this->views as $view) {
// index, create, show, edit, duplicate, _form
// index, create, show, edit, duplicate, _form, _common
new MakeView($this, $this->files, $view);
}
View
@@ -114,5 +114,29 @@ protected function start()
//output(use OutputTrait)
$this->outputReplace( $output_path, $output_filename, $pattern, $replacement, $debug=false );
//(v)navi - add2 --------------------------------------------------
//get_stub_path and filename
$stub_path = __DIR__.'/../Stubs/view_layout/';
$stub_filename = 'navi_add2.stub';
//create new stub
$stub = new StubController( $this->commandObj, $this->files, $stub_path.$stub_filename, $schema_repalce_type = null, $custom_replace = null );
//compile
$stub_compiled = $stub->getCompiled();
//get output_path and filename
$output_path = './resources/views/';
$output_filename = 'navi.blade.php';
//replace word
$pattern = '#({{-- include_area_app_common_end --}})#s';
$replacement = $stub_compiled.'\1';
//output(use OutputTrait)
$this->outputReplace( $output_path, $output_filename, $pattern, $replacement, $debug=false );
}
}
View
@@ -60,7 +60,8 @@ private function start()
'duplicate' => [ 'content_fields' => '', ],
'_form' => [
'content_fields' => (new SyntaxBuilder)->create($schemaArray, $this->commandObj->getMeta(), 'view-edit-content', true),
]
],
'_common' => []
];
//create new stub
@@ -0,0 +1,3 @@
@section('{{app_route}}AppTitle')
{{app_model_class}}
@endsection
@@ -1,15 +1,17 @@
@extends('layout')
@include('{{app_route}}._common')
@section('header')
<ol class="breadcrumb">
<li><a href="/"><span class="glyphicon glyphicon-home" aria-hidden="true"></span></a></li>
<li><a href="{{ route('{{app_route}}.index') }}">{{app_model_class}}</a></li>
<li><a href="{{ route('{{app_route}}.index') }}">@yield('{{app_route}}AppTitle')</a></li>
<li class="active">Create</li>
</ol>
<div class="page-header">
<h1><i class="glyphicon glyphicon-plus"></i> {{app_model_class}} / Create </h1>
<h1><i class="glyphicon glyphicon-plus"></i> @yield('{{app_route}}AppTitle') / Create </h1>
</div>
@endsection
@@ -1,15 +1,17 @@
@extends('layout')
@include('{{app_route}}._common')
@section('header')
<ol class="breadcrumb">
<li><a href="/"><span class="glyphicon glyphicon-home" aria-hidden="true"></span></a></li>
<li><a href="{{ route('{{app_route}}.index') }}">{{app_model_class}}</a></li>
<li><a href="{{ route('{{app_route}}.index') }}">@yield('{{app_route}}AppTitle')</a></li>
<li class="active">Duplicate</li>
</ol>
<div class="page-header">
<h1><i class="glyphicon glyphicon-duplicate"></i> {{app_model_class}} / Duplicate #{{${{app_model_var}}->id}}</h1>
<h1><i class="glyphicon glyphicon-duplicate"></i> @yield('{{app_route}}AppTitle') / Duplicate #{{${{app_model_var}}->id}}</h1>
</div>
@endsection
@@ -1,16 +1,18 @@
@extends('layout')
@include('{{app_route}}._common')
@section('header')
<ol class="breadcrumb">
<li><a href="/"><span class="glyphicon glyphicon-home" aria-hidden="true"></span></a></li>
<li><a href="{{ route('{{app_route}}.index') }}">{{app_model_class}}</a></li>
<li><a href="{{ route('{{app_route}}.index') }}">@yield('{{app_route}}AppTitle')</a></li>
<li><a href="{{ route('{{app_route}}.show', ${{app_model_var}}->id) }}">{{ ${{app_model_var}}->name }}</a></li>
<li class="active">Edit</li>
</ol>
<div class="page-header">
<h1><i class="glyphicon glyphicon-edit"></i> {{app_model_class}} / Edit #{{${{app_model_var}}->id}}</h1>
<h1><i class="glyphicon glyphicon-edit"></i> @yield('{{app_route}}AppTitle') / Edit #{{${{app_model_var}}->id}}</h1>
</div>
@endsection
@@ -1,13 +1,15 @@
@extends('layout')
@include('{{app_route}}._common')
@section('header')
<ol class="breadcrumb">
<li><a href="/"><span class="glyphicon glyphicon-home" aria-hidden="true"></span></a></li>
@if ( Request::input('q') )
{{-- */$query_params = Request::input('q')/* --}}
<li class="active"><a href="{{ route('{{app_route}}.index') }}">{{app_model_class}}</a></li>
<li class="active"><a href="{{ route('{{app_route}}.index') }}">@yield('{{app_route}}AppTitle')</a></li>
<li class="active">condition(
{{-- */ $loop = 0 /* --}}
@@ -17,14 +19,14 @@
@endforeach
)</li>
@else
<li class="active">{{app_model_class}}</li>
<li class="active">@yield('{{app_route}}AppTitle')</li>
@endif
</ol>
<div class="page-header clearfix">
<h1>
<i class="glyphicon glyphicon-align-justify"></i> {{app_model_class}}
<i class="glyphicon glyphicon-align-justify"></i> @yield('{{app_route}}AppTitle')
<a class="btn btn-success pull-right" href="{{ route('{{app_model_vars}}.create') }}"><i class="glyphicon glyphicon-plus"></i> Create</a>
</h1>
@@ -1,14 +1,17 @@
@extends('layout')
@include('{{app_route}}._common')
@section('header')
<ol class="breadcrumb">
<li><a href="/"><span class="glyphicon glyphicon-home" aria-hidden="true"></span></a></li>
<li><a href="{{ route('{{app_route}}.index') }}">{{app_model_class}}</a></li>
<li><a href="{{ route('{{app_route}}.index') }}">@yield('{{app_route}}AppTitle')</a></li>
<li class="active">{{ ${{app_model_var}}->name }}</li>
</ol>
<div class="page-header">
<h1>{{app_model_class}} / Show #{{${{app_model_var}}->id}}
<h1>@yield('{{app_route}}AppTitle') / Show #{{${{app_model_var}}->id}}
{!! Form::model(${{app_model_var}}, array('route' => array('{{app_route}}.destroy', ${{app_model_var}}->id),'method' => 'delete', 'style' => 'display: inline;', 'onsubmit'=> "if(confirm('Delete? Are you sure?')) { return true } else {return false };")) !!}
<div class="btn-group pull-right" role="group" aria-label="...">
@@ -1,3 +1,6 @@
{{-- include_area_app_common_start --}}
{{-- include_area_app_common_end --}}
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
@@ -1,2 +1,2 @@
<li{!! Request::is('{{app_route}}*') ? ' class="active"' : '' !!}><a href="/{{app_route}}/">{{app_model_class}}</a></li>{{-- generated by scaffold - {{app_model_class}} --}}
<li{!! Request::is('{{app_route}}*') ? ' class="active"' : '' !!}><a href="/{{app_route}}/">@yield('{{app_route}}AppTitle')</a></li>{{-- generated by scaffold - {{app_model_class}} --}}
@@ -0,0 +1 @@
@include('{{app_route}}._common'){{-- generated by scaffold - {{app_model_class}} --}}

0 comments on commit d18013e

Please sign in to comment.