-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
152 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
/** | ||
* @package yii2-dialog | ||
* @author Kartik Visweswaran <[email protected]> | ||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2016 | ||
* @version 1.0.3 | ||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2017 | ||
* @version 1.0.2 | ||
*/ | ||
|
||
namespace kartik\dialog; | ||
|
@@ -155,6 +155,12 @@ class Dialog extends Widget | |
*/ | ||
public $showDraggable = true; | ||
|
||
/** | ||
* @var boolean whether to override the yii javascript confirmation dialog (set via `data-confirm`) | ||
* with KrajeeDialog confirmation dialog. | ||
*/ | ||
public $overrideYiiConfirm = true; | ||
|
||
/** | ||
* @var string the identifying name of the public javascript id that will hold the settings for KrajeeDialog | ||
* javascript object instance. Defaults to `krajeeDialog`. | ||
|
@@ -207,7 +213,7 @@ public function initOptions() | |
'title' => $info, | ||
'buttons' => [ | ||
['label' => $cancel, 'icon' => self::ICON_CANCEL], | ||
['label' => $ok, 'icon' => self::ICON_OK, 'class' => 'btn-primary'], | ||
['label' => $ok, 'icon' => self::ICON_OK, 'cssClass' => 'btn-primary'], | ||
] | ||
]; | ||
$otherDialog['draggable'] = true; | ||
|
@@ -255,5 +261,9 @@ public function registerAssets() | |
window.{$this->libName}=new KrajeeDialog({$flag},{$optsVar},{$defaultsVar}); | ||
JS; | ||
$view->registerJs($script, $pos); | ||
if ($this->overrideYiiConfirm) { | ||
DialogYiiAsset::register($view); | ||
$view->registerJs("krajeeYiiConfirm('{$this->libName}');"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* @package yii2-dialog | ||
* @author Kartik Visweswaran <[email protected]> | ||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 | ||
* @version 1.0.3 | ||
* @version 1.0.2 | ||
*/ | ||
|
||
namespace kartik\dialog; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* @package yii2-dialog | ||
* @author Kartik Visweswaran <[email protected]> | ||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 | ||
* @version 1.0.3 | ||
* @version 1.0.2 | ||
*/ | ||
|
||
namespace kartik\dialog; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* @package yii2-dialog | ||
* @author Kartik Visweswaran <[email protected]> | ||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 | ||
* @version 1.0.2 | ||
*/ | ||
|
||
namespace kartik\dialog; | ||
|
||
use yii\web\View; | ||
use kartik\base\AssetBundle; | ||
|
||
/** | ||
* Asset bundle that overrides Yii's default confirm dialog | ||
* | ||
* @author Kartik Visweswaran <[email protected]> | ||
* @since 1.0 | ||
*/ | ||
class DialogYiiAsset extends AssetBundle | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public $depends = [ | ||
'yii\web\YiiAsset', | ||
'kartik\dialog\DialogAsset', | ||
]; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function init() | ||
{ | ||
$this->setSourcePath(__DIR__ . '/assets'); | ||
$this->setupAssets('js', ['js/dialog-yii']); | ||
parent::init(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/*! | ||
* @package yii2-dialog | ||
* @author Kartik Visweswaran <[email protected]> | ||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2017 | ||
* @version 1.0.2 | ||
* | ||
* Override Yii confirmation dialog with Krajee Dialog. | ||
* | ||
* Author: Kartik Visweswaran | ||
* Copyright: 2015, Kartik Visweswaran, Krajee.com | ||
* For more JQuery plugins visit http://plugins.krajee.com | ||
* For more Yii related demos visit http://demos.krajee.com | ||
*/ | ||
var krajeeYiiConfirm; | ||
(function () { | ||
"use strict"; | ||
krajeeYiiConfirm = function(dialog) { | ||
dialog = dialog || 'krajeeDialog'; | ||
var krajeeDialog = window[dialog] || ''; | ||
if (!krajeeDialog) { | ||
return; | ||
} | ||
yii.confirm = function (message, ok, cancel) { | ||
krajeeDialog.confirm(message, function(result) { | ||
if (result) { | ||
!ok || ok(); | ||
} else { | ||
!cancel || cancel(); | ||
} | ||
}); | ||
}; | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/*! | ||
* @package yii2-dialog | ||
* @author Kartik Visweswaran <[email protected]> | ||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2017 | ||
* @version 1.0.2 | ||
* | ||
* Override Yii confirmation dialog with Krajee Dialog. | ||
* | ||
* Author: Kartik Visweswaran | ||
* Copyright: 2015, Kartik Visweswaran, Krajee.com | ||
* For more JQuery plugins visit http://plugins.krajee.com | ||
* For more Yii related demos visit http://demos.krajee.com | ||
*/var krajeeYiiConfirm;!function(){"use strict";krajeeYiiConfirm=function(i){i=i||"krajeeDialog";var n=window[i]||"";n&&(yii.confirm=function(i,o,r){n.confirm(i,function(i){i?!o||o():!r||r()})})}}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/*! | ||
* @package yii2-dialog | ||
* @author Kartik Visweswaran <[email protected]> | ||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2016 | ||
* @version 1.0.3 | ||
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2017 | ||
* @version 1.0.2 | ||
* | ||
* Provides a polyfill for javascript native alert, confirm, and prompt boxes. The BootstrapDialog will be used if | ||
* available or needed, else the javascript native dialogs will be rendered. | ||
|
@@ -72,10 +72,11 @@ var KrajeeDialog; | |
window.BootstrapDialog.show(opts); | ||
} | ||
}, | ||
alert: function (message) { | ||
alert: function (message, callback) { | ||
var self = this, opts = self.getOpts('alert'); | ||
if (self.usePlugin()) { | ||
opts.message = message; | ||
opts.callback = callback; | ||
window.BootstrapDialog.alert(opts); | ||
} else { | ||
window.alert(message); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.