Skip to content

Commit

Permalink
Merge pull request #889 from owlchester/refactor-forms-hidden
Browse files Browse the repository at this point in the history
Remove deprecated laravelcollective/html library
  • Loading branch information
ilestis authored Jun 10, 2024
2 parents f632787 + 719317a commit 5fd05de
Show file tree
Hide file tree
Showing 443 changed files with 2,728 additions and 3,391 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public function index(Request $request, Campaign $campaign, Calendar $calendar)
'campaign' => $campaign, 'calendar' => $calendar]), '_calendar-event', $models, $calendar);
}

if (request()->ajax()) {
return response()->json(['success' => true]);
}
$count = $this->campaign($campaign)->bulkProcess($request, EntityEvent::class);

return redirect()
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/Campaign/DefaultImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ public function store(DefaultImageStore $request, Campaign $campaign)
public function destroy(DefaultImageDestroy $request, Campaign $campaign)
{
$this->authorize('recover', $campaign);
$this->service->campaign($campaign)->type($request->post('entity_type'))->destroy();
$this->service
->campaign($campaign)
->type($request->post('entity_type'))
->destroy();

return redirect()->route('campaign.default-images', $campaign)
->with(
Expand Down
8 changes: 2 additions & 6 deletions app/Http/Controllers/Campaign/InviteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,8 @@ public function store(StoreCampaignInvite $request, Campaign $campaign)
$invitation = CampaignInvite::create($data);

$link = route('campaigns.join', [$invitation->token]);
$copy = link_to('#', '<i class="fa-solid fa-copy"></i> ' . __('campaigns.invites.actions.copy'), [
'data-clipboard' => $link,
'data-toggle' => 'tooltip',
'data-toast' => __('crud.alerts.copy_invite'),
'title' => __('campaigns.invites.actions.copy')
], null, false);
$copy = '<a href="#" data-clipboard="' . $link . '" data-toggle="tooltip" data-toast="' . __('crud.alerts.copy_invite') . '" title="' . __('campaigns.invites.actions.copy') . '"><i class="fa-solid fa-copy"></i> ' . __('campaigns.invites.actions.copy') . '</a>';


return redirect()->route('campaign_users.index', $campaign)
->with(
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Campaign/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public function update(UpdateModuleName $request, Campaign $campaign, EntityType
return view('campaign.modules')
->with('errors', __('This feature is only available on premium and boosted campaigns'));
}
if (request()->ajax()) {
return response()->json(['success' => true]);
}

$this->moduleService
->campaign($campaign)
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/Campaign/StyleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class StyleController extends Controller
{
public const MAX_THEMES = 30;
public const int MAX_THEMES = 30;

/**
* Create a new controller instance.
Expand Down Expand Up @@ -78,6 +78,9 @@ public function create(Campaign $campaign)
public function store(StoreCampaignStyle $request, Campaign $campaign)
{
$this->authorize('update', $campaign);
if (request()->ajax()) {
return response()->json(['success' => true]);
}

if ($campaign->styles()->count() >= self::MAX_THEMES) {
return redirect()->route('campaign_styles.index', $campaign)
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Campaign/VisibilityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function save(StoreCampaignVisibility $request, Campaign $campaign)
]);

$success = __('campaigns/public.update.' . ($campaign->isPublic() ? 'public' : 'private'), [
'public-campaigns' => link_to('https://kanka.io/campaigns', __('footer.public-campaigns'), ['target' => '_blank']),
'public-campaigns' => '<a href="https://kanka.io/campaigns" target="_blank">' . __('footer.public-campaigns') . '</a>',
]);

if ($request->get('from') === 'overview') {
Expand Down
7 changes: 5 additions & 2 deletions app/Http/Controllers/ConversationParticipantController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ public function index(Campaign $campaign, Conversation $conversation)
public function store(StoreConversationParticipant $request, Campaign $campaign, Conversation $conversation)
{
$this->authorize('update', $conversation);
if (request()->ajax()) {
return response()->json(['success' => true]);
}

$participant = new ConversationParticipant();
$participant = $participant->create($request->all());

return redirect()
->to($conversation->getLink())
->with('success', trans('conversations.participants.create.success', [
->route('entities.show', [$campaign, $conversation->entity])
->with('success', __('conversations.participants.create.success', [
'name' => $conversation->name,
'entity' => $participant->name()
]));
Expand Down
34 changes: 14 additions & 20 deletions app/Http/Controllers/CrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function crudIndex(Request $request)
return redirect()->route('dashboard', $this->campaign)->with(
'error_raw',
__('campaigns.settings.errors.module-disabled', [
'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$this->campaign, '#' . $this->module]),
'fix' => '<a href="' . route('campaign.modules', [$this->campaign, '#' . $this->module]) . '">' . __('crud.fix-this-issue') . '</a>',
])
);
}
Expand Down Expand Up @@ -383,16 +383,13 @@ public function crudStore(Request $request, bool $redirectToCreated = false)
$new->entity->crudSaved();
}

$link = '<a href="' . route(
$new->entity ? 'entities.show' : $this->view . '.show',
$new->entity ? [$this->campaign, $new->entity] : [$this->campaign, $new->id]
)
. '">' . $new->name . '</a>';
$success = __('general.success.created', [
'name' => $new->entity ? link_to_route(
'entities.show',
$new->name,
[$this->campaign, $new->entity]
) : link_to_route(/** Menu link **/
$this->view . '.show',
$new->name,
[$this->campaign, $new->id]
)
'name' => $link
]);

session()->flash('success_raw', $success);
Expand Down Expand Up @@ -541,16 +538,13 @@ public function crudUpdate(Request $request, Model|MiscModel $model)
}
}

$link = '<a href="' . route(
$model->entity ? 'entities.show' : $this->view . '.show',
$model->entity ? [$this->campaign, $model->entity] : [$this->campaign, $model->id]
)
. '">' . $model->name . '</a>';
$success = __('general.success.updated', [
'name' => $model->entity ? link_to_route(
'entities.show',
$model->name,
[$this->campaign, $model->entity]
) : link_to_route(/** Menu link **/
$this->view . '.show',
$model->name,
[$this->campaign, $model]
)
'name' => $link
]);

if ($model->entity) {
Expand Down Expand Up @@ -608,7 +602,7 @@ public function crudDestroy(Model|MiscModel $model)
return redirect()->route($this->route . '.index', $this->campaign)
->with('success_raw', __('general.success.deleted-cancel', [
'name' => $model->name,
'cancel' => link_to_route('recovery', __('crud.cancel'), [$model->campaign])
'cancel' => '<a href="' . route('recovery', $model->campaign) . '">' . __('crud.cancel') . '</a>'
]));
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Entity/AbilityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function index(Campaign $campaign, Entity $entity)
return redirect()->route('entities.show', [$campaign, $entity])->with(
'error_raw',
__('campaigns.settings.errors.module-disabled', [
'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#abilities']),
'fix' => '<a href="' . route('campaign.modules', [$campaign, '#abilities']) . '">' . __('crud.fix-this-issue') . '</a>',
])
);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Entity/AssetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function index(Campaign $campaign, Entity $entity)
return redirect()->route('entities.show', [$campaign, $entity])->with(
'error_raw',
__('campaigns.settings.errors.module-disabled', [
'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#assets']),
'fix' => '<a href="' . route('campaign.modules', [$campaign, '#assets']) . '">' . __('crud.fix-this-issue') . '</a>',
])
);
}
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Entity/AttributeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function index(Campaign $campaign, Entity $entity)
return redirect()->route('entities.show', [$campaign, $entity])->with(
'error_raw',
__('campaigns.settings.errors.module-disabled', [
'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#entity_attributes']),
'fix' => '<a href="' . route('campaign.modules', [$campaign, '#entity_attributes']) . '">' . __('crud.fix-this-issue') . '</a>'
])
);
}
Expand Down Expand Up @@ -71,7 +71,7 @@ public function dashboard(Campaign $campaign, Entity $entity)
return redirect()->route('dashboard', $campaign)->with(
'error_raw',
__('campaigns.settings.errors.module-disabled', [
'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#entity_attributes']),
'fix' => '<a href="' . route('campaign.modules', [$campaign, '#entity_attributes']) . '">' . __('crud.fix-this-issue') . '</a>'
])
);
}
Expand Down Expand Up @@ -106,7 +106,7 @@ public function edit(Campaign $campaign, Entity $entity)
return redirect()->route('dashboard', $campaign)->with(
'error_raw',
__('campaigns.settings.errors.module-disabled', [
'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#entity_attributes']),
'fix' => '<a href="' . route('campaign.modules', [$campaign, '#entity_attributes']) . '">' . __('crud.fix-this-issue') . '</a>'
])
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function index(Campaign $campaign, Entity $entity)
return redirect()->route('dashboard', $campaign)->with(
'error_raw',
__('campaigns.settings.errors.module-disabled', [
'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#entity_attributes']),
'fix' => '<a href="' . route('campaign.modules', [$campaign, '#entity_attributes']) . '">' . __('crud.fix-this-issue') . '</a>'
])
);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Entity/InventoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function index(Campaign $campaign, Entity $entity)
return redirect()->route('entities.show', [$campaign, $entity])->with(
'error_raw',
__('campaigns.settings.errors.module-disabled', [
'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#inventories']),
'fix' => '<a href="' . route('campaign.modules', [$campaign, '#inventories']) . '">' . __('crud.fix-this-issue') . '</a>'
])
);
}
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Entity/MoveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ public function index(Campaign $campaign, Entity $entity)
}

/**
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function move(MoveEntityRequest $request, Campaign $campaign, Entity $entity)
{
$this->authorize('view', $entity->child);
if (request()->ajax()) {
return response()->json(['success' => true]);
}

$copied = $request->filled('copy');
try {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Entity/ReminderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function index(Campaign $campaign, Entity $entity)
return redirect()->route('entities.show', [$campaign, $entity])->with(
'error_raw',
__('campaigns.settings.errors.module-disabled', [
'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#calendars']),
'fix' => '<a href="' . route('campaign.modules', [$campaign, '#calendars']) . '">' . __('crud.fix-this-issue') . '</a>'
])
);
}
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Entity/TransformController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public function index(Campaign $campaign, Entity $entity)
public function transform(TransformEntityRequest $request, Campaign $campaign, Entity $entity)
{
$this->authorize('move', $entity->child);
if (request()->ajax()) {
return response()->json(['success' => true]);
}

try {
$this->transformService
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/EntityCreatorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function store(Request $request, Campaign $campaign, $type)
}
}
$createdEntities[] = $new;
$links[] = link_to($new->entity->url(), $new->name);
$links[] = '<a href="' . $new->entity->url() . '">' . $new->name . '</a>';
}

// If no entity was created, we throw the standard error
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Families/MemberController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public function create(Campaign $campaign, Family $family)
public function store(StoreCharacterFamily $request, Campaign $campaign, Family $family)
{
$this->authorize('update', $family);
if ($request->ajax()) {
return response()->json(['success' => true]);
}

$newMembers = $family->members()->syncWithoutDetaching($request->members);

Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Maps/Bulks/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public function index(Request $request, Campaign $campaign, Map $map)
return $this->bulkBatch(route('maps.groups.bulk', [$campaign, 'map' => $map]), '_map-group', $models);
}

if (request()->ajax()) {
return response()->json(['success' => true]);
}
$count = $this->bulkProcess($request, MapGroup::class);

return redirect()
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Maps/Bulks/LayerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public function index(Request $request, Campaign $campaign, Map $map)
return $this->campaign($campaign)->bulkBatch(route('maps.layers.bulk', [$campaign, 'map' => $map]), '_map-layer', $models);
}

if (request()->ajax()) {
return response()->json(['success' => true]);
}
$count = $this->bulkProcess($request, MapLayer::class);

return redirect()
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Maps/Bulks/MarkerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public function index(Request $request, Campaign $campaign, Map $map)
'campaign' => $campaign, 'map' => $map]), '_map-marker', $models, $map);
}

if (request()->ajax()) {
return response()->json(['success' => true]);
}
$count = $this->campaign($campaign)->bulkProcess($request, MapMarker::class);

return redirect()
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Maps/Markers/DetailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function index(Campaign $campaign, Map $map, MapMarker $mapMarker)
$name = $mapMarker->name;
if ($mapMarker->entity) {
$name = !empty($mapMarker->name) ? $mapMarker->name : $mapMarker->entity->name;
$name = link_to($mapMarker->entity->url(), $name, ['target' => '_blank']);
$name = '<a href="' . $mapMarker->entity->url() . '" target="_blank">' . $name . '</a>';
}
if (request()->has('mobile')) {
return response()->view('maps.markers.dialog_details', [
Expand Down
8 changes: 7 additions & 1 deletion app/Http/Controllers/Organisation/MemberController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function index(Campaign $campaign, Organisation $organisation)
->select('organisation_member.*')
->with([
'organisation', 'organisation.entity',
'parent', 'parent.character',
'parent', 'parent.character', 'parent.character.entity',
'character', 'character.entity', 'character.entity.image',
'character.location', 'character.location.entity'])
->has('character')
Expand Down Expand Up @@ -79,6 +79,9 @@ public function create(Campaign $campaign, Organisation $organisation)
public function store(StoreOrganisationMember $request, Campaign $campaign, Organisation $organisation)
{
$this->authorize('member', $organisation);
if ($request->ajax()) {
return response()->json(['success' => true]);
}

$relation = OrganisationMember::create($request->all());
return redirect()->route('entities.show', [$campaign, $organisation->entity])
Expand Down Expand Up @@ -123,6 +126,9 @@ public function update(
OrganisationMember $organisationMember
) {
$this->authorize('member', $organisation);
if ($request->ajax()) {
return response()->json(['success' => true]);
}

$organisationMember->update($request->all());
return redirect()->route('entities.show', [$campaign, $organisation->entity])
Expand Down
5 changes: 1 addition & 4 deletions app/Http/Controllers/RelationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ public function store(StoreRelation $request, Campaign $campaign)
$count = $this->relationService->getCount();

$success = trans_choice($this->langKey . '.create.success_bulk', $count, [
'entity' => link_to(
$new->owner->url(),
$new->owner->name
),
'entity' => '<a href="' . $new->owner->url() . '">' . $new->owner->name . '</a>',
'count' => $count,
]);
session()->flash('success_raw', $success);
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Timelines/TimelineEraController.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ public function bulk(Request $request, Campaign $campaign, Timeline $timeline)
return $this->bulkBatch(route('timelines.eras.bulk', [$campaign, 'timeline' => $timeline]), '_timeline-era', $models);
}*/

if (request()->ajax()) {
return response()->json(['success' => true]);
}
$count = $this->bulkProcess($request, TimelineEra::class);

return redirect()
Expand Down
2 changes: 1 addition & 1 deletion app/Models/AttributeTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class AttributeTemplate extends MiscModel
];

/** @var bool Attribute templates don't have inventory, relations or abilities */
public $hasRelations = false;
public bool $hasRelations = false;

public function attributeTemplate(): BelongsTo
{
Expand Down
Loading

0 comments on commit 5fd05de

Please sign in to comment.