Skip to content

Commit

Permalink
Updated to v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
realrashid committed Jun 14, 2019
1 parent bb0c0e6 commit 06e8961
Show file tree
Hide file tree
Showing 18 changed files with 521 additions and 152 deletions.
34 changes: 13 additions & 21 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<p align="center">
<a href="https://realrashid.github.io/sweet-alert/">
<img src="https://github.com/sweetalert2/sweetalert2/raw/master/assets/swal2-logo.png" alt="SweetAlert2">
</a>
</p>
<p align="center">
A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES FOR LARAVEL
</p>
<p align="center">
<img src="https://raw.github.com/sweetalert2/sweetalert2/master/assets/sweetalert2.gif" width="562" height="388">
</p>

<p align="center">
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"><img src="https://poser.pugx.org/realrashid/sweet-alert/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"><img src="https://poser.pugx.org/realrashid/sweet-alert/v/stable.svg" alt="Latest Stable Version"></a>
Expand All @@ -7,24 +19,4 @@
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"><img src="https://poser.pugx.org/realrashid/sweet-alert/license.svg" alt="License"></a>
</p>

# Introduction

A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES FOR LARAVEL

<p align="center">
<img src="https://raw.github.com/sweetalert2/sweetalert2/master/assets/sweetalert2.gif" width="562" height="388">
</p>

## Backers

Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/sweet-alert#backer)]

<a href="https://opencollective.com/sweet-alert#backers" target="_blank"><img src="https://opencollective.com/sweet-alert/backers.svg?width=890"></a>

## Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/sweet-alert#sponsor)]

<a href="https://opencollective.com/sweet-alert/sponsor/0/website" target="_blank"><img src="https://opencollective.com/sweet-alert/sponsor/0/avatar.svg"></a>

> note: if you are using sweet-alert v1.0 you can get README for v1.0 from [here](https://github.com/realrashid/sweet-alert/blob/1.0/readme.md)
!> note: if you are using sweet-alert v1.0 you can get README for v1.0 from [here](https://github.com/realrashid/sweet-alert/blob/1.0/readme.md)
10 changes: 6 additions & 4 deletions docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<h1>sweet-alert <small>1.1.2</small></h1>
![logo](https://sweetalert2.github.io/images/swal2-logo.png)
<h1>sweet-alert <small>2.0.0</small></h1>

<h4>By <strong>Rashid Ali</strong></h4>

> A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE,
ZERO DEPENDENCIES
<p>
A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES FOR LARAVEL
</p>


[GitHub](https://github.com/realrashid/sweet-alert)
[Get Started](/README)
[Get Started](/readme)
19 changes: 12 additions & 7 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
* Getting started

* [Installation](sweet-alert/install.md)
* [Configuration](sweet-alert/config.md)
* [Usage](sweet-alert/usage?id=usage)
* [Helpers](sweet-alert/helpers?id=helpers)
* [Middleware](sweet-alert/middleware?id=middleware)
* [Demo](sweet-alert/demo)
* [Installation](install.md)
* [Configuration](config.md)
* [Environment Variables](environment.md)
* [Usage](usage?id=usage)
* [Middleware](middleware?id=middleware)
* [Helpers](helpers?id=helpers)
* [Demo](demo)
* [Changelog](changelog)

* [Credits](sweet-alert/credits.md)
* Video Tutorial
* [Tutorial](tutorial.md)
* Credits
* [Credits](credits.md)
42 changes: 42 additions & 0 deletions docs/carbonad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
;(function(window) {
window.Carbon = {
scriptEl: null,
create: function() {
return function(hook, vm) {
hook.ready(function() {
window.Carbon.injectCarbonStyle();
})

hook.doneEach(function () {
window.Carbon.injectCarbonContainer();
})
}
},

injectCarbonContainer() {
let nav = document.getElementsByClassName('sidebar-nav')
let carbonContainer = document.createElement('script')
carbonContainer.src = '//cdn.carbonads.com/carbon.js?serve=CK7ICKQI&placement=realrashidgithubio'
carbonContainer.id = '_carbonads_js'
nav[0].insertBefore(carbonContainer, nav[0].firstChild)

if (document.getElementsByClassName('carbonads').length === 0) {
window._carbon && window._carbon.serve();
}
},

injectCarbonStyle() {
var carbonCss = document.createElement('style');
window.Carbon.injectCarbonContainer();
var css = '#carbonads{font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial,sans-serif}#carbonads{display: flex;max-width: 330px;background-color: hsl(0, 0%, 98%);box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, 0.1)}#carbonads a{color: inherit;text-decoration: none}#carbonads a:hover{color: inherit}#carbonads span{position: relative;display: block;overflow: hidden}#carbonads .carbon-wrap{display: flex}.carbon-img{display: block;margin: 0;line-height: 1}.carbon-img img{display: block}.carbon-text{font-size: 13px;padding: 10px;line-height: 1.5;text-align: left}.carbon-poweredby{display: block;padding: 8px 10px;background: repeating-linear-gradient(-45deg,transparent,transparent 5px,hsla(0, 0%, 0%, 0.025) 5px,hsla(0, 0%, 0%, 0.025) 10px)hsla(203, 11%, 95%, 0.4);text-align: center;text-transform: uppercase;letter-spacing: 0.5px;font-weight: 600;font-size: 9px;line-height: 1}';

carbonCss.type = 'text/css';
if (carbonCss.styleSheet){
carbonCss.styleSheet.cssText = css;
} else {
carbonCss.appendChild(document.createTextNode(css));
}
document.head.appendChild(carbonCss);
}
}
})(window)
59 changes: 59 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Changelog

All notable changes to `sweet-alert` will be documented in this file.

## v2.0 - 2019-06-14
- Upgraded SweetAlert2 to latest version
- Added width() helper method
- Added padding() helper method
- Added background() helper method
- Added animation() helper method
- Added focusConfirm() helper method
- Added focusCancel() helper method
- Added CDN Support
- Docs Updated
- Fix some bugs

Changes
```php
// From
public function toast($title = '', $type = '', $position = 'bottom-right'){...}
// To
public function toast($title = '', $type = ''){...}

// set the default position in package config file or use the helper method position()
```

## v1.1.2 - 2019-03-29
- Upgraded SweetAlert2 to latest version
- Added hideCloseButton() helper method
- Added reverseButtons() helper method
- Added image() method
- Added addImage() helper method
- Added position() helper method
- Docs Updated
- Fix some bugs

## v1.1.1 - 2018-03-25
Added some new methods
- `alert() method`
- `alert()->success() method`
- `alert()->info() method`
- `alert()->wanring() method`
- `alert()->question() method`
- `alert()->error() method`
- `alert()->html() method`
- `toast() method`
- `showConfirmButton() helper method`
- `showCloseButton() helper method`
- `showCancelButton() helper method`
- `persistent() helper method`
- `autoClose() helper method`
- `toToast() helper method`
- `footer() helper method`

## v1.0 - 2018-03-25
- Deprecated

## v1.0 - 2017-09-02
- initial release
16 changes: 8 additions & 8 deletions docs/codefund.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
;(function(window) {
window.DocsifyCodefund = {
window.Codefund = {
scriptEl: null,
create: function(codefundId) {
return function(hook, vm) {
hook.ready(function() {
window.DocsifyCodefund.injectCodeFundStyle();
window.Codefund.injectCodeFundStyle();
})

hook.doneEach(function () {
window.DocsifyCodefund.injectCodeFundScript(codefundId);
window.DocsifyCodefund.injectCodeFundContainer();
window.Codefund.injectCodeFundScript(codefundId);
window.Codefund.injectCodeFundContainer();
})
}
},
Expand All @@ -26,20 +26,20 @@
},

injectCodeFundScript(codefundId) {
if (window.DocsifyCodefund.scriptEl) {
window.DocsifyCodefund.scriptEl.remove()
if (window.Codefund.scriptEl) {
window.Codefund.scriptEl.remove()
}

var script = document.createElement('script')
script.src = "https://codefund.app/properties/" + codefundId + "/funder.js"
script.async = "async"
document.body.appendChild(script)
window.DocsifyCodefund.scriptEl = script
window.Codefund.scriptEl = script
},

injectCodeFundStyle() {
var style = document.createElement('style');
window.DocsifyCodefund.injectCodeFundContainer();
window.Codefund.injectCodeFundContainer();
var css = '#cf span.cf-wrapper { background-color: transparent!important } #cf a.cf-text { color: #444!important; font-weight: 400!important; font-size: 10px!important }';

style.type = 'text/css';
Expand Down
44 changes: 19 additions & 25 deletions docs/config.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
# Configuration

> Optional in Laravel 5.5 or above
### Include SweetAlert 2 View

After installing the sweet-alert package, register the
in your master layout

```php
RealRashid\SweetAlert\SweetAlertServiceProvider::class
@include('sweetalert::alert')
```
in your `config/app.php` configuration file:

```php
'providers' => [
// Other service providers...
and run the below command to publish the package assets.

RealRashid\SweetAlert\SweetAlertServiceProvider::class,
],
```bash
php artisan vendor:publish --provider="RealRashid\SweetAlert\SweetAlertServiceProvider"
```

Also, add the `Alert` facade to the `aliases` array in your `app` configuration file:
> note: The javascript library of sweetalert2 is already loaded and included in the view with the help of above command!
```php
'Alert' => RealRashid\SweetAlert\Facades\Alert::class,
```

# Include SweetAlert 2 View

in your master layout
!> If you don't want to use pre-loaded **sweetalert.all.js** so you can use cdn.
Just chnage the below .env key.

```php
@include('sweetalert::alert')
// By Default its true
// Turn it to false
SWEET_ALERT_LOCAL=false
// Add sweetalert2 cdn link
SWEET_ALERT_CDN=''
```
!> You can not use local **sweetalert.all.js** or cdn together!

and run the below command to publish the sweetalert.all.js in your public assets.

```bash
php artisan vendor:publish --provider="RealRashid\SweetAlert\SweetAlertServiceProvider"
ex:
```php
SWEET_ALERT_LOCAL=true
SWEET_ALERT_CDN='link'
```

> note: the javascript library of sweetalert.all.js is already loaded in above included view
41 changes: 0 additions & 41 deletions docs/configuration.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/credits.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Credits
# Credits

* [SweetAlert2](https://github.com/sweetalert2/sweetalert2)

Expand Down
12 changes: 7 additions & 5 deletions docs/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ alert()->html('<i>HTML</i> <u>example</u>',"

# Toast Demo

> Set the Default Toast Position in `config/sweetalert.php` file OR use the `position()` helper method!
##### Success Toast

``` php
toast('Success Toast','success','top-right');
toast('Success Toast','success');
```

<p align="center">
Expand All @@ -89,7 +91,7 @@ toast('Success Toast','success','top-right');
##### Info Toast

``` php
toast('Info Toast','info','top-right');
toast('Info Toast','info');
```

<p align="center">
Expand All @@ -99,7 +101,7 @@ toast('Info Toast','info','top-right');
##### Warning Toast

``` php
toast('Warning Toast','warning','top-right');
toast('Warning Toast','warning');
```

<p align="center">
Expand All @@ -109,7 +111,7 @@ toast('Warning Toast','warning','top-right');
##### Question Toast

``` php
toast('Question Toast','question','top-right');
toast('Question Toast','question');
```

<p align="center">
Expand All @@ -119,7 +121,7 @@ toast('Question Toast','question','top-right');
##### Error Toast

``` php
toast('Error Toast','error','top-right');
toast('Error Toast','error');
```

<p align="center">
Expand Down
Loading

0 comments on commit 06e8961

Please sign in to comment.