2017 © Pedro Peláez
 

yii2-extension modal

Extension for the Yii2 framework

image

conquer/modal

Extension for the Yii2 framework

  • Monday, April 30, 2018
  • by borodulin
  • Repository
  • 3 Watchers
  • 5 Stars
  • 1,674 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 8 Versions
  • 13 % Grown

The README.md

Yii2 Ajax modal form

Description

This extension allows you to quickly add full-featured modal forms to your appllication. Main featues are:, (*1)

  1. Based on bootstrap modal forms.
  2. Allows quickly add behavior to interact with viewing and updating data in modal dialogs.
  3. Catch form post events, converts them to ajax request and display results in the same modal dialog.

Installation

The preferred way to install this extension is through composer., (*2)

To install, either run, (*3)

$ php composer.phar require conquer/modal "*"

or add, (*4)

"conquer/modal": "*"

to the require section of your composer.json file., (*5)

Usage

Somewhere in the main layout, (*6)

\conquer\modal\ModalForm::widget([
    'selector' => '.modal-form',
]);

Whenever you want to add behavior to tag a, just add class 'modal-form', (*7)

    echo Html::a('Some modal action', ['controller/action'], ['class' => 'modal-form']);

To improve traffic data and error exceptions you need to control layout rendering when ajax requests. I recommend you to override default rendering in your controllers:, (*8)

class Controller extends \yii\web\Controller
{
    /**
     * Exclude layout rendering when ajax requests
     */
    public function render($view, $params = [])
    {
        if (\Yii::$app->request->isAjax) {
            return $this->renderPartial($view, $params);
        }
        return parent::render($view, $params);
    }
}

Client Options

To add client options use clientOptions key. Available client options are: id, class, tabindex. * Id key replaces existing auto generated id attribute. * Class key adds classes to html class attribute. * Tabindex key replaces existing default tabindex html attribute (-1), when false, then no tabindex attribute appears., (*9)

\conquer\modal\ModalForm::widget([
    'selector' => '.modal-form',
    'clientOptions' => [
        'id' => 'sample-unique-id',
        'class' => 'sample-class1 sample-class2',
        'tabindex' => false
    ]
]);

License

conquer/modal is released under the MIT License. See the bundled LICENSE for details., (*10)

The Versions

30/04 2018

dev-master

9999999-dev https://github.com/borodulin/yii2-modal-form

Extension for the Yii2 framework

  Sources   Download

MIT

The Requires

 

yii2 form ajax modal

30/04 2018

v1.1.5

1.1.5.0 https://github.com/borodulin/yii2-modal-form

Extension for the Yii2 framework

  Sources   Download

MIT

The Requires

 

yii2 form ajax modal

20/11 2017

v1.1.4

1.1.4.0 https://github.com/borodulin/yii2-modal-form

Extension for the Yii2 framework

  Sources   Download

MIT

The Requires

 

yii2 form ajax modal

22/09 2017

v1.1.3

1.1.3.0 https://github.com/borodulin/yii2-modal-form

Extension for the Yii2 framework

  Sources   Download

MIT

The Requires

 

yii2 form ajax modal

25/01 2017

v1.1.2

1.1.2.0 https://github.com/borodulin/yii2-modal-form

Extension for the Yii2 framework

  Sources   Download

MIT

The Requires

 

yii2 form ajax modal

23/01 2017

v1.1.1

1.1.1.0 https://github.com/borodulin/yii2-modal-form

Extension for the Yii2 framework

  Sources   Download

MIT

The Requires

 

yii2 form ajax modal

21/01 2017

v1.1.0

1.1.0.0 https://github.com/borodulin/yii2-modal-form

Extension for the Yii2 framework

  Sources   Download

MIT

The Requires

 

yii2 form ajax modal

12/01 2017

v1.0.5

1.0.5.0 https://github.com/borodulin/yii2-modal-form

Extension for the Yii2 framework

  Sources   Download

MIT

The Requires

 

yii2 form ajax modal