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

Actually just skrolikowski's Addon Overview #339 #372

Open
wants to merge 3 commits into
base: nightly
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions helpers/menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
function menu($handle)
{
$model = Navigation::where('handle', $handle)->firstOrFail();
$menu = $model->nodes->mapWithKeys(function ($node) {
if ($node->status) {
$menu = $model->links->mapWithKeys(function ($link) {
if ($link->status) {
$item = [
'title' => $node->name,
'to' => $node->url,
'target' => $node->new_window ? '_blank' : '_self',
'title' => $link->name,
'to' => $link->url,
'target' => $link->new_window ? '_blank' : '_self',
];

foreach ($node->fields as $field) {
$item[$field->handle] = $node->{$field->handle} ?? null;
foreach ($link->fields as $field) {
$item[$field->handle] = $link->{$field->handle} ?? null;
}

return [str_handle($node->name) => $item];
return [str_handle($link->name) => $item];
}
});

Expand Down
1 change: 1 addition & 0 deletions permissions/fusion.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
return [
// core permissions
// --
'addons' => ['viewAny'],
'backups' => ['viewAny', 'view', 'create', 'update', 'delete', 'restore'],
'directories' => ['viewAny', 'view', 'create', 'update', 'delete'],
'disks' => ['viewAny', 'view', 'create', 'update', 'delete'],
Expand Down
1 change: 1 addition & 0 deletions public/js/chunks/2688.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/js/gravity.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/js/gravity.js": "/js/gravity.js?id=5b8d47ce77e8feb2f789",
"/js/gravity.js": "/js/gravity.js?id=8a4a9cadbf3ebd8d94f5",
"/css/gravity.css": "/css/gravity.css?id=23dc0a5a410fd0b66b0d",
"/img/audio-large.svg": "/img/audio-large.svg?id=fca6a67c7ef06d00ef4a",
"/img/audio-small.svg": "/img/audio-small.svg?id=48f5a5c5ff1cfd2cb375",
Expand Down
37 changes: 37 additions & 0 deletions resources/js/pages/Addons/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template>
<div class="form-page">
<portal to="title">
<page-title icon="puzzle-piece">Addons</page-title>
</portal>

<ui-card>
<ui-card-body>
<ui-table :endpoint="endpoint" id="addons" sort-by="name" primary-key="name" key="addons_table">
<template slot="version" slot-scope="table">
<code>{{ table.record.version }}</code>
</template>

<template slot="description" slot-scope="table">
<span class="text-gray-800 text-sm">{{ table.record.description }}</span>
</template>
</ui-table>
</ui-card-body>
</ui-card>
</div>
</template>

<script>
export default {
auth() {
return {
permission: 'addons.viewAny',
}
},

data() {
return {
endpoint: '/datatable/addons',
}
}
}
</script>
9 changes: 9 additions & 0 deletions resources/js/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ const router = new Router({
layout: 'admin',
},
},
{
path: '/addons',
component: () => import('@/pages/Addons/Index'),
name: 'addons',
meta: {
requiresAuth: true,
layout: 'admin',
},
},
{
path: '/users',
component: () => import('@/pages/Users/Index'),
Expand Down
1 change: 1 addition & 0 deletions routes/datatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
Route::get('/{role}/permissions', 'PermissionController@index');
});

Route::get('/addons', 'AddonController@index');
Route::get('/permissions', 'PermissionController@index');
Route::get('/taxonomies', 'TaxonomyController@index');
Route::get('/forms', 'FormController@index');
Expand Down
50 changes: 50 additions & 0 deletions src/Http/Controllers/DataTable/AddonController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Fusion\Http\Controllers\DataTable;

use Fusion\Http\Controllers\DataTableController;
use Fusion\Models\Addon;

class AddonController extends DataTableController
{
public function builder()
{
return Addon::query();
}

public function getDisplayableColumns()
{
return [
'name',
'version',
'description',
];
}

public function getFilterable()
{
return [
'name',
'version',
'description',
];
}

public function getSortable()
{
return [
'name',
'version',
'description',
];
}

public function getCustomColumnNames()
{
return [
'name' => 'Name',
'version' => 'Version',
'description' => 'Description',
];
}
}
22 changes: 22 additions & 0 deletions src/Models/Addon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Fusion\Models;

use Fusion\Concerns\HasLocalEloquentData;
use Fusion\Database\Eloquent\Model;

class Addon extends Model
{
use HasLocalEloquentData;

public function getRows()
{
return app('addons.manifest')->addons()->map(function ($addon) {
return [
'name' => $addon['name'],
'version' => $addon['version'],
'description' => $addon['description']
];
})->values()->toArray();
}
}
1 change: 1 addition & 0 deletions src/Providers/MenuServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private function adminNavigation()
'dashboard' => ['title' => 'Dashboard', 'to' => '/', 'icon' => 'grip-horizontal', 'permission' => 'access.controlPanel'],
'filemanager' => $this->getFileManagerDisks(),
'inbox' => ['title' => 'Inbox', 'to' => '/inbox', 'icon' => 'inbox'],
'addons.list' => ['title' => 'Addons', 'to' => '/addons', 'icon' => 'puzzle-piece'],
]);

// matrices
Expand Down