Skip to content

Commit

Permalink
Merge pull request #102 from canyongbs/feature/AIDAPP-107-configurabl…
Browse files Browse the repository at this point in the history
…e-layout

[AIDAPP-107]: Introduce configurable layout options for the KB portal
  • Loading branch information
Orrison authored Jun 4, 2024
2 parents b3b1d44 + da81437 commit f383c99
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 0 deletions.
54 changes: 54 additions & 0 deletions app-modules/portal/src/Enums/PortalLayout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

/*
<COPYRIGHT>
Copyright © 2016-2024, Canyon GBS LLC. All rights reserved.
Aiding App™ is licensed under the Elastic License 2.0. For more details,
see <https://github.com/canyongbs/aidingapp/blob/main/LICENSE.>
Notice:
- You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.
- You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.
- You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.
- Canyon GBS LLC respects the intellectual property rights of others and expects the
same in return. Canyon GBS™ and Aiding App™ are registered trademarks of
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks
vigorously.
- The software solution, including services, infrastructure, and code, is offered as a
Software as a Service (SaaS) by Canyon GBS LLC.
- Use of this software implies agreement to the license terms and conditions as stated
in the Elastic License 2.0.
For more information or inquiries please visit our website at
<https://www.canyongbs.com> or contact us via email at legal@canyongbs.com.
</COPYRIGHT>
*/

namespace AidingApp\Portal\Enums;

use Filament\Support\Contracts\HasLabel;

enum PortalLayout: string implements HasLabel
{
case Full = 'full';

case Fixed = 'fixed';

public function getLabel(): ?string
{
return match ($this) {
PortalLayout::Full => 'Full-Width',
PortalLayout::Fixed => 'Fixed-Width (Boxed Layout)',
};
}
}
12 changes: 12 additions & 0 deletions app-modules/portal/src/Filament/Pages/ManagePortalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@
use AidingApp\Portal\Enums\PortalType;
use Filament\Forms\Components\Actions;
use Filament\Forms\Components\Section;
use AidingApp\Portal\Enums\PortalLayout;
use Filament\Forms\Components\TextInput;
use App\Filament\Clusters\GlobalSettings;
use Filament\Forms\Components\ColorPicker;
use Filament\Forms\Components\ToggleButtons;
use Filament\Infolists\Components\TextEntry;
use FilamentTiptapEditor\Enums\TiptapOutput;
use AidingApp\Portal\Settings\PortalSettings;
use Filament\Forms\Components\Actions\Action;
use App\Filament\Forms\Components\ColorSelect;
use Laravel\Pennant\Feature as PennantFeature;
use App\Filament\Forms\Components\TiptapEditor;
use AidingApp\Portal\Actions\GeneratePortalEmbedCode;

Expand Down Expand Up @@ -94,6 +97,15 @@ public function form(Form $form): Form
->hintIconTooltip('Knowledge Management is not a part of your current subscription.')
->live()
->columnSpanFull(),
ToggleButtons::make('knowledge_management_portal_layout')
->options(PortalLayout::class)
->enum(PortalLayout::class)
->visible(fn (Get $get) => PennantFeature::active('portal-configuration-options') & $get('knowledge_management_portal_enabled'))
->disabled(! Gate::check(Feature::KnowledgeManagement->getGateName()))
->hintIcon(fn (ToggleButtons $component) => $component->isDisabled() ? 'heroicon-m-lock-closed' : null)
->hintIconTooltip('Knowledge Management is not a part of your current subscription.')
->inline()
->columnSpanFull(),
ColorSelect::make('knowledge_management_portal_primary_color')
->label('Primary Color')
->visible(fn (Get $get) => $get('knowledge_management_portal_enabled'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use Filament\Support\Colors\Color;
use Illuminate\Support\Facades\URL;
use App\Http\Controllers\Controller;
use AidingApp\Portal\Enums\PortalLayout;
use AidingApp\Portal\Settings\PortalSettings;

class KnowledgeManagementPortalController extends Controller
Expand All @@ -49,6 +50,7 @@ public function show(): JsonResponse
$settings = resolve(PortalSettings::class);

return response()->json([
'layout' => $settings->knowledge_management_portal_layout ?? PortalLayout::Full,
'primary_color' => Color::all()[$settings->knowledge_management_portal_primary_color ?? 'blue'],
'rounding' => $settings->knowledge_management_portal_rounding,
'requires_authentication' => $settings->knowledge_management_portal_requires_authentication,
Expand Down
2 changes: 2 additions & 0 deletions app-modules/portal/src/Settings/PortalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class PortalSettings extends Settings

public ?string $knowledge_management_portal_authorized_domain = null;

public ?string $knowledge_management_portal_layout = null;

public static function group(): string
{
return 'portal';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/*
<COPYRIGHT>
Copyright © 2016-2024, Canyon GBS LLC. All rights reserved.
Aiding App™ is licensed under the Elastic License 2.0. For more details,
see <https://github.com/canyongbs/aidingapp/blob/main/LICENSE.>
Notice:
- You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.
- You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.
- You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.
- Canyon GBS LLC respects the intellectual property rights of others and expects the
same in return. Canyon GBS™ and Aiding App™ are registered trademarks of
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks
vigorously.
- The software solution, including services, infrastructure, and code, is offered as a
Software as a Service (SaaS) by Canyon GBS LLC.
- Use of this software implies agreement to the license terms and conditions as stated
in the Elastic License 2.0.
For more information or inquiries please visit our website at
<https://www.canyongbs.com> or contact us via email at legal@canyongbs.com.
</COPYRIGHT>
*/

use Laravel\Pennant\Feature;
use Illuminate\Database\Migrations\Migration;

return new class () extends Migration {
public function up(): void
{
Feature::activate('portal-configuration-options');
}

public function down(): void
{
Feature::deactivate('portal-configuration-options');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/*
<COPYRIGHT>
Copyright © 2016-2024, Canyon GBS LLC. All rights reserved.
Aiding App™ is licensed under the Elastic License 2.0. For more details,
see <https://github.com/canyongbs/aidingapp/blob/main/LICENSE.>
Notice:
- You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.
- You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.
- You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.
- Canyon GBS LLC respects the intellectual property rights of others and expects the
same in return. Canyon GBS™ and Aiding App™ are registered trademarks of
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks
vigorously.
- The software solution, including services, infrastructure, and code, is offered as a
Software as a Service (SaaS) by Canyon GBS LLC.
- Use of this software implies agreement to the license terms and conditions as stated
in the Elastic License 2.0.
For more information or inquiries please visit our website at
<https://www.canyongbs.com> or contact us via email at legal@canyongbs.com.
</COPYRIGHT>
*/

use Spatie\LaravelSettings\Migrations\SettingsMigration;

return new class () extends SettingsMigration {
public function up(): void
{
$this->migrator->add('portal.knowledge_management_portal_layout', null);
}

public function down(): void
{
$this->migrator->delete('portal.knowledge_management_portal_layout');
}
};
4 changes: 4 additions & 0 deletions portals/knowledge-management/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
const hasServiceManagement = ref(false);
const showLogin = ref(false);
const portalLayout = ref('');
const portalPrimaryColor = ref('');
const portalRounding = ref('');
const categories = ref({});
Expand Down Expand Up @@ -153,6 +154,8 @@
portalPrimaryColor.value = response.data.primary_color;
portalLayout.value = response.data.layout;
setRequiresAuthentication(response.data.requires_authentication).then(() => {
requiresAuthentication.value = response.data.requires_authentication;
});
Expand Down Expand Up @@ -351,6 +354,7 @@
<template>
<div
class="font-sans bg-gray-50 min-h-screen"
:class="{ 'mx-0 md:mx-10 lg:mx-24': portalLayout === 'fixed' }"
:style="{
'--primary-50': portalPrimaryColor[50],
'--primary-100': portalPrimaryColor[100],
Expand Down

0 comments on commit f383c99

Please sign in to comment.