Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ilestis committed Apr 5, 2024
2 parents b40cb03 + 6ae38bf commit 2315127
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
14 changes: 12 additions & 2 deletions app/Http/Controllers/Crud/CampaignController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ public function create(Campaign $campaign)
{
$this->authorize('create', $campaign);

return view($this->view . '.create', ['start' => false]);
return view($this->view . '.forms.create', ['start' => false]);
}

public function store(StoreCampaign $request)
{
$campaign = new Campaign();
$this->authorize('create', $campaign);

// For ajax requests, send back that the validation succeeded, so we can really send the form to be saved.
if (request()->ajax()) {
return response()->json(['success' => true]);
}

$first = !auth()->user()->hasCampaigns();
$data = $request->all();

Expand Down Expand Up @@ -97,7 +102,7 @@ public function edit(Campaign $campaign)
$editingService->edit();
}
}
return view($this->view . '.edit', [
return view($this->view . '.forms.edit', [
'campaign' => $campaign,
'model' => $campaign,
'start' => false,
Expand All @@ -109,6 +114,11 @@ public function update(UpdateCampaign $request, Campaign $campaign)
{
$this->authorize('update', $campaign);

// For ajax requests, send back that the validation succeeded, so we can really send the form to be saved.
if (request()->ajax()) {
return response()->json(['success' => true]);
}

$data = $request->all();
// Missing sidebar config? Because we shouldn't have used the same array...
if (!empty($campaign->ui_settings['sidebar'])) {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/StartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function index(Request $request)
session()->remove('user_registered');
$tracking = 'pa10CJTvrssBEOaOq7oC';
}
return view($this->view . '.create', [
return view($this->view . '.forms.create', [
'start' => auth()->user()->campaigns->count() === 0,
'gaTrackingEvent' => $tracking,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'data-shortcut' => '1',
'class' => 'entity-form',
'data-unload' => 1,
'data-maintenance' => 1,
]) !!}
@endsection

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'data-shortcut' => '1',
'class' => 'entity-form',
'data-unload' => 1,
'data-maintenance' => 1,
]) !!}
@endsection

Expand Down

0 comments on commit 2315127

Please sign in to comment.