2017 © Pedro Peláez
 

library yii-dashboard-modal

image

chervand/yii-dashboard-modal

  • Thursday, May 21, 2015
  • by chervand
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

/** @var YDModalWidget $modal */
$modal = $this->widget('YDModalWidget', [
    'actions' => [
        'edit' => $this->createUrl('modalEdit'),
        'delete' => $this->createUrl('modalDelete'),
    ],
]);
...
'columns' => [
        ...
        [
            'type' => 'raw',
            'htmlOptions' => ['class' => 'grid-icon'],
            'value' => function ($model) use ($modal) {
                return $modal->link(
                    '<i class="fa fa-trash-o text-danger"></i>',
                    $modal->createActionUrl('deleteMenuItem', $model, 'name'),
                    ['title' => Yii::t('app', 'Delete')]
                );
            }
        ],
        ...
    ],
...
public function actions()
    {
        return [
            'modalEdit' => [
                'class' => 'YDModalActionEdit',
                'modalView' => 'menu/_modalEdit',
                'formId' => 'form-edit',
                'models' => [
                    'model' => [
                        'class' => 'Model',
                        'pk' => 'id'
                    ],
                ],
                'afterSubmit' => function () {
                    $this->redirect('afterSave');
                }
            ],
            'modalDelete' => [
                'class' => 'YDModalActionDelete',
                'modalView' => '_modalDelete',
                'formId' => 'form-delete',
                'models' => [
                    'model' => [
                        'class' => 'Model',
                        'pk' => ['id1', 'id2', 'id3']
                    ],
                ],
                'afterSubmit' => function () {
                    $this->redirect('afterDelete');
                }
            ],
        ];
    }

req YDActiveForm, (*1)

The Versions

21/05 2015

dev-master

9999999-dev

  Sources   Download

MIT