Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/modal callback in modal callback #509

Merged
merged 2 commits into from Jul 3, 2018
Merged

Conversation

ibelar
Copy link
Contributor

@ibelar ibelar commented Jun 28, 2018

This will properly allow to use modal callback inside another modal callback.

For example, allow to display a table in a modal using an action column edit that open another modal using a form.

$t = $app->add('Table');
$m = $t->setModel($m);

$t->addColumn(null, 'Actions')->addModal('btn', 'Title', function ($modal, $id) use ($m, $app) {
    // get this app.
    $m->load($id);

    $modal->add(['Header', $mUserApps['name'], 'size' => 4]);

    $table = $modal->add('Table');
    $table->setModel(new Model());

    $table->addColumn(null, 'Actions')->addModal('Edit Item', 'Editing item', function($editModal, $id) use ($m) {
        $f = $editModal->add('Form');
        $f->setModel($m)->load($id));
        $f->onSubmit(function($f) use ($modal, $editModal, $tablePerm) {
           $f->model->save();
           return [$editModal->owner->hide(), new jsReload($table)];
        });
    });
});

@codecov
Copy link

codecov bot commented Jun 28, 2018

Codecov Report

❗ No coverage uploaded for pull request base (develop@9964bc8). Click here to learn what that means.
The diff coverage is 25%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #509   +/-   ##
==========================================
  Coverage           ?   65.74%           
  Complexity         ?     1572           
==========================================
  Files              ?       88           
  Lines              ?     3757           
  Branches           ?        0           
==========================================
  Hits               ?     2470           
  Misses             ?     1287           
  Partials           ?        0
Impacted Files Coverage Δ Complexity Δ
src/Modal.php 40.47% <25%> (ø) 37 <0> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9964bc8...39404da. Read the comment docs.

@romaninsh romaninsh merged commit 3420cd5 into develop Jul 3, 2018
@romaninsh romaninsh deleted the fix/Modal-in-Modal branch December 26, 2019 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants