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

[5.1] Add backward compatibility for older Plugin/Module bootstrap modals #43291

Merged
merged 3 commits into from
May 11, 2024

Conversation

Fedik
Copy link
Member

@Fedik Fedik commented Apr 17, 2024

Pull Request for Issue #43289 .

Summary of Changes

The PR add a backward compatibility code to handle buttons for bootstrap modal for Plugin/Module editing.

Testing Instructions

Run npm install.

Add following code, somewhere, example in to index.php of Admin template:

$pluginId = 100; // Id of any existing plugin
$link = Route::_('index.php?option=com_plugins&client_id=0&task=plugin.edit&extension_id=' . $pluginId . '&tmpl=component&layout=modal');

echo HTMLHelper::_(
    'bootstrap.renderModal',
    'plugin' . $pluginId . 'Modal',
    [
        'url'         => $link,
        'title'       => 'Edit',
        'height'      => '400px',
        'width'       => '800px',
        'bodyHeight'  => '70',
        'modalWidth'  => '80',
        'closeButton' => false,
        'backdrop'    => 'static',
        'keyboard'    => false,
        'footer'      => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"'
            . ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#plugin' . $pluginId . 'Modal\', buttonSelector: \'#closeBtn\'})">'
            . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
            . '<button type="button" class="btn btn-primary" data-bs-dismiss="modal" onclick="Joomla.iframeButtonClick({iframeSelector: \'#plugin' . $pluginId . 'Modal\', buttonSelector: \'#saveBtn\'})">'
            . Text::_("JSAVE") . '</button>'
            . '<button type="button" class="btn btn-success" onclick="Joomla.iframeButtonClick({iframeSelector: \'#plugin' . $pluginId . 'Modal\', buttonSelector: \'#applyBtn\'}); return false;">'
            . Text::_("JAPPLY") . '</button>'
    ]
);

echo HTMLHelper::_('link', '#plugin' . $pluginId . 'Modal', 'Click me', 'class="alert-link" data-bs-toggle="modal"');

It will render bootstrap modal, and link that opens it.

Then click this link, and in the opened modal try to edit any field, and use modal's buttons to save .

Actual result BEFORE applying this Pull Request

Nothing happens (when click "save"), modal just closes (when click "close" or "save and close").

Expected result AFTER applying this Pull Request

The form saved, the modal closes after it.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org:
  • No documentation changes for manual.joomla.org needed

References:

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.1-dev labels Apr 17, 2024
@Fedik Fedik added the bug label Apr 17, 2024
@Fedik Fedik changed the title [5.1] Add backward compatibility for bootstrap modals [5.1] Add backward compatibility for older Plugin/Module bootstrap modals Apr 17, 2024
@Ruud68
Copy link
Contributor

Ruud68 commented Apr 18, 2024

I have tested this item ✅ successfully on 23f8389

Tested with Kunena 6.3, works!

Thanks @Fedik for providing this PR.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43291.

@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on 23f8389


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43291.

@alikon
Copy link
Contributor

alikon commented Apr 22, 2024

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43291.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 22, 2024
@LadySolveig LadySolveig merged commit 2ff9cb0 into joomla:5.1-dev May 11, 2024
2 of 3 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 11, 2024
@LadySolveig
Copy link
Contributor

Thank you @Fedik and for testing @Ruud68 @viocassel

@richard67 richard67 added this to the Joomla! 5.1.1 milestone May 11, 2024
@Fedik Fedik deleted the fix-43289 branch May 11, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.1-dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants