Make delete routes work. (#3077)

* Make delete routes work.  We put a little form in the modal that spoofs the delete field.

* Fix route on creating a user.

* Fix redundant id parameter.

* Port acceptance tests to new urls.
This commit is contained in:
Daniel Meltzer 2016-12-19 12:42:33 -06:00 committed by snipe
parent c7e98366be
commit ae2cb5fe68
25 changed files with 49 additions and 5798 deletions

View file

@ -471,7 +471,7 @@ class AssetsController extends Controller
* @since [v1.0]
* @return Redirect
*/
public function getDelete($assetId)
public function destroy($assetId)
{
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {

View file

@ -988,7 +988,7 @@ class LicensesController extends Controller
}
if (Gate::allows('licenses.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'
. route('hardware.destroy', $license->id)
. route('licenses.destroy', $license->id)
. '" data-content="' . trans('admin/licenses/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($license->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
}
$actions .='</span>';

View file

@ -172,7 +172,7 @@ class UsersController extends Controller
$m->subject(trans('mail.welcome', ['name' => $user->first_name]));
});
}
return redirect::route('users')->with('success', trans('admin/users/message.success.create'));
return redirect::route('users.index')->with('success', trans('admin/users/message.success.create'));
}
return redirect()->back()->withInput()->withErrors($user->getErrors());

View file

@ -9,6 +9,7 @@
"gulp": "^3.9.1",
"jquery": "^3.1.0",
"laravel-elixir": "^6.0.0-11",
"laravel-elixir-codeception-standalone": "^0.1.0",
"laravel-elixir-vue-2": "^0.2.0",
"laravel-elixir-webpack-official": "^1.0.2",
"lodash": "^4.16.2",

View file

@ -34276,7 +34276,7 @@ var pieOptions = {
$('#myModalLabel').text(title);
$dataConfirmModal.find('.modal-body').text(message);
$('#dataConfirmOK').attr('href', href);
$('#deleteForm').attr('action', href);
$dataConfirmModal.modal({
show: true
});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -34276,7 +34276,7 @@ var pieOptions = {
$('#myModalLabel').text(title);
$dataConfirmModal.find('.modal-body').text(message);
$('#dataConfirmOK').attr('href', href);
$('#deleteForm').attr('action', href);
$dataConfirmModal.modal({
show: true
});

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
{
"assets/css/app.css": "assets/css/app-0979ad0cf2.css",
"assets/js/all.js": "assets/js/all-346c20ce47.js"
"assets/js/all.js": "assets/js/all-7289d0f397.js"
}

View file

@ -63,7 +63,7 @@ var pieOptions = {
$('#myModalLabel').text(title);
$dataConfirmModal.find('.modal-body').text(message);
$('#dataConfirmOK').attr('href', href);
$('#deleteForm').attr('action', href);
$dataConfirmModal.modal({
show: true
});

View file

@ -609,8 +609,12 @@
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<form method="post" id="deleteForm" role="form">
{{ csrf_field() }}
{{ method_field('DELETE') }}
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
<a class="btn btn-outline" id="dataConfirmOK">@lang('general.yes')</a>
<button type="submit" class="btn btn-outline" id="dataConfirmOK">@lang('general.yes')</button>
</form>
</div>
</div>
</div>

View file

@ -72,7 +72,7 @@
<div class="col-md-8 col-md-offset-2">
<form class="form-horizontal" method="post" autocomplete="off" action="{{ ($user) ? route('users.update', ['user' => $user->id->id]) : route('users.store') }}" id="userForm">
<form class="form-horizontal" method="post" autocomplete="off" action="{{ ($user) ? route('users.update', ['user' => $user->id]) : route('users.store') }}" id="userForm">
<!-- CSRF Token -->
<input type="hidden" name="_token" value="{{ csrf_token() }}">

View file

@ -5,12 +5,12 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure that the accessories listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/accessories');
$I->amOnPage('/accessories');
$I->waitForElement('.table', 5); // secs
$I->seeNumberOfElements('table[name="accessories"] tr', [5,30]);
$I->seeInTitle('Accessories');
$I->see('Accessories');
$I->seeInPageSource('admin/accessories/create');
$I->seeInPageSource('accessories/create');
$I->dontSee('Accessories', '.page-header');
$I->see('Accessories', 'h1.pull-left');
@ -18,7 +18,7 @@ $I->see('Accessories', 'h1.pull-left');
$I->wantTo('ensure that the create accessories form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->click(['link' => 'Create New']);
$I->amOnPage('/admin/accessories/create');
$I->amOnPage('/accessories/create');
$I->dontSee('Create Accessory', '.page-header');
$I->see('Create Accessory', 'h1.pull-left');
$I->dontSee('&lt;span class=&quot;');

View file

@ -4,12 +4,12 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure that the categories listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/settings/categories');
$I->amOnPage('/categories');
$I->waitForElement('.table', 5); // secs
$I->seeNumberOfElements('table[name="categories"] tr', [5,30]);
$I->seeInTitle('Categories');
$I->see('Categories');
$I->seeInPageSource('admin/settings/categories/create');
$I->seeInPageSource('/categories/create');
$I->dontSee('Categories', '.page-header');
$I->see('Categories', 'h1.pull-left');
@ -17,7 +17,7 @@ $I->see('Categories', 'h1.pull-left');
$I->wantTo('ensure that the create category form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->click(['link' => 'Create New']);
$I->amOnPage('/admin/settings/categories/create');
$I->amOnPage('/categories/create');
$I->dontSee('Create Category', '.page-header');
$I->see('Create Category', 'h1.pull-left');
$I->dontSee('&lt;span class=&quot;');

View file

@ -5,12 +5,12 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure that the company listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/settings/companies');
$I->amOnPage('/companies');
$I->waitForElement('.table', 5); // secs
$I->seeNumberOfElements('table[name="companies"] tr', [5,30]);
$I->seeInTitle('Companies');
$I->see('Companies');
$I->seeInPageSource('admin/settings/companies/create');
$I->seeInPageSource('companies/create');
$I->dontSee('Companies', '.page-header');
$I->see('Companies', 'h1.pull-left');
@ -18,7 +18,7 @@ $I->see('Companies', 'h1.pull-left');
$I->wantTo('ensure that the create company form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->click(['link' => 'Create New']);
$I->amOnPage('/admin/settings/companies/create');
$I->amOnPage('/companies/create');
$I->dontSee('Create Company', '.page-header');
$I->see('Create Company', 'h1.pull-left');
$I->dontSee('&lt;span class=&quot;');

View file

@ -4,12 +4,12 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure that the consumables listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/consumables');
$I->amOnPage('/consumables');
$I->waitForElement('.table', 5); // secs
$I->seeNumberOfElements('table[name="consumables"] tr', [5,30]);
$I->seeInTitle('Consumables');
$I->see('Consumables');
$I->seeInPageSource('admin/consumables/create');
$I->seeInPageSource('/consumables/create');
$I->dontSee('Consumables', '.page-header');
$I->see('Consumables', 'h1.pull-left');
@ -17,7 +17,7 @@ $I->see('Consumables', 'h1.pull-left');
$I->wantTo('ensure that the create consumables form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->click(['link' => 'Create New']);
$I->amOnPage('/admin/consumables/create');
$I->amOnPage('/consumables/create');
$I->dontSee('Create Consumable', '.page-header');
$I->see('Create Consumable', 'h1.pull-left');
$I->dontSee('&lt;span class=&quot;');

View file

@ -4,10 +4,10 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure that the custom fields page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/custom_fields');
$I->amOnPage('/fields');
$I->seeInTitle('Custom Fields');
$I->see('Custom Fields');
$I->seeInPageSource('admin/custom_fields/create');
$I->seeInPageSource('/fields/create');
$I->dontSee('Custom Fields', '.page-header');
$I->dontSee('Fieldsets', '.page-header');
$I->see('Manage Custom Fields', 'h1.pull-left');

View file

@ -5,11 +5,11 @@ $I->am('logged in user');
$I->wantTo('ensure that depreciations page loads without errors');
$I->amGoingTo('go to the depreciations listing page');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/settings/depreciations');
$I->amOnPage('/depreciations');
$I->seeInTitle('Depreciations');
$I->waitForElement('.table', 5); // secs
$I->seeNumberOfElements('table[name="depreciations"] tbody tr', 1);
$I->seeInPageSource('/admin/settings/depreciations/create');
$I->seeNumberOfElements('table[name="depreciations"] tbody tr', [1,5]);
$I->seeInPageSource('/depreciations/create');
$I->dontSee('Depreciations', '.page-header');
$I->see('Depreciations', 'h1.pull-left');
@ -17,7 +17,7 @@ $I->see('Depreciations', 'h1.pull-left');
$I->wantTo('ensure that the create depreciation form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->click(['link' => 'Create New']);
$I->amOnPage('/admin/settings/depreciations/create');
$I->amOnPage('/depreciations/create');
$I->seeInTitle('Create Depreciation');
$I->dontSee('Create Depreciation', '.page-header');
$I->see('Create Depreciation', 'h1.pull-left');

View file

@ -4,12 +4,12 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure that the locations listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/settings/locations');
$I->amOnPage('/locations');
$I->waitForElement('.table', 5); // secs
$I->seeNumberOfElements('tr', [5,30]);
$I->seeInTitle('Locations');
$I->see('Locations');
$I->seeInPageSource('admin/settings/locations/create');
$I->seeInPageSource('/locations/create');
$I->dontSee('Locations', '.page-header');
$I->see('Locations', 'h1.pull-left');
@ -18,7 +18,7 @@ $I->see('Locations', 'h1.pull-left');
$I->wantTo('ensure that the create location form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->click(['link' => 'Create New']);
$I->amOnPage('/admin/settings/locations/create');
$I->amOnPage('/locations/create');
$I->dontSee('Create Location', '.page-header');
$I->see('Create Location', 'h1.pull-left');
$I->dontSee('&lt;span class=&quot;');

View file

@ -4,11 +4,11 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure that the manufacturers listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/settings/manufacturers');
$I->amOnPage('/manufacturers');
$I->seeNumberOfElements('table[name="manufacturers"] tr', [5,30]);
$I->see('Manufacturers');
$I->seeInTitle('Manufacturers');
$I->seeInPageSource('admin/settings/manufacturers/create');
$I->seeInPageSource('manufacturers/create');
$I->dontSee('Manufacturers', '.page-header');
$I->see('Manufacturers', 'h1.pull-left');
@ -17,7 +17,7 @@ $I->see('Manufacturers', 'h1.pull-left');
$I->wantTo('ensure that the create manufacturer form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->click(['link' => 'Create New']);
$I->amOnPage('/admin/settings/manufacturers/create');
$I->amOnPage('/manufacturers/create');
$I->dontSee('Create Manufacturer', '.page-header');
$I->see('Create Manufacturer', 'h1.pull-left');
$I->dontSee('&lt;span class=&quot;');

View file

@ -4,12 +4,12 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure the status labels listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/settings/statuslabels');
$I->amOnPage('/statuslabels');
$I->waitForElement('.table', 5); // secs
$I->seeNumberOfElements('tr', [1,30]);
$I->seeInTitle('Status Labels');
$I->see('Status Labels');
$I->seeInPageSource('admin/settings/statuslabels/create');
$I->seeInPageSource('statuslabels/create');
$I->dontSee('Status Labels', '.page-header');
$I->see('Status Labels', 'h1.pull-left');
@ -17,7 +17,7 @@ $I->see('Status Labels', 'h1.pull-left');
$I->wantTo('ensure the create status labels form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->click(['link' => 'Create New']);
$I->amOnPage('/admin/settings/statuslabels/create');
$I->amOnPage('/statuslabels/create');
$I->dontSee('Create Status Label', '.page-header');
$I->see('Create Status Label', 'h1.pull-left');
$I->dontSee('&lt;span class=&quot;');

View file

@ -4,12 +4,12 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure that the suppliers listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/settings/suppliers');
$I->amOnPage('/suppliers');
$I->waitForElement('.table', 5); // secs
$I->seeNumberOfElements('table[name="suppliers"] tr', [5,25]);
$I->seeInTitle('Suppliers');
$I->see('Suppliers');
$I->seeInPageSource('admin/settings/suppliers/create');
$I->seeInPageSource('suppliers/create');
$I->dontSee('Suppliers', '.page-header');
$I->see('Suppliers', 'h1.pull-left');
@ -17,7 +17,7 @@ $I->see('Suppliers', 'h1.pull-left');
$I->wantTo('ensure the create supplier form loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->click(['link' => 'Create New']);
$I->amOnPage('/admin/settings/suppliers/create');
$I->amOnPage('/suppliers/create');
$I->dontSee('Create Supplier', '.page-header');
$I->see('Create Supplier', 'h1.pull-left');
$I->dontSee('&lt;span class=&quot;');

View file

@ -4,13 +4,13 @@ AcceptanceTester::test_login($I);
$I->am('logged in user');
$I->wantTo('ensure that the users listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/users');
$I->amOnPage('/users');
//$I->waitForJS("return $.active == 0;", 60);
$I->waitForElement('.table', 5); // secs
//$I->seeNumberOfElements('tr', [1,10]);
$I->seeInTitle('Users');
$I->see('Users');
$I->seeInPageSource('admin/users/create');
$I->seeInPageSource('users/create');
$I->dontSee('Users', '.page-header');
$I->see('Users', 'h1.pull-left');
$I->seeLink('Create New'); // matches <a href="/logout">Logout</a>
@ -21,7 +21,7 @@ $I->am('logged in admin');
$I->wantTo('ensure that you get errors when you submit an incomplete form');
$I->lookForwardTo('seeing errors display');
$I->click(['link' => 'Create New']);
$I->amOnPage('admin/users/create');
$I->amOnPage('users/create');
$I->dontSee('Create User', '.page-header');
$I->see('Create User', 'h1.pull-left');