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

Remove deprecated laravelcollective/html library #889

Merged
merged 30 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
042ab3d
Expose entity and attributes as a js object for marketplace artisans
ilestis May 31, 2024
3ff147d
Fix editing alias crashing
ilestis May 31, 2024
01257ea
Fix dice roll results crashing when more than 1 page
ilestis May 31, 2024
f575993
Remove all Form::hidden calls
ilestis Jun 3, 2024
9a25d10
Fix styling
ilestis Jun 3, 2024
4a1c993
Remove all Form::textarea calls
ilestis Jun 3, 2024
da76f7c
Remove all Form::file calls
ilestis Jun 3, 2024
1e7032e
Remove all Form::number calls
ilestis Jun 3, 2024
a704c65
Fix some fields
ilestis Jun 3, 2024
ab64140
Ad-blocking detection
ilestis Jun 4, 2024
197fcca
Remove all Form::checkbox calls
ilestis Jun 4, 2024
33405f3
Fix styling
ilestis Jun 4, 2024
f43b8df
Merge branch 'main' into refactor-forms-hidden
ilestis Jun 4, 2024
779f406
Remove all Form::text calls
ilestis Jun 4, 2024
9c68f62
Merge remote-tracking branch 'origin/refactor-forms-hidden' into refa…
ilestis Jun 4, 2024
d3ab390
Remove all Form::select calls
ilestis Jun 5, 2024
52a628f
Fix styling
ilestis Jun 5, 2024
0821d96
Merge branch 'develop' into refactor-forms-hidden
ilestis Jun 7, 2024
bcef031
Merge branch 'develop' into refactor-forms-hidden
ilestis Jun 7, 2024
a56fce9
Remove all Form::open/model/close calls
ilestis Jun 8, 2024
afa4ceb
Refactor ctrl+s to work on modals and in mostly vanilla js
ilestis Jun 8, 2024
9d80260
Refactor controllers to support more ajax form submits
ilestis Jun 8, 2024
8b5fed5
Assets
ilestis Jun 8, 2024
e31a52e
Fix styling
ilestis Jun 8, 2024
d9ecd68
Remove all link, link_to, link_to_route calls
ilestis Jun 10, 2024
da28522
Clean up
ilestis Jun 10, 2024
9210101
Fix styling
ilestis Jun 10, 2024
3fae398
Fix phpstan
ilestis Jun 10, 2024
0c20053
Fix phpstan
ilestis Jun 10, 2024
719317a
Fix phpstan
ilestis Jun 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
Loading