Skip to content

Commit

Permalink
Merge pull request #511 from canyongbs/feature/ADVAPP-298-portal
Browse files Browse the repository at this point in the history
[ADVAPP-298]: Introduce Knowledge Management Portal
  • Loading branch information
Orrison authored Feb 8, 2024
2 parents 6ce1b50 + ff06b5a commit 7cb19eb
Show file tree
Hide file tree
Showing 52 changed files with 2,634 additions and 75 deletions.
66 changes: 34 additions & 32 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
{
"plugins": ["@shufo/prettier-plugin-blade"],
"overrides": [
{
"files": ["*.blade.php"],
"options": {
"printWidth": 120,
"tabWidth": 4,
"singleQuote": true,
"wrapAttributes": "force-expand-multiline",
"sortTailwindcssClasses": true,
"sortHtmlAttributes": "code-guide",
"parser": "blade"
}
},
{
"files": ["*.js", "*.css", "*.vue"],
"options": {
"printWidth": 120,
"tabWidth": 4,
"singleQuote": true,
"wrapAttributes": "force-expand-multiline"
}
},
{
"files": ["*.json"],
"options": {
"tabWidth": 4
"plugins": ["@shufo/prettier-plugin-blade"],
"overrides": [
{
"files": ["*.blade.php"],
"options": {
"printWidth": 120,
"tabWidth": 4,
"singleQuote": true,
"wrapAttributes": "force-expand-multiline",
"sortTailwindcssClasses": true,
"sortHtmlAttributes": "code-guide",
"parser": "blade"
}
},
{
"files": ["*.js", "*.css", "*.vue"],
"options": {
"printWidth": 120,
"tabWidth": 4,
"singleQuote": true,
"wrapAttributes": "force-expand-multiline",
"sortTailwindcssClasses": true,
"sortHtmlAttributes": "code-guide"
}
},
{
"files": ["*.json"],
"options": {
"tabWidth": 4
}
},
{
"files": ["*.graphql"]
}
},
{
"files": ["*.graphql"]
}
]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function definition(): array
{
return [
'name' => $this->faker->word(),
'description' => $this->faker->sentences(2, true),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function up(): void
Schema::create('knowledge_base_categories', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('name');
$table->longText('description')->nullable();
$table->timestamps();
$table->softDeletes();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
namespace AdvisingApp\KnowledgeBase\Filament\Resources\KnowledgeBaseCategoryResource\Pages;

use Filament\Forms\Form;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\CreateRecord;
use AdvisingApp\KnowledgeBase\Filament\Resources\KnowledgeBaseCategoryResource;
Expand All @@ -53,6 +54,10 @@ public function form(Form $form): Form
->label('Name')
->required()
->string(),
Textarea::make('description')
->label('Description')
->nullable()
->string(),
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@

namespace AdvisingApp\KnowledgeBase\Filament\Resources\KnowledgeBaseCategoryResource\Pages;

use Filament\Actions;
use Filament\Forms\Form;
use Filament\Actions\ViewAction;
use Filament\Actions\DeleteAction;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\EditRecord;
use AdvisingApp\KnowledgeBase\Filament\Resources\KnowledgeBaseCategoryResource;
Expand All @@ -54,14 +56,18 @@ public function form(Form $form): Form
->label('Name')
->required()
->string(),
Textarea::make('description')
->label('Description')
->nullable()
->string(),
]);
}

protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
ViewAction::make(),
DeleteAction::make(),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

namespace AdvisingApp\KnowledgeBase\Filament\Resources\KnowledgeBaseCategoryResource\Pages;

use Filament\Actions;
use Filament\Actions\EditAction;
use Filament\Infolists\Infolist;
use Filament\Resources\Pages\ViewRecord;
use Filament\Infolists\Components\Section;
Expand All @@ -54,8 +54,9 @@ public function infolist(Infolist $infolist): Infolist
Section::make()
->schema([
TextEntry::make('name')
->label('Name')
->translateLabel(),
->label('Name'),
TextEntry::make('description')
->label('Description'),
])
->columns(),
]);
Expand All @@ -64,7 +65,7 @@ public function infolist(Infolist $infolist): Infolist
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
EditAction::make(),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class KnowledgeBaseCategory extends BaseModel implements Auditable

protected $fillable = [
'name',
'description',
];

public function knowledgeBaseItems(): HasMany
Expand Down
5 changes: 5 additions & 0 deletions app-modules/knowledge-base/src/Models/KnowledgeBaseItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public function registerMediaCollections(): void
$this->addMediaCollection('notes');
}

public function scopePublic($query)
{
return $query->where('public', true);
}

protected function serializeDate(DateTimeInterface $date): string
{
return $date->format(config('project.datetime_format') ?? 'Y-m-d H:i:s');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ public function up(): void
/**
* Knowledge Base Portal
*/
$this->migrator->add('portal.knowledge_base_portal_enabled', false);
$this->migrator->add('portal.knowledge_base_portal_service_management', false);
$this->migrator->add('portal.knowledge_base_portal_primary_color');
$this->migrator->add('portal.knowledge_base_portal_rounding');
$this->migrator->add('portal.knowledge_base_portal_authorized_domain');
$this->migrator->add('portal.knowledge_management_portal_enabled', false);
$this->migrator->add('portal.knowledge_management_portal_service_management', false);
$this->migrator->add('portal.knowledge_management_portal_primary_color');
$this->migrator->add('portal.knowledge_management_portal_rounding');
$this->migrator->add('portal.knowledge_management_portal_authorized_domain');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{--
<COPYRIGHT>
Copyright © 2016-2024, Canyon GBS LLC. All rights reserved.
Advising App™ is licensed under the Elastic License 2.0. For more details,
see https://github.com/canyongbs/advisingapp/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 Advising 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>
--}}
@php
use AdvisingApp\Portal\Enums\PortalType;
use AdvisingApp\Portal\Actions\GeneratePortalEmbedCode;
@endphp

<div class="flex items-center justify-center">
<div class="w-full max-w-full">
{!! resolve(GeneratePortalEmbedCode::class)->handle(PortalType::KnowledgeManagement) !!}
</div>
</div>
66 changes: 66 additions & 0 deletions app-modules/portal/routes/api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

/*
<COPYRIGHT>
Copyright © 2016-2024, Canyon GBS LLC. All rights reserved.
Advising App™ is licensed under the Elastic License 2.0. For more details,
see https://github.com/canyongbs/advisingapp/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 Advising 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 Illuminate\Support\Facades\Route;
use AdvisingApp\Portal\Http\Middleware\EnsureKnowledgeManagementPortalIsEnabled;
use AdvisingApp\Portal\Http\Controllers\KnowledgeManagement\KnowledgeManagementPortalController;
use AdvisingApp\Portal\Http\Middleware\EnsureKnowledgeManagementPortalIsEmbeddableAndAuthorized;
use AdvisingApp\Portal\Http\Controllers\KnowledgeManagement\KnowledgeManagementPortalSearchController;
use AdvisingApp\Portal\Http\Controllers\KnowledgeManagement\KnowledgeManagementPortalArticleController;
use AdvisingApp\Portal\Http\Controllers\KnowledgeManagement\KnowledgeManagementPortalCategoryController;

Route::prefix('api')
->middleware([
'api',
EnsureKnowledgeManagementPortalIsEnabled::class,
EnsureKnowledgeManagementPortalIsEmbeddableAndAuthorized::class,
])
->group(function () {
Route::prefix('portal/knowledge-management')
->name('portal.knowledge-management.')
->group(function () {
Route::get('/', [KnowledgeManagementPortalController::class, 'show'])
->middleware(['signed'])
->name('define');
Route::post('/search', [KnowledgeManagementPortalSearchController::class, 'get'])
->middleware(['signed'])
->name('search');
Route::get('/categories/{category}', [KnowledgeManagementPortalCategoryController::class, 'show'])
->name('category.show');
Route::get('/categories/{category}/articles/{article}', [KnowledgeManagementPortalArticleController::class, 'show'])
->name('article.show');
});
});
59 changes: 59 additions & 0 deletions app-modules/portal/routes/web.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

/*
<COPYRIGHT>
Copyright © 2016-2024, Canyon GBS LLC. All rights reserved.
Advising App™ is licensed under the Elastic License 2.0. For more details,
see https://github.com/canyongbs/advisingapp/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 Advising 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 Illuminate\Support\Facades\Route;
use AdvisingApp\Portal\Livewire\RenderKnowledgeManagementPortal;
use AdvisingApp\Portal\Http\Middleware\EnsureKnowledgeManagementPortalIsEnabled;
use AdvisingApp\Portal\Http\Middleware\EnsureKnowledgeManagementPortalIsEmbeddableAndAuthorized;

Route::prefix('portals')
->name('portals.')
->middleware([
'web',
])
->group(function () {
Route::middleware([
EnsureKnowledgeManagementPortalIsEnabled::class,
EnsureKnowledgeManagementPortalIsEmbeddableAndAuthorized::class,
])->group(function () {
Route::get('/knowledge-management', RenderKnowledgeManagementPortal::class)
->name('knowledge-management.show');
Route::get('/knowledge-management/categories/{category}', RenderKnowledgeManagementPortal::class)
->name('knowledge-management.category.show');
Route::get('/knowledge-management/categories/{category}/articles/{article}', RenderKnowledgeManagementPortal::class)
->name('knowledge-management.article.show');
});
});
Loading

0 comments on commit 7cb19eb

Please sign in to comment.