Skip to content

Commit

Permalink
extract partials
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 committed Nov 6, 2017
1 parent 436525a commit fdea8bc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
28 changes: 28 additions & 0 deletions src/views/default/_form_body/component_details.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
$file_location = base_path('vendor/crocodicstudio/crudbooster/src/views/default/type_components/'.$type.'/component_detail.blade.php');
$user_location = resource_path('views/vendor/crudbooster/type_components/'.$type.'/component_detail.blade.php');
?>

@if(file_exists($file_location))
<?php $containTR = (substr(trim(file_get_contents($file_location)), 0, 4) == '<tr>') ? TRUE : FALSE;?>
@if($containTR)
@include('crudbooster::default.type_components.'.$type.'.component_detail')
@else
<tr>
<td>{{$label}}</td>
<td>@include('crudbooster::default.type_components.'.$type.'.component_detail')</td>
</tr>
@endif
@elseif(file_exists($user_location))
<?php $containTR = (substr(trim(file_get_contents($user_location)), 0, 4) == '<tr>') ? TRUE : FALSE;?>
@if($containTR)
@include('vendor.crudbooster.type_components.'.$type.'.component_detail')
@else
<tr>
<td>{{$label}}</td>
<td>@include('vendor.crudbooster.type_components.'.$type.'.component_detail')</td>
</tr>
@endif
@else
<!-- <tr><td colspan='2'>NO COMPONENT {{$type}}</td></tr> -->
@endif
34 changes: 2 additions & 32 deletions src/views/default/form_detail.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,38 +49,8 @@
$disabled = $formInput['disabled'] ? "disabled" : "";
$jquery = @$formInput['jquery'];
$placeholder = "placeholder='{$formInput['placeholder']}'";
$file_location = base_path('vendor/crocodicstudio/crudbooster/src/views/default/type_components/'.$type.'/component_detail.blade.php');
$user_location = resource_path('views/vendor/crudbooster/type_components/'.$type.'/component_detail.blade.php');
?>

@if(file_exists($file_location))
<?php $containTR = (substr(trim(file_get_contents($file_location)), 0, 4) == '<tr>') ? TRUE : FALSE;?>
@if($containTR)
@include('crudbooster::default.type_components.'.$type.'.component_detail')
@else
<tr>
<td>{{$label}}</td>
<td>@include('crudbooster::default.type_components.'.$type.'.component_detail')</td>
</tr>
@endif
@elseif(file_exists($user_location))
<?php $containTR = (substr(trim(file_get_contents($user_location)), 0, 4) == '<tr>') ? TRUE : FALSE;?>
@if($containTR)
@include('vendor.crudbooster.type_components.'.$type.'.component_detail')
@else
<tr>
<td>{{$label}}</td>
<td>@include('vendor.crudbooster.type_components.'.$type.'.component_detail')</td>
</tr>
@endif
@else
<!-- <tr><td colspan='2'>NO COMPONENT {{$type}}</td></tr> -->
@endif

?>
@include('crudbooster::default._form_body.component_details')

@endforeach

Expand Down
4 changes: 2 additions & 2 deletions src/views/default/type_components/child/component.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@if($col['type']=='text')
<input id='{{$name_column}}'
type='text'
{{ ($col['max'])?"maxlength='$col[max]'":"" }}
{{ ($col['max'])?"maxlength='{$col['max']}'":"" }}
name='child-{{$col["name"]}}'
class='form-control {{$col['required']?"required":""}}'
{{($col['readonly']===true)?"readonly":""}}
Expand All @@ -50,7 +50,7 @@ class='form-control {{$col['required']?"required":""}}'
@include('crudbooster::default.type_components.child.partials.dataModal', ['name' => $name, 'col' => $col])
@elseif($col['type']=='number')
<input id='{{$name_column}}' type='number'
{{ ($col['min'])?"min='$col[min]'":"" }} {{ ($col['max'])?"max='$col[max]'":"" }} name='child-{{$col["name"]}}'
{{ ($col['min'])?"min='$col[min]'":"" }} {{ ($col['max'])?"max='{$col['max']}'":"" }} name='child-{{$col["name"]}}'
class='form-control {{$col['required']?"required":""}}'
{{($col['readonly']===true)?"readonly":""}}
/>
Expand Down

0 comments on commit fdea8bc

Please sign in to comment.