Skip to content

Commit 44dc752

Browse files
committed
first init
1 parent 3732c7d commit 44dc752

18 files changed

+521
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/.idea
2+
/vendor
3+
/node_modules
4+
package-lock.json
5+
composer.phar
6+
composer.lock
7+
phpunit.xml
8+
.phpunit.result.cache
9+
.DS_Store
10+
Thumbs.db

.prettierrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
"tabWidth": 4,
3+
"vueIndentScriptAndStyle": true,
4+
"printWidth": 120,
5+
"singleQuote": true,
6+
"jsxSingleQuote": false,
7+
"trailingComma": "es5",
8+
"semi": true,
9+
"arrowParens": "always",
10+
"bracketSpacing": true,
11+
};

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Nova ProgressBar Field
2+
3+
4+
This package allows you to add progressbar fields to your resources and dashboards in [Nova](https://nova.laravel.com).
5+
6+
It basically takes a field with a decimal value between 0 and 1 and shows it as a percentage progress bar.
7+
8+
It edits like a text field.
9+
10+
<img src="https://github.com/flatroy/nova-progressbar-field/blob/master/img/screenshot-index.jpg" alt="index example">
11+
<img src="https://github.com/signifly/nova-progressbar-field/blob/master/img/screenshot-detail.jpg" alt="detail example">
12+
13+
#### DISCLAIMER:
14+
15+
This package is still work in progress. Feel free to help improve it.
16+
17+
[Original Package](https://packagist.org/packages/signifly/nova-progressbar-field)
18+
19+
- [Requirements](#requirements)
20+
- [Installation](#installation)
21+
- [Basic Usage](#basic-usage)
22+
- [Advanced Options](#advanced-options)
23+
24+
---
25+
26+
## Requirements
27+
28+
- [Laravel v9.0.\*](https://laravel.com/docs/9.0)
29+
- [Laravel Nova v4.\*](https://nova.laravel.com/docs/4.0/)
30+
31+
---
32+
33+
## Installation
34+
35+
Just run:
36+
37+
```bash
38+
composer require flatroy/nova-progressbar-field
39+
```
40+
41+
After this the setup will be complete, you can use the components listed here.
42+
43+
---
44+
45+
## Basic Usage
46+
47+
```php
48+
// in App\Nova\User
49+
...
50+
use Flatroy\FieldProgressbar\FieldProgressbar;
51+
...
52+
53+
/**
54+
* Get the fields displayed by the resource.
55+
*
56+
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
57+
* @return array
58+
*/
59+
public function fields(NovaRequest $request)
60+
{
61+
return [
62+
FieldProgressbar::make('Awesomeness'),
63+
];
64+
}
65+
66+
```
67+
68+
---
69+
70+
## Advanced Options
71+
72+
### Custom color
73+
74+
```php
75+
public function cards(NovaRequest $request)
76+
{
77+
return [
78+
FieldProgressbar::make('Awesomeness')
79+
->options([
80+
'color' => '#FFEA82',
81+
]),
82+
];
83+
}
84+
```
85+
86+
### Animate Bar Color A -> B
87+
88+
```php
89+
public function cards(NovaRequest $request)
90+
{
91+
return [
92+
FieldProgressbar::make('Awesomeness')
93+
->options([
94+
'fromColor' => '#FFEA82',
95+
'toColor' => '#40BF55',
96+
'animateColor' => true,
97+
]),
98+
];
99+
}
100+
```
101+
102+
Feel free to come with suggestions for improvements.
103+
104+
Packages based on this package: [nova-progressbar-field](https://github.com/signifly/nova-progressbar-field) by [Signifly](https://github.com/signifly)

composer.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "flatroy/nova-progressbar-field",
3+
"description": "A Laravel Nova progress bar field.",
4+
"keywords": [
5+
"laravel",
6+
"nova",
7+
"progressbar",
8+
"progress",
9+
"fields"
10+
],
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "George Daneke",
15+
"email": "[email protected]",
16+
"role": "Developer"
17+
},
18+
{
19+
"name": "Ro Kleine Sonne",
20+
"email": "[email protected]",
21+
"role": "Developer"
22+
}
23+
],
24+
"require": {
25+
"php": "^7.4|^8.0"
26+
},
27+
"autoload": {
28+
"psr-4": {
29+
"Flatroy\\FieldProgressbar\\": "src/"
30+
}
31+
},
32+
"extra": {
33+
"laravel": {
34+
"providers": [
35+
"Flatroy\\FieldProgressbar\\FieldServiceProvider"
36+
]
37+
}
38+
},
39+
"config": {
40+
"sort-packages": true
41+
},
42+
"minimum-stability": "dev",
43+
"prefer-stable": true
44+
}

dist/js/field.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/field.js.LICENSE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/*! For license information please see shifty.js.LICENSE.txt */

dist/mix-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"/js/field.js": "/js/field.js"
3+
}

img/screenshot-detail.jpg

31.1 KB
Loading

img/screenshot-index.jpg

83 KB
Loading

mix.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const mix = require('laravel-mix');
2+
const webpack = require('webpack');
3+
const path = require('path');
4+
5+
class NovaExtension {
6+
name() {
7+
return 'nova-extension';
8+
}
9+
10+
register(name) {
11+
this.name = name;
12+
}
13+
14+
webpackPlugins() {
15+
return new webpack.ProvidePlugin({
16+
_: 'lodash',
17+
Errors: 'form-backend-validation',
18+
});
19+
}
20+
21+
webpackConfig(webpackConfig) {
22+
webpackConfig.externals = {
23+
vue: 'Vue',
24+
};
25+
26+
webpackConfig.resolve.alias = {
27+
...(webpackConfig.resolve.alias || {}),
28+
'laravel-nova': path.join(__dirname, '../../vendor/laravel/nova/resources/js/mixins/packages.js'),
29+
};
30+
31+
webpackConfig.output = {
32+
uniqueName: this.name,
33+
};
34+
}
35+
}
36+
37+
mix.extend('nova', new NovaExtension());

0 commit comments

Comments
 (0)