From 9b167d87d27ada58d9e142c084c160d062beb3d8 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 15 Dec 2016 04:27:17 -0800 Subject: [PATCH] Updated to use named routes (#3060), some FORM spoofing for PUT (#3061) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Updating assets isn’t currently working - investigating that) --- app/Providers/RouteServiceProvider.php | 2 +- resources/views/accessories/edit.blade.php | 5 ++++- resources/views/accessories/index.blade.php | 2 +- resources/views/accessories/view.blade.php | 2 +- resources/views/consumables/edit.blade.php | 3 ++- resources/views/consumables/index.blade.php | 2 +- resources/views/dashboard.blade.php | 8 ++++---- resources/views/hardware/edit.blade.php | 9 +++++---- resources/views/hardware/index.blade.php | 2 +- resources/views/hardware/qr-view.blade.php | 2 +- resources/views/hardware/view.blade.php | 2 +- resources/views/layouts/default.blade.php | 22 ++++++++++----------- resources/views/layouts/edit-form.blade.php | 8 +++++++- resources/views/models/edit.blade.php | 3 ++- resources/views/models/view.blade.php | 2 +- 15 files changed, 43 insertions(+), 31 deletions(-) diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 7bc0425d41..63cdd9397c 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -58,7 +58,7 @@ class RouteServiceProvider extends ServiceProvider require base_path('routes/web/hardware.php'); require base_path('routes/web/accessories.php'); require base_path('routes/web/licenses.php'); - require base_path('routes/web/consumable.php'); + require base_path('routes/web/consumables.php'); require base_path('routes/web.php'); }); } diff --git a/resources/views/accessories/edit.blade.php b/resources/views/accessories/edit.blade.php index ad845dc203..b9f337d478 100755 --- a/resources/views/accessories/edit.blade.php +++ b/resources/views/accessories/edit.blade.php @@ -2,9 +2,12 @@ 'createText' => trans('admin/accessories/general.create') , 'updateText' => trans('admin/accessories/general.update'), 'helpTitle' => trans('admin/accessories/general.about_accessories_title'), - 'helpText' => trans('admin/accessories/general.about_accessories_text') + 'helpText' => trans('admin/accessories/general.about_accessories_text'), + 'formAction' => ($item) ? route('accessories.update', ['accessory' => $item->id]) : route('accessories.store'), ]) +{{ ($item) ? "route('accessories.update', ['accessory_id' => $item->id])" : "route('accessories.store')" }} + {{-- Page content --}} @section('inputFields') diff --git a/resources/views/accessories/index.blade.php b/resources/views/accessories/index.blade.php index 1722e0b691..c8059ba031 100755 --- a/resources/views/accessories/index.blade.php +++ b/resources/views/accessories/index.blade.php @@ -8,7 +8,7 @@ @section('header_right') @can('accessories.create') - {{ trans('general.create') }} + {{ trans('general.create') }} @endcan @stop diff --git a/resources/views/accessories/view.blade.php b/resources/views/accessories/view.blade.php index 094333a94f..3518f7ff62 100644 --- a/resources/views/accessories/view.blade.php +++ b/resources/views/accessories/view.blade.php @@ -30,7 +30,7 @@ @endcan @endif @can('accessories.edit') -
  • {{ trans('admin/accessories/general.edit') }}
  • +
  • {{ trans('admin/accessories/general.edit') }}
  • @endcan diff --git a/resources/views/consumables/edit.blade.php b/resources/views/consumables/edit.blade.php index e9670ec95d..54d5d5c27f 100644 --- a/resources/views/consumables/edit.blade.php +++ b/resources/views/consumables/edit.blade.php @@ -2,7 +2,8 @@ 'createText' => trans('admin/consumables/general.create') , 'updateText' => trans('admin/consumables/general.update'), 'helpTitle' => trans('admin/consumables/general.about_consumables_title'), - 'helpText' => trans('admin/consumables/general.about_consumables_text') + 'helpText' => trans('admin/consumables/general.about_consumables_text'), + 'formAction' => ($item) ? route('consumables.update', ['accessory' => $item->id]) : route('consumables.store'), ]) {{-- Page content --}} @section('inputFields') diff --git a/resources/views/consumables/index.blade.php b/resources/views/consumables/index.blade.php index 0a164ca1da..c3a4f6e4ef 100644 --- a/resources/views/consumables/index.blade.php +++ b/resources/views/consumables/index.blade.php @@ -8,7 +8,7 @@ @section('header_right') @can('consumables.create') - {{ trans('general.create') }} + {{ trans('general.create') }} @endcan @stop diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 15aef39014..5a147aba7a 100755 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -25,7 +25,7 @@ @can('assets.view') - {{ trans('general.moreinfo') }} + {{ trans('general.moreinfo') }} @endcan @@ -41,7 +41,7 @@ @can('licenses.view') - {{ trans('general.moreinfo') }} + {{ trans('general.moreinfo') }} @endcan @@ -57,7 +57,7 @@ @can('accessories.view') - {{ trans('general.moreinfo') }} + {{ trans('general.moreinfo') }} @endcan @@ -73,7 +73,7 @@ @can('consumables.view') - {{ trans('general.moreinfo') }} + {{ trans('general.moreinfo') }} @endcan diff --git a/resources/views/hardware/edit.blade.php b/resources/views/hardware/edit.blade.php index a023c7b1f5..90b888fbb1 100755 --- a/resources/views/hardware/edit.blade.php +++ b/resources/views/hardware/edit.blade.php @@ -3,7 +3,8 @@ 'createText' => trans('admin/hardware/form.create'), 'updateText' => trans('admin/hardware/form.update'), 'helpTitle' => trans('admin/hardware/general.about_assets_title'), - 'helpText' => trans('admin/hardware/general.about_assets_text') + 'helpText' => trans('admin/hardware/general.about_assets_text'), + 'formAction' => ($item) ? route('hardware.update', ['hardware' => $item->id]) : route('hardware.store'), ]) @@ -244,7 +245,7 @@ $(function () { //First check to see if there is a file before doing anything else var imageData = ""; - var $fileInput = $('#file-upload'); + var $fileInput = $('#file-upload'); $fileInput.on('change', function(e) { if( $fileInput != '' ) { if(window.File && window.FileReader && window.FormData) { @@ -259,7 +260,7 @@ $(function () { } else { console.log("File API not supported, not resizing"); - } + } } }); @@ -271,7 +272,7 @@ $(function () { processFile(reader.result, file.type); } - reader.onerror = function() { + reader.onerror = function() { alert("Unable to read file"); } diff --git a/resources/views/hardware/index.blade.php b/resources/views/hardware/index.blade.php index 04b52f5aaa..89973be995 100755 --- a/resources/views/hardware/index.blade.php +++ b/resources/views/hardware/index.blade.php @@ -31,7 +31,7 @@ @stop @section('header_right') - {{ trans('general.create') }} + {{ trans('general.create') }} @stop {{-- Page content --}} diff --git a/resources/views/hardware/qr-view.blade.php b/resources/views/hardware/qr-view.blade.php index 5407529653..5bcbfddfad 100644 --- a/resources/views/hardware/qr-view.blade.php +++ b/resources/views/hardware/qr-view.blade.php @@ -33,7 +33,7 @@ @elseif ($asset->status_id == 0)
  • {{ trans('admin/hardware/general.checkout') }}
  • @endif -
  • {{ trans('admin/hardware/general.edit') }}
  • +
  • {{ trans('admin/hardware/general.edit') }}
  • {{ trans('admin/hardware/general.clone') }}
  • diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 110fd591ab..b3283be758 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -24,7 +24,7 @@
  • {{ trans('admin/hardware/general.checkout') }}
  • @endif @endif -
  • {{ trans('admin/hardware/general.edit') }}
  • +
  • {{ trans('admin/hardware/general.edit') }}
  • {{ trans('admin/hardware/general.clone') }}
  • diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index a16db3a351..2caed9f66a 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -137,20 +137,20 @@ @endcan @can('licenses.view')
  • - +
  • @endcan @can('accessories.view')
  • - +
  • @endcan @can('consumables.view') -
  • +
  • @@ -188,7 +188,7 @@