Browse Source

Update cancel button to have query strings

The cancel button will returns user to exact same page
even if they have search query or paginate pages
tags/1.1.2
Nafies Luthfi 8 years ago
parent
commit
f4245386fb
  1. 4
      src/stubs/view-forms.stub
  2. 4
      tests/Generators/Simple/ViewsGeneratorTest.php

4
src/stubs/view-forms.stub

@ -20,7 +20,7 @@
{{ Form::hidden('page', request('page')) }}
@endif
{!! Form::submit(trans('master.update'), ['class' => 'btn btn-success']) !!}
{{ link_to_route('masters.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }}
{{ link_to_route('masters.index', trans('app.cancel'), Request::only('page', 'q'), ['class' => 'btn btn-default']) }}
@can('delete', $singleMstr)
{!! link_to_route(
'masters.index',
@ -56,7 +56,7 @@
'q' => request('q'),
]
) !!}
{{ link_to_route('masters.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }}
{{ link_to_route('masters.index', trans('app.cancel'), Request::only('page', 'q'), ['class' => 'btn btn-default']) }}
</div>
</div>
@endcan

4
tests/Generators/Simple/ViewsGeneratorTest.php

@ -110,7 +110,7 @@ class ViewsGeneratorTest extends TestCase
{{ Form::hidden('page', request('page')) }}
@endif
{!! Form::submit(trans('{$this->lang_name}.update'), ['class' => 'btn btn-success']) !!}
{{ link_to_route('{$this->table_name}.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }}
{{ link_to_route('{$this->table_name}.index', trans('app.cancel'), Request::only('page', 'q'), ['class' => 'btn btn-default']) }}
@can('delete', \${$this->single_model_var_name})
{!! link_to_route(
'{$this->table_name}.index',
@ -146,7 +146,7 @@ class ViewsGeneratorTest extends TestCase
'q' => request('q'),
]
) !!}
{{ link_to_route('{$this->table_name}.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }}
{{ link_to_route('{$this->table_name}.index', trans('app.cancel'), Request::only('page', 'q'), ['class' => 'btn btn-default']) }}
</div>
</div>
@endcan

Loading…
Cancel
Save