Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus Point from entity #955

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/Http/Controllers/Campaign/Gallery/FocusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ public function save(StoreImageFocus $request, Campaign $campaign, Image $image)
if (!empty($image->folder_id)) {
$params = ['folder_id' => $image->folder_id];
}

if ($request->focusEntity) {
return redirect()
->back()
->with('success', __('campaigns/gallery.focus.' . ($added ? 'updated' : 'removed')));
}
return redirect()->route('gallery', [$campaign] + $params)
->with('success', __('campaigns/gallery.focus.' . ($added ? 'updated' : 'removed')));
}
Expand Down
2 changes: 1 addition & 1 deletion lang/en/entities/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'success' => 'Image focus updated.',
'title' => 'Image Focus for :name',
'unboosted' => 'Setting an image focus point is reserverd to :boosted-campaigns.',
'warning_v2' => 'Setting the focus point for gallery images can be done directly on the :gallery page.',
'warning' => 'The focus point for :gallery images is shared by all entities that use that same image.',
],
'replace' => [
'breadcrumb' => 'Image replacement',
Expand Down
19 changes: 13 additions & 6 deletions resources/views/entities/pages/image/focus.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@
@if ($campaign->boosted())
@if($campaign->superboosted() && empty($entity->image_path) && !empty($entity->image_uuid))
<x-alert type="warning">
<p>{!! __('entities/image.focus.warning_v2', ['gallery' => '<a href="' . route('gallery', $campaign) . '">' . __('sidebar.gallery') . '</a>']) !!}</p>
<p>{!! __('entities/image.focus.warning', ['gallery' => '<a href="' . route('gallery', $campaign) . '">' . __('sidebar.gallery') . '</a>']) !!}</p>
</x-alert>
<p>
<a href="{{ $model->getLink() }}">
<x-icon class="fa-regular fa-arrow-left" />
{{ __('crud.actions.back') }}
</br>
@include('gallery.file.focus._form', [
'image' => $entity->image,
])
<x-dialog.footer>
<a href="{{ $model->getLink() }}" class="btn2 btn-ghost">
{{ __('crud.cancel') }}
</a>
</p>
@include('gallery.file.focus._actions', [
'image' => $entity->image,
'focusEntity' => true,
])
</x-dialog.footer>
@else

<x-helper>{{ __('entities/image.focus.helper') }}</x-helper>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/gallery/file/focus/_actions.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div>
<x-form :action="['campaign.gallery.save-focus', $campaign, $image]">
<x-form :action="['campaign.gallery.save-focus', $campaign, $image, 'focusEntity' => isset($focusEntity)]">
<input type="submit" class="btn2 btn-error btn-outline" value="{{ __('campaigns/gallery.actions.reset_focus') }}">
</x-form>
</div>
<div>
<x-form :action="['campaign.gallery.save-focus', $campaign, $image]">
<x-form :action="['campaign.gallery.save-focus', $campaign, $image, 'focusEntity' => isset($focusEntity)]">
<input type="hidden" name="focus_x" />
<input type="hidden" name="focus_y" />
<button type="submit" class="btn2 btn-primary">
Expand Down
Loading