Skip to content

Prepared admin buttons#5511

Draft
sreichel wants to merge 33 commits into
OpenMage:mainfrom
sreichel:feat/prepared-buttons
Draft

Prepared admin buttons#5511
sreichel wants to merge 33 commits into
OpenMage:mainfrom
sreichel:feat/prepared-buttons

Conversation

@sreichel
Copy link
Copy Markdown
Contributor

@sreichel sreichel commented Apr 21, 2026

Description (*)

  • added _addPreparedButton() for easier adding buttons
    • default css class\label\onclick...
  • ...

Related Pull Requests

Copilot AI review requested due to automatic review settings April 21, 2026 11:46
@github-actions github-actions Bot added Template : admin Relates to admin template Component: lib/Varien Relates to lib/Varien Component: Sales Relates to Mage_Sales Component: Adminhtml Relates to Mage_Adminhtml Component: Widget Relates to Mage_Widget Component: Oauth Relates to Mage_Oauth Component: Index Relates to Mage_Index Component: lib/* Relates to lib/* labels Apr 21, 2026
@sreichel sreichel changed the title feat: prepared admin buttons Prepared admin buttons Apr 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds stable data-test attributes to common admin form elements and admin buttons to make Cypress/e2e selectors resilient, and introduces a helper for adding standardized admin buttons.

Changes:

  • Introduce Mage_Adminhtml_Block_Widget_Container::_addPreparedButton() plus button type constants, and refactor multiple admin blocks to use it.

Reviewed changes

Copilot reviewed 45 out of 45 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
lib/Varien/Data/Form/Element/Abstract.php Add computed test id and render it into default <input> elements.
lib/Varien/Data/Form/Element/Textarea.php Add data-test to textarea elements.
lib/Varien/Data/Form/Element/Select.php Add data-test to select elements.
lib/Varien/Data/Form/Element/Multiselect.php Add data-test to multiselect elements.
lib/Varien/Data/Form/Element/Editor.php Add data-test to WYSIWYG textarea output.
lib/Varien/Data/Form/Element/Date.php Add data-test to date input element.
app/design/adminhtml/openmage/default/template/login.phtml Add data-test selectors to login fields.
app/design/adminhtml/base/default/template/login.phtml Add data-test selectors to login fields.
app/code/core/Mage/Adminhtml/Block/Widget/Container.php Add button type constants, auto test_id, and _addPreparedButton() helper.
app/code/core/Mage/Adminhtml/Block/Widget/Button.php Render data-test attribute on admin buttons.
app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php Use _addPreparedButton() for standard form container buttons.
app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php Use _addPreparedButton() for back button.
app/code/core/Mage/Adminhtml/Block/Widget/View/Container.php Use _addPreparedButton() for back button.
app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit.php Replace custom save+edit button with prepared button.
app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View.php Replace back/cancel buttons with prepared buttons.
app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View.php Replace back/cancel button handling with prepared buttons/constants.
app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Edit.php Replace save+edit button and standard button ids with constants.
app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php Use constants for standard button ids.
app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php Use prepared back button and constants for updates.
app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit.php Replace save+continue button with prepared button.
app/code/core/Mage/Adminhtml/Block/Tag/Edit.php Replace save+continue with prepared button and constants.
app/code/core/Mage/Adminhtml/Block/System/Variable/Edit.php Replace save+continue with prepared button and constants.
app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php Use constants for save/delete/reset button operations.
app/code/core/Mage/Adminhtml/Block/System/Store/Delete.php Use constants and prepared cancel button in footer.
app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit.php Replace save+continue with prepared button and constants.
app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit.php Replace save+continue with prepared button and constants.
app/code/core/Mage/Adminhtml/Block/System/Account/Edit.php Use constant for delete removal.
app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail.php Replace back button with prepared button.
app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php Use constants for standard button removals.
app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/New.php Use constants for save/update and delete removal.
app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Assign.php Use constants for save/update and delete removal.
app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php Use constants and prepared print button.
app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create.php Use constants for standard button removals.
app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php Use constants and prepared cancel/void/print buttons.
app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create.php Use constants for standard button removals.
app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php Use constants and prepared cancel/void/print buttons.
app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php Use constants for standard button removals.
app/code/core/Mage/Adminhtml/Block/Sales/Order/Address.php Use constants for save/update and delete removal.
app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit.php Replace save+continue with prepared button.
app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit.php Replace save+continue with prepared button.
app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit.php Use constant for delete removal.
app/code/core/Mage/Adminhtml/Block/Customer/Edit.php Use constants and prepared save+continue button.
app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php Use constants and prepared save+continue button.
app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php Use constants and prepared save+continue button.
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php Replace close/save+continue with prepared buttons and constants.

Comment thread app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php Outdated
Comment thread app/code/core/Mage/Adminhtml/Block/Widget/Container.php
Comment thread app/code/core/Mage/Adminhtml/Block/Widget/Container.php
Comment thread lib/Varien/Data/Form/Element/Editor.php
Comment thread app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php
@sreichel sreichel marked this pull request as draft April 21, 2026 12:16
Comment thread app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php Outdated
@github-actions github-actions Bot removed Template : admin Relates to admin template Component: lib/Varien Relates to lib/Varien Component: lib/* Relates to lib/* labels Apr 22, 2026
# Conflicts:
#	app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php
#	app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php
#	app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php
#	app/code/core/Mage/Adminhtml/Block/Customer/Edit.php
#	app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php
#	app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php
#	app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php
#	app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail.php
#	app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit.php
#	app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit.php
#	app/code/core/Mage/Adminhtml/Block/System/Store/Delete.php
#	app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php
#	app/code/core/Mage/Adminhtml/Block/System/Variable/Edit.php
#	app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit.php
#	app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php
#	app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php
#	app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php
#	app/code/core/Mage/Adminhtml/Block/Widget/View/Container.php
#	app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Edit.php
#	app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View.php
#	app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View.php
#	dev/rector/Migration/Mage/Adminhtml.php
@github-actions github-actions Bot removed Component: Index Relates to Mage_Index rector labels Apr 22, 2026
@github-actions github-actions Bot added Component: ImportExport Relates to Mage_ImportExport rector labels Apr 23, 2026
@sreichel sreichel requested review from Hanmac and removed request for Hanmac April 23, 2026 02:24
Comment thread app/code/core/Mage/Adminhtml/Block/Widget/Container.php Outdated
@sreichel sreichel added the chore label Apr 24, 2026
@github-actions github-actions Bot added Component: PayPal Relates to Mage_Paypal Component: Index Relates to Mage_Index labels Apr 24, 2026
@sonarqubecloud
Copy link
Copy Markdown

@Hanmac
Copy link
Copy Markdown
Contributor

Hanmac commented Apr 24, 2026

Maybe for another issue, we should UNIFY the SAVE_EDIT onClick actions
just scrolling through this MR, I found 3+ different variants for this

  • "$('edit_form').action += 'continue/true/'; editForm.submit();"
  • 'editForm.submit($(\'edit_form\').action + \'back/edit/\')'
  • saveAndContinueEdit()'back/edit/'
  • getSaveAndContinueEditJs($this->_getSaveAndContinueUrl())saveAndContinueEdit(url)
  • "editForm.submit('" . $this->getSaveAndContinueUrl() . "');"

@sreichel
Copy link
Copy Markdown
Contributor Author

This is the right PR to fix it. Already started that in another one ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Component: Adminhtml Relates to Mage_Adminhtml Component: ImportExport Relates to Mage_ImportExport Component: Index Relates to Mage_Index Component: Oauth Relates to Mage_Oauth Component: PayPal Relates to Mage_Paypal Component: Sales Relates to Mage_Sales Component: Widget Relates to Mage_Widget enhancement rector

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants