Skip to content

Commit 8686f8d

Browse files
authored
Merge pull request #4 from Misfits-BE/develop
Develop
2 parents 3af3c5a + c488fb7 commit 8686f8d

File tree

5 files changed

+6
-30
lines changed

5 files changed

+6
-30
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ All notable changes to `misfits/toastr` will be documented in this file.
55
## 1.1.0 - XXXX-XX-XX
66

77
- Fix #1 | Fix typo. (`signleton` to `singleton`)
8-
- Bring the javascript defer option to the package
98

109
## 1.0.0 - 2018-06-24
1110

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ Include jQuery and [toastr.js](https://github.com/CodeSeven/toastr) in your mast
2525
{!! Toastr::render() !!}
2626
```
2727

28-
If you defer the loading of your scripts include `Toastr::render(true)`
29-
30-
```html
31-
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js" defer></script>
32-
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js" defer></script>
33-
{!! Toastr::render(true) !!}
34-
```
35-
3628
Call one of these methods in your controllers to insert a toast:
3729
- `Toastr::warning($message, $title = null, $options = [])` - add a warning toast
3830
- `Toastr::error($message, $title = null, $options = [])` - add an error toast

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"extra": {
2424
"laravel": {
2525
"providers": ["ActivismeBe\\Toastr\\ToastrServiceProvider"],
26-
"aliases": {"Toastr": "ActivismeBe\\Toastr\\ToastrFacade"}
26+
"aliases": {"Toastr": "ActivismeBe\\Toastr\\Facade\\Toastr"}
2727
}
2828
}
2929
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ActivismeBe\Toastr;
3+
namespace ActivismeBe\Toastr\Facade;
44

55
use Illuminate\Support\Facades\Facade;
66

@@ -11,9 +11,9 @@
1111
*
1212
* @author Kamal Nasser <kamal@kamalnasser.net>
1313
* @copyright 2013 Kamal Nasser <kamal@kamalnasser.net>
14-
* @package ActivismeBe\Toastr
14+
* @package ActivismeBe\Toastr\Facade
1515
*/
16-
class ToastrFacade extends Facade
16+
class Toastr extends Facade
1717
{
1818
/**
1919
* Get the register name of the component.
@@ -22,6 +22,6 @@ class ToastrFacade extends Facade
2222
*/
2323
protected static function getFacadeAccessor(): string
2424
{
25-
return "Toastr";
25+
return "toastr";
2626
}
2727
}

src/Toastr.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,13 @@ public function __construct(SessionManager $session, Repository $config)
5454
/**
5555
* Render the notifications script tag
5656
*
57-
* @param bool $defer Indicates that the resources are loading with deferred option or not.
5857
* @return string
5958
*/
60-
public function render(bool $defer = false): string
59+
public function render(): string
6160
{
6261
$notifications = $this->session->get('toastr::notifications');
6362
$output = '<script type="text/javascript">';
6463
$lastconfig = [];
65-
66-
if ($defer) {
67-
$output = 'window.addEventListener("DOMContentLoaded", function() {
68-
(function($) {
69-
$(document).ready(function() {
70-
$(function(){';
71-
}
7264

7365
if (! $notifications) { // Notifications are empty so register a empty array under the variable.
7466
$notifications = [];
@@ -96,13 +88,6 @@ public function render(bool $defer = false): string
9688
(isset($notification['title']) ? ", '" . str_replace("'", "\\'", htmlentities($notification['title'])) . "'" : null) . ');';
9789
}
9890

99-
if ($defer) {
100-
$output = '});
101-
});
102-
})(jQuery);
103-
});';
104-
}
105-
10691
$output .= '</script>';
10792

10893
return $output;

0 commit comments

Comments
 (0)