You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
clean up code
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
.idea/
|
||||
vendor/
|
||||
.idea
|
||||
vendor
|
||||
composer.lock
|
||||
.phpunit.result.cache
|
||||
.phpcs-cache
|
||||
|
||||
@@ -2,39 +2,12 @@
|
||||
|
||||
return array(
|
||||
'scripts' => array(
|
||||
'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.js',
|
||||
'/vendor/flasher/flasher-notyf.js',
|
||||
),
|
||||
'styles' => array(
|
||||
'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.css',
|
||||
'https://cdn.jsdelivr.net/npm/@flasher/flasher-notyf@0.1.5/dist/flasher-notyf.min.js',
|
||||
),
|
||||
'styles' => array(),
|
||||
'options' => array(
|
||||
'duration' => 5000,
|
||||
'ripple' => true,
|
||||
'position' => array(
|
||||
'x' => 'right',
|
||||
'y' => 'top',
|
||||
),
|
||||
'dismissible' => false,
|
||||
'types' => array(
|
||||
array(
|
||||
'type' => 'success',
|
||||
'className' => 'notyf__toast--success',
|
||||
'backgroundColor' => '#3dc763',
|
||||
'icon' => array(
|
||||
'className' => 'notyf__icon--success',
|
||||
'tagName' => 'i',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'error',
|
||||
'className' => 'notyf__toast--error',
|
||||
'backgroundColor' => '#ed3d3d',
|
||||
'icon' => array(
|
||||
'className' => 'notyf__icon--error',
|
||||
'tagName' => 'i',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'info',
|
||||
'className' => 'notyf__toast--info',
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
PHPFlasher.addFactory('notyf', (function () {
|
||||
'use strict';
|
||||
|
||||
var exports = {};
|
||||
|
||||
exports.render = function (data) {
|
||||
window.notyf.open(data.notification);
|
||||
};
|
||||
|
||||
exports.renderOptions = function (options) {
|
||||
if ("undefined" === typeof window.notyf) {
|
||||
window.notyf = new Notyf(options);
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
})());
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
namespace Flasher\Notyf\Laravel\ServiceProvider\Providers;
|
||||
|
||||
use Flasher\Laravel\ServiceProvider\ResourceManagerHelper;
|
||||
use Flasher\Notyf\Laravel\FlasherNotyfServiceProvider;
|
||||
use Flasher\Notyf\Prime\NotyfFactory;
|
||||
use Flasher\Prime\Flasher;
|
||||
use Flasher\Prime\Response\Resource\ResourceManager;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Foundation\Application;
|
||||
|
||||
@@ -37,7 +39,6 @@ class Laravel implements ServiceProviderInterface
|
||||
public function boot(FlasherNotyfServiceProvider $provider)
|
||||
{
|
||||
$provider->publishes(array(flasher_path(__DIR__.'/../../Resources/config/config.php') => config_path('flasher_notyf.php')), 'flasher-config');
|
||||
$provider->publishes(array(flasher_path(__DIR__.'/../../Resources/public') => public_path(flasher_path('vendor/flasher'))), 'flasher-public');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,6 +65,12 @@ class Laravel implements ServiceProviderInterface
|
||||
|
||||
return $manager;
|
||||
});
|
||||
|
||||
$this->app->extend('flasher.resource_manager', function (ResourceManager $resourceManager) {
|
||||
ResourceManagerHelper::process($resourceManager, 'notyf');
|
||||
|
||||
return $resourceManager;
|
||||
});
|
||||
}
|
||||
|
||||
protected function appendToFlasherConfig()
|
||||
|
||||
@@ -24,39 +24,12 @@ class FlasherNotyfServiceProviderTest extends TestCase
|
||||
|
||||
$expected = array(
|
||||
'scripts' => array(
|
||||
'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.js',
|
||||
'/vendor/flasher/flasher-notyf.js',
|
||||
),
|
||||
'styles' => array(
|
||||
'https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.css',
|
||||
'https://cdn.jsdelivr.net/npm/@flasher/flasher-notyf@0.1.5/dist/flasher-notyf.min.js',
|
||||
),
|
||||
'styles' => array(),
|
||||
'options' => array(
|
||||
'duration' => 5000,
|
||||
'ripple' => true,
|
||||
'position' => array(
|
||||
'x' => 'right',
|
||||
'y' => 'top',
|
||||
),
|
||||
'dismissible' => false,
|
||||
'types' => array(
|
||||
array(
|
||||
'type' => 'success',
|
||||
'className' => 'notyf__toast--success',
|
||||
'backgroundColor' => '#3dc763',
|
||||
'icon' => array(
|
||||
'className' => 'notyf__icon--success',
|
||||
'tagName' => 'i',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'error',
|
||||
'className' => 'notyf__toast--error',
|
||||
'backgroundColor' => '#ed3d3d',
|
||||
'icon' => array(
|
||||
'className' => 'notyf__icon--error',
|
||||
'tagName' => 'i',
|
||||
),
|
||||
),
|
||||
'duration' => 5000,
|
||||
'types' => array(
|
||||
array(
|
||||
'type' => 'info',
|
||||
'className' => 'notyf__toast--info',
|
||||
@@ -68,7 +41,7 @@ class FlasherNotyfServiceProviderTest extends TestCase
|
||||
'className' => 'notyf__toast--warning',
|
||||
'backgroundColor' => '#E3A008',
|
||||
'icon' => false,
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"php-flasher/flasher-laravel": "^0.1",
|
||||
"php-flasher/flasher-notyf": "^0.1"
|
||||
"php-flasher/flasher-laravel": "@dev",
|
||||
"php-flasher/flasher-notyf": "@dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0|^9.0",
|
||||
|
||||
Reference in New Issue
Block a user