Skip to content

Commit

Permalink
Home dashboard widgets (#39)
Browse files Browse the repository at this point in the history
* chore: install chart.js

* feat: chart assets

* feat: home dashboard config

* feat: include chart js to assets

* feat: home views

* feat: widget views

* fix: image column

* feat: widgets

* feat: widget generators

* fix: searchable

* fix: relation filter

* test: widgets

* feat: include chart js to assets

* docs: post-update-cmd

* test: widget generator command

* feat: top menu buttons
  • Loading branch information
faustoq committed Jul 7, 2023
1 parent ce6750e commit b399006
Show file tree
Hide file tree
Showing 42 changed files with 1,013 additions and 7,451 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Flatpack is a reactive full-stack app, built with [TALL stack](https://tallstack
---
## Quick Install

You can install the package via composer:
Install the package via composer:

```bash
composer require flatpack/flatpack
Expand All @@ -39,7 +39,13 @@ Publish the config file and compiled assets:
php artisan vendor:publish --tag="flatpack"
```

💡 To make sure that the public assets are always up-to-date, you should add this command to the `post-update-cmd` list in your `composer.json` file.
Note: To make sure that the public assets are always up-to-date, remember to add this command to the `post-update-cmd` list in your `composer.json` file.

```json
"post-update-cmd": [
"@php artisan vendor:publish --tag=flatpack"
],
```


## Usage
Expand All @@ -52,12 +58,12 @@ php artisan make:flatpack Post

This command will create two files:

- A form template `/flatpack/posts/form.yaml`, that defines the layout composition of your posts form.
- A list template `/flatpack/posts/list.yaml`, that defines the layout composition of your posts table with pagination.
- A form template `/flatpack/posts/form.yaml`, that defines the posts form.
- A list template `/flatpack/posts/list.yaml`, that defines the posts table with pagination.

Let's check the result, visit `/backend/posts`.
Let's check the result, visit [/backend/posts](http://localhost/backend/posts).

Now start assembling, grab the generated files and define how they should look!
Now start assembling, grab the generated files and map your model's attributes as you need.

## Examples

Expand Down Expand Up @@ -101,6 +107,7 @@ Defining a list:
title: Post
model: App\Models\Post
icon: book-open
order: 1

toolbar:
create:
Expand Down
57 changes: 34 additions & 23 deletions config/flatpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,13 @@

/*
|--------------------------------------------------------------------------
| Actions
| Models directory
|--------------------------------------------------------------------------
|
| Flatpack form or list actions. You can add your own actions here.
| The namespace where Flatpack should find your Eloquent Models.
|
*/
'actions' => [

'save' => \Flatpack\Actions\Save::class,

'upload' => \Flatpack\Actions\Upload::class,

'delete' => \Flatpack\Actions\Delete::class,

'restore' => \Flatpack\Actions\Restore::class,

'empty-trash' => \Flatpack\Actions\EmptyTrash::class,
],
'models' => env('FLATPACK_MODELS', "App\\Models"),

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -71,6 +60,37 @@
*/
'navigation' => [],

/*
|--------------------------------------------------------------------------
| Dashboard
|--------------------------------------------------------------------------
|
| Define custom blocks for the home dashboard.
|
*/
'dashboard' => [],

/*
|--------------------------------------------------------------------------
| Actions
|--------------------------------------------------------------------------
|
| Flatpack form or list actions. You can add your own actions here.
|
*/
'actions' => [

'save' => \Flatpack\Actions\Save::class,

'upload' => \Flatpack\Actions\Upload::class,

'delete' => \Flatpack\Actions\Delete::class,

'restore' => \Flatpack\Actions\Restore::class,

'empty-trash' => \Flatpack\Actions\EmptyTrash::class,
],

/*
|--------------------------------------------------------------------------
| Route Prefix
Expand Down Expand Up @@ -109,15 +129,6 @@
'path' => env('FLATPACK_STORAGE_PATH', 'uploads'),
],

/*
|--------------------------------------------------------------------------
| Models directory
|--------------------------------------------------------------------------
|
| The namespace where Flatpack should find your Eloquent Models.
|
*/
'models' => env('FLATPACK_MODELS', "App\\Models"),

/*
|--------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"/public/js/alpine.js": "/public/js/alpine.js",
"/public/js/flatpack.js": "/public/js/flatpack.js",
"/public/js/chart.js": "/public/js/chart.js",
"/public/js/form.js": "/public/js/form.js",
"/public/js/list.js": "/public/js/list.js",
"/public/js/editorjs.js": "/public/js/editorjs.js",
Expand Down
19 changes: 19 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@yaireo/tagify": "^4.17.8",
"alpinejs": "^3.9.6",
"autoprefixer": "^10.4.14",
"chart.js": "^4.3.0",
"cross-env": "^7.0.2",
"laravel-mix": "^6.0.49",
"postcss": "^8.4.5",
Expand Down

0 comments on commit b399006

Please sign in to comment.