Improved messaging for cloning/editing assets that inherit images

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2025-08-04 20:51:24 +01:00
parent c3442033da
commit 1d8493d388
3 changed files with 12 additions and 1 deletions

View File

@@ -652,8 +652,9 @@ class AssetsController extends Controller
*/
public function getClone(Asset $asset)
{
$this->authorize('create', $asset);
$this->authorize('create', Asset::class);
$cloned = clone $asset;
$cloned_model = $asset;
$cloned->id = null;
$cloned->asset_tag = '';
$cloned->serial = '';
@@ -663,6 +664,7 @@ class AssetsController extends Controller
return view('hardware/edit')
->with('statuslabel_list', Helper::statusLabelList())
->with('statuslabel_types', Helper::statusTypeList())
->with('cloned_model', $cloned_model)
->with('item', $cloned);
}

View File

@@ -600,6 +600,7 @@ return [
'build' => 'build',
'use_cloned_image' => 'Clone image from original',
'use_cloned_image_help' => 'You may clone the original image or you can upload a new one using the upload field below.',
'use_cloned_no_image_help' => 'This item does not have an associated image and instead inherits from the model or category it belongs to. If you would like to use a specific image for this item, you can upload a new one below.',
'footer_credit' => '<a target="_blank" href="https://snipeitapp.com" rel="noopener">Snipe-IT</a> is open source software, made with <i class="fa fa-heart" aria-hidden="true" style="color: #a94442; font-size: 10px" /></i><span class="sr-only">love</span> by <a href="https://bsky.app/profile/snipeitapp.com" rel="noopener">@snipeitapp.com</a>.',
'set_password' => 'Set a Password',

View File

@@ -35,6 +35,14 @@
{!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@elseif (isset($item) && (isset($item->model)) && ($item->model->image != ''))
<div class="form-group">
<div class="col-md-8 col-md-offset-3">
<p class="text-info">
<x-icon type="info-circle" /> {{ trans('general.use_cloned_no_image_help') }}
</p>
</div>
</div>
@endif
@endif
<!-- Image Upload and preview -->