Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
itzArtha committed Oct 6, 2023
2 parents 6684af3 + 9285dd6 commit d4a5267
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
13 changes: 10 additions & 3 deletions app/Actions/Web/Website/PublishWebsiteMarginal.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ class PublishWebsiteMarginal

public function handle(Website $website, string $marginal, array $modelData): Website
{
$compiledLayout = '';
if ($marginal == 'header') {
$compiledLayout = Arr::get($website->unpublishedHeaderSnapshot->layout, 'html');
} elseif ($marginal == 'footer') {
$compiledLayout = Arr::get($website->unpublishedFooterSnapshot->layout, 'html');
}

foreach ($website->snapshots()->where('scope', $marginal)->where('state', SnapshotStateEnum::LIVE)->get() as $liveSnapshot) {
UpdateSnapshot::run($liveSnapshot, [
'state' => SnapshotStateEnum::HISTORIC,
Expand All @@ -39,8 +46,9 @@ public function handle(Website $website, string $marginal, array $modelData): We
[
'state' => SnapshotStateEnum::LIVE,
'published_at' => now(),
'layout' => Arr::get($modelData, 'layout'),
'scope' => $marginal
'layout' => $compiledLayout,
'scope' => $marginal,
'comment' => Arr::get($modelData, 'comment')
],
);

Expand Down Expand Up @@ -69,7 +77,6 @@ public function authorize(ActionRequest $request): bool
public function rules(): array
{
return [
'layout' => ['required', 'array:delay,common,components'],
'comment' => ['sometimes', 'required', 'string', 'max:1024']
];
}
Expand Down
4 changes: 2 additions & 2 deletions app/Actions/Web/Website/UI/ShowWebsiteWorkshop.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public function htmlResponse(Website $website, ActionRequest $request): Response
'websiteState'=>$website->state,
'publishRoutes' => [
'workshop_header'=> [
'name' => 'org.models.website.header.content.update',
'name' => 'org.models.website.header.content.publish',
'parameters' => $website->id
],
'workshop_footer'=> [
'name' => 'org.models.website.footer.content.update',
'name' => 'org.models.website.footer.content.publish',
'parameters' => $website->id
],
'workshop_layout'=> [
Expand Down
1 change: 1 addition & 0 deletions app/Http/Middleware/HandlePublicInertiaRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function share(Request $request): array
]);
};


$firstLoadOnlyProps['structure']=$request->get('website')->compiled_structure;
return array_merge(
$firstLoadOnlyProps,
Expand Down
5 changes: 5 additions & 0 deletions routes/org/web/models.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
use App\Actions\Web\Webpage\StoreArticle;
use App\Actions\Web\Webpage\StoreWebpage;
use App\Actions\Web\Webpage\UpdateWebpageContent;
use App\Actions\Web\Website\PublishWebsiteMarginal;
use App\Actions\Web\Website\ShowWebsiteFooterContent;
use App\Actions\Web\Website\ShowWebsiteHeaderContent;
use App\Actions\Web\Website\StoreWebsite;
Expand Down Expand Up @@ -105,9 +106,13 @@
Route::patch('{website:id}/layout', UpdateWebsiteLayout::class)->name('layout.update');

Route::post('{website:id}/header/content', UpdateWebsiteHeaderContent::class)->name('header.content.update');
Route::post('{website:id}/header/publish', [PublishWebsiteMarginal::class,'header'])->name('header.content.publish');

Route::get('{website:id}/header/content', ShowWebsiteHeaderContent::class)->name('header.content.show');

Route::post('{website:id}/footer/content', UpdateWebsiteFooterContent::class)->name('footer.content.update');
Route::post('{website:id}/footer/publish', [PublishWebsiteMarginal::class,'footer'])->name('footer.content.publish');

Route::get('{website:id}/footer/content', ShowWebsiteFooterContent::class)->name('footer.content.show');


Expand Down

0 comments on commit d4a5267

Please sign in to comment.