Skip to content

Commit 99c8f1b

Browse files
committed
Updates
1 parent 34410a6 commit 99c8f1b

17 files changed

+259
-165
lines changed

app/Http/Controllers/Api/v1/EntityTagApiController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function index(Campaign $campaign, Entity $entity)
1616
$this->authorize('access', $campaign);
1717
$this->authorize('view', $entity);
1818

19-
return Resource::collection($entity->tags()->paginate());
19+
return Resource::collection($entity->tags()->withPivot('id')->paginate());
2020
}
2121

2222
public function show(Campaign $campaign, Entity $entity, EntityTag $entityTag)

app/Http/Controllers/CrudController.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,12 @@ public function crudCreate($params = [])
352352
$params['title'] = __('crud.titles.new', ['module' => $singular]);
353353
}
354354

355-
return view('cruds.forms.create', array_merge(['name' => $this->view], $params));
355+
$view = 'cruds.forms.create';
356+
$override = $this->view . '.forms.create';
357+
if (view()->exists($override)) {
358+
$view = $override;
359+
}
360+
return view($view, array_merge(['name' => $this->view], $params));
356361
}
357362

358363
public function crudStore(Request $request, bool $redirectToCreated = false)
@@ -518,7 +523,12 @@ public function crudEdit(Model|MiscModel $model)
518523
$params['entity'] = $model->entity;
519524
}
520525

521-
return view('cruds.forms.edit', $params);
526+
$view = 'cruds.forms.edit';
527+
$override = $this->view . '.forms.edit';
528+
if (view()->exists($override)) {
529+
$view = $override;
530+
}
531+
return view($view, $params);
522532
}
523533

524534
/**

app/Http/Resources/Api/EntityTagResource.php

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public function toArray(Request $request): array
1919
$model = $this->resource;
2020

2121
return [
22-
'id' => $model->id,
2322
'tag_id' => $model->tag_id,
2423
];
2524
}

app/Models/Concerns/Taggable.php

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public static function bootTaggable(): void
2727
public function tags(): BelongsToMany
2828
{
2929
return $this->belongsToMany(Tag::class, $this->getTagPivotTableName())
30-
->withPivot('id')
3130
->with('entity')
3231
->has('entity');
3332
}

lang/en/bookmarks.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@
1212
],
1313
'fields' => [
1414
'active' => 'Active',
15-
'dashboard' => 'Dashboard',
15+
'dashboard' => 'Dashboard',
1616
'default_dashboard' => 'Default dashboard',
17-
'entity' => 'Entity',
1817
'filters' => 'Filters',
1918
'menu' => 'Subpage',
2019
'position' => 'Position',
21-
'random' => 'Random',
2220
'random_type' => 'Random Entity Type',
2321
'selector' => 'Bookmark Configuration',
2422
'target' => 'Target',
25-
'type' => 'Entity List',
2623
],
2724
'helpers' => [
2825
'active' => 'Inactive bookmarks won\'t appear in the interface.',
@@ -33,6 +30,7 @@
3330
'random' => 'Use this field to have a bookmark pointing to a random entity. You can filter the link to only go to a specific entity type.',
3431
'selector' => 'Configure where this bookmark goes when a user clicks on it in the sidebar.',
3532
'type' => 'Set up this bookmark to go directly to a list of entities. To filter the results, copy parts of the url on the filtered entity list after the :? sign into the :filter field.',
33+
'css' => 'Add a CSS class that will be added to the bookmark\'s link in the sidebar.',
3634
],
3735
'placeholders' => [
3836
'filters' => 'location_id=15&type=city',
@@ -50,4 +48,11 @@
5048
'visibilities' => [
5149
'is_active' => 'Show the bookmark in the sidebar',
5250
],
51+
'targets' => [
52+
'select' => 'Choose an option',
53+
'entity' => 'A single entity',
54+
'random' => 'A random entity',
55+
'type' => 'List of entities of a specific entity type/module',
56+
'dashboard' => 'One of the campaign\'s dashboards',
57+
]
5358
];

resources/js/quick-links.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ const initQuickLinksForm = () => {
55
}
66
selector.addEventListener('change', function (e) {
77
e.preventDefault();
8-
let selected = selector.options[selector.selectedIndex];
8+
const selected = selector.options[selector.selectedIndex];
99

1010
const subforms = document.querySelectorAll('.bookmark-subform');
1111
subforms.forEach(subform => {
12-
subform.classList.add('hidden');
12+
subform.classList.add('opacity-0', 'invisible', 'h-0');
1313
});
1414
let target = document.querySelector(selected.dataset.target);
1515
if (target) {
16-
target.classList.remove('hidden');
16+
target.classList.remove('opacity-0', 'invisible', 'h-0');
1717
}
1818
});
1919
};

resources/js/togglers.js

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ const registerEntityPrivacyAlert = () => {
4444
}
4545
field.addEventListener('change', function () {
4646
let selector = document.getElementById('entity-is-private');
47+
// Bookmarks have this field but no permissions. This should be handled differently
48+
if (!selector) {
49+
return;
50+
}
4751
if (this.checked) {
4852
selector.classList.remove('hidden')
4953
} else {

resources/views/bookmarks/datagrid.blade.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
if ($model->isDashboard()) {
1212
return '<i class="fa-solid fa-th-large"></i> ' . __('bookmarks.fields.dashboard');
1313
} elseif ($model->isEntity()) {
14-
return '<i class="fa-solid fa-star"></i> ' . __('bookmarks.fields.entity');
14+
return '<i class="fa-solid fa-star"></i> ' . __('entities.entity');
1515
} elseif ($model->isList()) {
16-
return '<i class="fa-solid fa-th-list"></i> ' . __('bookmarks.fields.type');
16+
return '<i class="fa-solid fa-th-list"></i> ' . __('crud.fields.entity_type');
1717
} elseif ($model->isRandom()) {
18-
return '<i class="fa-solid fa-question"></i> ' . __('bookmarks.fields.random');
18+
return '<i class="fa-solid fa-question"></i> ' . __('dashboard.setup.widgets.random');
1919
}
2020
return '';
2121
},

resources/views/bookmarks/form/_entry.blade.php

-145
This file was deleted.

resources/views/bookmarks/form/_entity.blade.php renamed to resources/views/bookmarks/forms/_entity.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<x-grid type="1/1">
5353
<x-helper>
5454
{!! __('bookmarks.helpers.entity', [
55-
'menu' => '<code>' . __('bookmarks.fields.menu') . '</code>',
55+
'menu' => '<span class="font-extrabold">' . __('bookmarks.fields.menu') . '</span>',
5656
]) !!}
5757
</x-helper>
5858

@@ -61,7 +61,7 @@
6161
'name' => 'entity_id',
6262
'required' => true,
6363
'preset' => !empty($model) && $model->target ? $model->target : null,
64-
'label' => __('bookmarks.fields.entity'),
64+
'label' => __('entities.entity'),
6565
])
6666

6767
<x-forms.field field="menu" :label="__('bookmarks.fields.menu')">

0 commit comments

Comments
 (0)