diff --git a/app/helpers.php b/app/helpers.php index 001bee4..a7588c1 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -32,41 +32,6 @@ function formatDecimal($number) return number_format($number, 2, ',', '.'); } -/** - * Delete button. - * - * @param array $form_params Delete form attribute - * @param string $button_label Button text - * @param array $button_options Button option - * - * @return string Delete Button Form - */ -function delete_button($form_params = [], $button_label = 'Delete', $button_options = [], $hiddenFields = []) -{ - $form_params['method'] = 'delete'; - $form_params['class'] = isset($form_params['class']) ? $form_params['class'] : 'del-form'; - $form_params['style'] = isset($form_params['style']) ? $form_params['style'] : 'display:inline'; - - if (!isset($button_options['class'])) { - $button_options['class'] = 'pull-right'; - } - - if (!isset($button_options['title'])) { - $button_options['title'] = 'Delete this record'; - } - - $htmlForm = Form::open($form_params); - if (!empty($hiddenFields)) { - foreach ($hiddenFields as $k => $v) { - $htmlForm .= Form::hidden($k, $v); - } - } - $htmlForm .= Form::submit($button_label, $button_options); - $htmlForm .= Form::close(); - - return $htmlForm; -} - function formatDate($date) { if (!$date || $date == '0000-00-00') { diff --git a/resources/views/options/index.blade.php b/resources/views/options/index.blade.php index cfcbfc3..a0c0250 100755 --- a/resources/views/options/index.blade.php +++ b/resources/views/options/index.blade.php @@ -1,22 +1,20 @@ @extends('layouts.app') @section('content') -

- {{ trans('option.options') }} -

+
- {!! Form::open(['route'=>'options.save', 'method'=>'patch']) !!} + {!! Form::open(['route' => 'options.save', 'method' => 'patch']) !!} @forelse($options as $option) - + @empty @@ -26,7 +24,7 @@
{{ str_split_ucwords($option->key) }} - {!! link_to_route('options.index', 'x', ['id' => $option->id,'action' => 'del'], ['class'=>'btn btn-danger btn-xs pull-right']) !!} + {{ link_to_route('options.index', 'x', ['id' => $option->id,'action' => 'del'], ['class' => 'btn btn-danger btn-xs pull-right']) }} {!! Form::textarea($option->key, $option->value, ['class'=>'form-control','rows'=>3]) !!}{!! Form::textarea($option->key, $option->value, ['class' => 'form-control','rows' => 3]) !!}
- {!! Form::submit(trans('app.update'), ['class'=>'btn btn-warning']) !!} + {!! Form::submit(trans('app.update'), ['class' => 'btn btn-warning']) !!}
{!! Form::close() !!}
@@ -39,25 +37,25 @@

{{ trans('app.delete_confirm') }}

- +
{{ str_split_ucwords($editableOption->key) }}{{ $editableOption->value }}
{{ str_split_ucwords($editableOption->key) }}{{ $editableOption->value }}
@endif - {!! Form::open(['route'=>'options.store']) !!} + {!! Form::open(['route' => 'options.store']) !!}
-

Option Data

+

{{ trans('option.create') }}

{!! FormField::text('key') !!} {!! FormField::textarea('value') !!}
{!! Form::close() !!} diff --git a/resources/views/projects/delete.blade.php b/resources/views/projects/delete.blade.php index 19e34e9..5bed75b 100755 --- a/resources/views/projects/delete.blade.php +++ b/resources/views/projects/delete.blade.php @@ -5,7 +5,7 @@ @section('content')

- {!! delete_button(['route'=>['projects.destroy',$project->id]], trans('app.delete_confirm_button'), ['class'=>'btn btn-danger'], ['project_id'=>$project->id]) !!} + {!! FormField::delete(['route'=>['projects.destroy',$project->id]], trans('app.delete_confirm_button'), ['class'=>'btn btn-danger'], ['project_id'=>$project->id]) !!}
{{ trans('app.delete_confirm') }} {!! link_to_route('projects.show', trans('app.cancel'), [$project->id], ['class' => 'btn btn-default']) !!} @@ -15,4 +15,4 @@ @include('projects.partials.project-show') -@endsection \ No newline at end of file +@endsection