mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-13 15:01:02 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
c45e777324
|
@ -27,10 +27,16 @@ class AccessoriesFilesController extends Controller
|
|||
*/
|
||||
public function store(AssetFileRequest $request, $accessoryId = null)
|
||||
{
|
||||
|
||||
if (config('app.lock_passwords')) {
|
||||
return redirect()->route('accessories.show', ['accessory'=>$accessoryId])->with('error', trans('general.feature_disabled'));
|
||||
}
|
||||
|
||||
|
||||
$accessory = Accessory::find($accessoryId);
|
||||
|
||||
if (isset($accessory->id)) {
|
||||
$this->authorize('update', $accessory);
|
||||
$this->authorize('accessories.files', $accessory);
|
||||
|
||||
if ($request->hasFile('file')) {
|
||||
if (! Storage::exists('private_uploads/accessories')) {
|
||||
|
@ -129,9 +135,12 @@ class AccessoriesFilesController extends Controller
|
|||
*/
|
||||
public function show($accessoryId = null, $fileId = null, $download = true)
|
||||
{
|
||||
|
||||
\Log::debug('Private filesystem is: '.config('filesystems.default'));
|
||||
$accessory = Accessory::find($accessoryId);
|
||||
|
||||
|
||||
|
||||
// the accessory is valid
|
||||
if (isset($accessory->id)) {
|
||||
$this->authorize('view', $accessory);
|
||||
|
|
|
@ -62,7 +62,7 @@ class AssetModelsFilesController extends Controller
|
|||
$model->logUpload($file_name, e($request->get('notes')));
|
||||
}
|
||||
|
||||
return redirect()->back()->with('success', trans('admin/hardware/message.upload.success'));
|
||||
return redirect()->back()->with('success', trans('general.file_upload_success'));
|
||||
}
|
||||
|
||||
return redirect()->back()->with('error', trans('admin/hardware/message.upload.nofiles'));
|
||||
|
|
|
@ -27,6 +27,11 @@ class ComponentsFilesController extends Controller
|
|||
*/
|
||||
public function store(AssetFileRequest $request, $componentId = null)
|
||||
{
|
||||
|
||||
if (config('app.lock_passwords')) {
|
||||
return redirect()->route('components.show', ['component'=>$componentId])->with('error', trans('general.feature_disabled'));
|
||||
}
|
||||
|
||||
$component = Component::find($componentId);
|
||||
|
||||
if (isset($component->id)) {
|
||||
|
|
|
@ -27,6 +27,10 @@ class ConsumablesFilesController extends Controller
|
|||
*/
|
||||
public function store(AssetFileRequest $request, $consumableId = null)
|
||||
{
|
||||
if (config('app.lock_passwords')) {
|
||||
return redirect()->route('consumables.show', ['consumable'=>$consumableId])->with('error', trans('general.feature_disabled'));
|
||||
}
|
||||
|
||||
$consumable = Consumable::find($consumableId);
|
||||
|
||||
if (isset($consumable->id)) {
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
</li>
|
||||
|
||||
|
||||
@can('accessorys.files', $accessory)
|
||||
@can('accessories.files', $accessory)
|
||||
<li>
|
||||
<a href="#files" data-toggle="tab">
|
||||
<span class="hidden-lg hidden-md">
|
||||
|
@ -176,7 +176,7 @@
|
|||
|
||||
|
||||
|
||||
@can('accessorys.files', $accessory)
|
||||
@can('accessories.files', $accessory)
|
||||
<div class="tab-pane" id="files">
|
||||
|
||||
<div class="table table-responsive">
|
||||
|
@ -198,7 +198,7 @@
|
|||
data-sort-name="name"
|
||||
class="table table-striped snipe-table"
|
||||
data-export-options='{
|
||||
"fileName": "export-accessorys-uploads-{{ str_slug($accessory->name) }}-{{ date('Y-m-d') }}",
|
||||
"fileName": "export-accessories-uploads-{{ str_slug($accessory->name) }}-{{ date('Y-m-d') }}",
|
||||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","delete","download","icon"]
|
||||
}'>
|
||||
<thead>
|
||||
|
@ -224,7 +224,7 @@
|
|||
</td>
|
||||
<td>
|
||||
@if ($file->filename)
|
||||
@if ( Helper::checkUploadIsImage($file->get_src('accessorys')))
|
||||
@if ( Helper::checkUploadIsImage($file->get_src('accessories')))
|
||||
<a href="{{ route('show.accessoryfile', ['accessoryId' => $accessory->id, 'fileId' => $file->id, 'download' => 'false']) }}" data-toggle="lightbox" data-type="image"><img src="{{ route('show.accessoryfile', ['accessoryId' => $accessory->id, 'fileId' => $file->id]) }}" class="img-thumbnail" style="max-width: 50px;"></a>
|
||||
@endif
|
||||
@endif
|
||||
|
@ -232,8 +232,8 @@
|
|||
<td>
|
||||
{{ $file->filename }}
|
||||
</td>
|
||||
<td data-value="{{ (Storage::exists('private_uploads/accessorys/'.$file->filename) ? Storage::size('private_uploads/accessorys/'.$file->filename) : '') }}">
|
||||
{{ @Helper::formatFilesizeUnits(Storage::exists('private_uploads/accessorys/'.$file->filename) ? Storage::size('private_uploads/accessorys/'.$file->filename) : '') }}
|
||||
<td data-value="{{ (Storage::exists('private_uploads/accessories/'.$file->filename) ? Storage::size('private_uploads/accessories/'.$file->filename) : '') }}">
|
||||
{{ @Helper::formatFilesizeUnits(Storage::exists('private_uploads/accessories/'.$file->filename) ? Storage::size('private_uploads/accessories/'.$file->filename) : '') }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
@ -392,7 +392,7 @@
|
|||
|
||||
|
||||
|
||||
@can('update', Accessory::class)
|
||||
@can('accessories.files', Accessory::class)
|
||||
@include ('modals.upload-file', ['item_type' => 'accessory', 'item_id' => $accessory->id])
|
||||
@endcan
|
||||
@stop
|
||||
|
|
|
@ -283,7 +283,7 @@
|
|||
</div>
|
||||
</div> <!-- .row-->
|
||||
|
||||
@can('update', Component::class)
|
||||
@can('components.files', Component::class)
|
||||
@include ('modals.upload-file', ['item_type' => 'component', 'item_id' => $component->id])
|
||||
@endcan
|
||||
@stop
|
||||
|
|
|
@ -288,7 +288,7 @@
|
|||
|
||||
|
||||
|
||||
@can('update', \App\Models\Consumable::class)
|
||||
@can('consumables.files', \App\Models\Consumable::class)
|
||||
@include ('modals.upload-file', ['item_type' => 'consumable', 'item_id' => $consumable->id])
|
||||
@endcan
|
||||
@stop
|
||||
|
|
|
@ -145,9 +145,9 @@
|
|||
<tr>
|
||||
<td><i class="{{ Helper::filetype_icon($file->filename) }} icon-med" aria-hidden="true"></i></td>
|
||||
<td>
|
||||
@if ( Helper::checkUploadIsImage($file->get_src('assets')))
|
||||
<a href="{{ route('show/modelFile', ['modelId' => $model->id, 'fileId' =>$file->id]) }}" data-toggle="lightbox" data-type="image" data-title="{{ $file->filename }}" data-footer="{{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }}">
|
||||
<img src="{{ route('show/modelfile', ['assetId' => $model->id, 'fileId' =>$file->id]) }}" style="max-width: 50px;">
|
||||
@if ( Helper::checkUploadIsImage($file->get_src('assetmodels')))
|
||||
<a href="{{ route('show/modelfile', ['modelID' => $model->id, 'fileId' => $file->id]) }}" data-toggle="lightbox" data-type="image" data-title="{{ $file->filename }}">
|
||||
<img src="{{ route('show/modelfile', ['modelID' => $model->id, 'fileId' =>$file->id]) }}" style="max-width: 50px;">
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
|
|
Loading…
Reference in a new issue