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

pkp/pkp-lib#10444 Improve dialog component design #10510

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/controllers/grid/plugins/PluginGridHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function initialize($request, $args = null)
new AjaxModal(
$router->url($request, null, null, 'uploadPlugin'),
__('manager.plugins.upload'),
'modal_add_file'
'side-modal'
),
__('manager.plugins.upload'),
'add'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public function initialize($request, $args = null)
new AjaxModal(
$router->url($request, null, null, 'showReviewerForm', null, $actionArgs),
__('editor.submission.addReviewer'),
'modal_add_user'
'side-modal'
),
__('editor.submission.addReviewer'),
'add_user'
Expand Down
2 changes: 2 additions & 0 deletions classes/form/FormBuilderVocabulary.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* hideCancel (optional): Whether the submit button should be disabled
* cancelAction (optional): A LinkAction object to execute when cancel is clicked
* cancelUrl (optional): URL to redirect to when cancel is clicked
* modalStyle (optional): The modal state/style that should be used. (default is 'default')
* Form elements are created with {fbvElement type="type"} plus any additional parameters.
* Each specific element type may have other additional attributes (see their method comments)
* Parameters:
Expand Down Expand Up @@ -239,6 +240,7 @@ public function smartyFBVFormButtons($params, $smarty)
'FBV_cancelUrlTarget' => $params['cancelUrlTarget'] ?? '',
'FBV_translate' => $params['translate'] ?? true,
'FBV_saveText' => $params['saveText'] ?? null,
'FBV_modalStyle' => $params['modalStyle'] ?? null,
]);
return $smarty->fetch('form/formButtons.tpl');
}
Expand Down
6 changes: 3 additions & 3 deletions classes/linkAction/request/AjaxModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AjaxModal extends Modal
*
* @param string $url The URL of the AJAX resource to load into the modal.
* @param string $title (optional) The localized modal title.
* @param string $titleIcon (optional) The icon to be used in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param bool $canClose (optional) Whether the modal will have a close button.
* @param string $closeOnFormSuccessId (optional) Close the modal when the
* form with this id fires a formSuccess event.
Expand All @@ -35,12 +35,12 @@ class AjaxModal extends Modal
public function __construct(
$url,
$title = null,
$titleIcon = null,
$modalStyle = 'default',
$canClose = true,
$closeOnFormSuccessId = null,
$closeCleanVueInstances = []
) {
parent::__construct($title, $titleIcon, $canClose, $closeOnFormSuccessId, $closeCleanVueInstances);
parent::__construct($title, $modalStyle, $canClose, $closeOnFormSuccessId, $closeCleanVueInstances);

$this->_url = $url;
}
Expand Down
7 changes: 3 additions & 4 deletions classes/linkAction/request/ConfirmationModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@ class ConfirmationModal extends Modal
* @param string $dialogText The localized text to appear
* in the dialog modal.
* @param string $title (optional) The localized modal title.
* @param string $titleIcon (optional) The icon to be used
* in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param string $okButton (optional) The localized text to
* appear on the confirmation button.
* @param string $cancelButton (optional) The localized text to
* appear on the cancel button.
* @param bool $canClose (optional) Whether the modal will
* have a close button.
*/
public function __construct($dialogText, $title = null, $titleIcon = 'modal_confirm', $okButton = null, $cancelButton = null, $canClose = true)
public function __construct($dialogText, $title = null, $modalStyle = 'default', $okButton = null, $cancelButton = null, $canClose = true)
{
$title = (is_null($title) ? __('common.confirm') : $title);
parent::__construct($title, $titleIcon, $canClose);
parent::__construct($title, $modalStyle, $canClose);

$this->_okButton = (is_null($okButton) ? __('common.ok') : $okButton);
$this->_cancelButton = (is_null($cancelButton) ? __('common.cancel') : $cancelButton);
Expand Down
7 changes: 3 additions & 4 deletions classes/linkAction/request/JsEventConfirmationModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,17 @@ class JsEventConfirmationModal extends ConfirmationModal
* @param string $event the name of the JS event.
* @param array $extraArguments (optional) extra information to be passed as JSON data with the event.
* @param string $title (optional) The localized modal title.
* @param string $titleIcon (optional) The icon to be used
* in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param string $okButton (optional) The localized text to
* appear on the confirmation button.
* @param string $cancelButton (optional) The localized text to
* appear on the cancel button.
* @param bool $canClose (optional) Whether the modal will
* have a close button.
*/
public function __construct($dialogText, $event = 'confirmationModalConfirmed', $extraArguments = null, $title = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true)
public function __construct($dialogText, $event = 'confirmationModalConfirmed', $extraArguments = null, $title = null, $modalStyle = null, $okButton = null, $cancelButton = null, $canClose = true)
{
parent::__construct($dialogText, $title, $titleIcon, $okButton, $cancelButton, $canClose);
parent::__construct($dialogText, $title, $modalStyle, $okButton, $cancelButton, $canClose);

$this->_event = $event;
$this->_extraArguments = $extraArguments;
Expand Down
16 changes: 8 additions & 8 deletions classes/linkAction/request/Modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Modal extends LinkActionRequest
public $_title;

/** @var string The icon to be displayed in the title bar. */
public $_titleIcon;
public $_modalStyle;

/** @var bool Whether the modal has a close icon in the title bar. */
public $_canClose;
Expand All @@ -43,7 +43,7 @@ class Modal extends LinkActionRequest
* Constructor
*
* @param string $title (optional) The localized modal title.
* @param string $titleIcon (optional) The icon to be used in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param bool $canClose (optional) Whether the modal will have a close button.
* @param string $closeOnFormSuccessId (optional) Close the modal when the
* form with this id fires a formSuccess event.
Expand All @@ -52,14 +52,14 @@ class Modal extends LinkActionRequest
*/
public function __construct(
$title = null,
$titleIcon = null,
$modalStyle = null,
$canClose = true,
$closeOnFormSuccessId = null,
$closeCleanVueInstances = []
) {
parent::__construct();
$this->_title = $title;
$this->_titleIcon = $titleIcon;
$this->_modalStyle = $modalStyle;
$this->_canClose = $canClose;
$this->_closeOnFormSuccessId = $closeOnFormSuccessId;
$this->_closeCleanVueInstances = $closeCleanVueInstances;
Expand All @@ -82,13 +82,13 @@ public function getTitle()
}

/**
* Get the title bar icon.
* Get the modal style.
*
* @return string
*/
public function getTitleIcon()
public function getModalStyle()
{
return $this->_titleIcon;
return $this->_modalStyle;
}

/**
Expand Down Expand Up @@ -128,7 +128,7 @@ public function getLocalizedOptions()
{
return [
'title' => $this->getTitle(),
'titleIcon' => $this->getTitleIcon(),
'modalStyle' => $this->getModalStyle(),
'canClose' => ($this->getCanClose() ? '1' : '0'),
'closeOnFormSuccessId' => $this->_closeOnFormSuccessId,
'closeCleanVueInstances' => $this->_closeCleanVueInstances,
Expand Down
7 changes: 3 additions & 4 deletions classes/linkAction/request/RedirectConfirmationModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@ class RedirectConfirmationModal extends ConfirmationModal
* @param string $title (optional) The localized modal title.
* @param string $remoteUrl (optional) A URL to be
* redirected to when the confirmation button is clicked.
* @param string $titleIcon (optional) The icon to be used
* in the modal title bar.
* @param string $modalStyle (optional) The modal state/style to be used.
* @param string $okButton (optional) The localized text to
* appear on the confirmation button.
* @param string $cancelButton (optional) The localized text to
* appear on the cancel button.
* @param bool $canClose (optional) Whether the modal will
* have a close button.
*/
public function __construct($dialogText, $title = null, $remoteUrl = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true)
public function __construct($dialogText, $title = null, $remoteUrl = null, $modalStyle = null, $okButton = null, $cancelButton = null, $canClose = true)
{
parent::__construct($dialogText, $title, $titleIcon, $okButton, $cancelButton, $canClose);
parent::__construct($dialogText, $title, $modalStyle, $okButton, $cancelButton, $canClose);

$this->_remoteUrl = $remoteUrl;
}
Expand Down
6 changes: 3 additions & 3 deletions classes/linkAction/request/RemoteActionConfirmationModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RemoteActionConfirmationModal extends ConfirmationModal
* @param string $title (optional) The localized modal title.
* @param string $remoteAction (optional) A URL to be
* called when the confirmation button is clicked.
* @param string $titleIcon (optional) The icon to be used
* @param string $modalStyle (optional) The modal state/style to be used.
* in the modal title bar.
* @param string $okButton (optional) The localized text to
* appear on the confirmation button.
Expand All @@ -41,9 +41,9 @@ class RemoteActionConfirmationModal extends ConfirmationModal
* @param bool $canClose (optional) Whether the modal will
* have a close button.
*/
public function __construct($session, $dialogText, $title = null, $remoteAction = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true)
public function __construct($session, $dialogText, $title = null, $remoteAction = null, $modalStyle = null, $okButton = null, $cancelButton = null, $canClose = true)
{
parent::__construct($dialogText, $title, $titleIcon, $okButton, $cancelButton, $canClose);
parent::__construct($dialogText, $title, $modalStyle, $okButton, $cancelButton, $canClose);

$this->_remoteAction = $remoteAction;
$this->_csrfToken = $session->token();
Expand Down
3 changes: 2 additions & 1 deletion classes/plugins/PKPPubIdPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public function getActions($request, $actionArgs)
'settings',
new AjaxModal(
$router->url($request, null, null, 'manage', null, $actionArgs),
$this->getDisplayName()
$this->getDisplayName(),
'side-modal'
),
__('manager.plugins.settings'),
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function fetch($request, $template = null, $display = false)
new ConfirmationModal(
__('reviewer.aboutDueDates.text'),
__('reviewer.aboutDueDates'),
'modal_information',
'primary',
null,
'',
false
Expand All @@ -104,7 +104,8 @@ public function fetch($request, $template = null, $display = false)
'declineReview',
new AjaxModal(
$request->url(null, null, 'showDeclineReview', [$reviewAssignment->getSubmissionId()]),
__('reviewer.submission.declineReview')
__('reviewer.submission.declineReview'),
'side-modal'
)
);
$templateMgr->assign('declineReviewAction', $declineReviewLinkAction);
Expand Down
2 changes: 1 addition & 1 deletion controllers/api/file/linkAction/BaseAddFileLinkAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __construct(
$actionArgs
),
$wizardTitle,
'modal_add_file'
'side-modal'
);

// Configure the link action.
Expand Down
2 changes: 1 addition & 1 deletion controllers/api/file/linkAction/DeleteFileLinkAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct($request, $submissionFile, $stageId, $localeKey = 'g
null,
$this->getActionArgs($submissionFile, $stageId)
),
'modal_delete'
'negative'
),
__($localeKey),
'delete'
Expand Down
2 changes: 1 addition & 1 deletion controllers/api/file/linkAction/EditFileLinkAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct($request, $submissionFile, $stageId)
$this->getActionArgs($submissionFile, $stageId)
),
__('grid.action.editFile'),
'modal_information'
'side-modal'
);

// Configure the file link action.
Expand Down
2 changes: 1 addition & 1 deletion controllers/api/task/SendReminderLinkAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct($request, $modalTitle, $actionArgs)
$ajaxModal = new AjaxModal(
$router->url($request, null, null, 'editReminder', null, $actionArgs),
__($modalTitle),
'review_reminder'
'side-modal'
);

// Configure the link action.
Expand Down
2 changes: 1 addition & 1 deletion controllers/api/task/SendThankYouLinkAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct($request, $modalTitle, $actionArgs)
$ajaxModal = new AjaxModal(
$router->url($request, null, null, 'editThankReviewer', null, $actionArgs),
__($modalTitle),
'modal_email'
'side-modal'
);

// Configure the link action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct($request)
$viewCompetingInterestsModal = new ConfirmationModal(
$context->getLocalizedData('competingInterests'),
__('reviewer.submission.competingInterests'),
null,
'primary',
null,
false,
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct($request, $stageId)
$viewGuidelinesModal = new ConfirmationModal(
$this->getGuidelines(),
__('reviewer.submission.guidelines'),
null,
'primary',
null,
false
);
Expand Down
2 changes: 1 addition & 1 deletion controllers/grid/admin/context/ContextGridHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function initialize($request, $args = null)
new AjaxModal(
$router->url($request, null, null, 'createContext', null, null),
__('admin.contexts.create'),
'modal_add_item',
'side-modal',
true,
'context',
['editContext']
Expand Down
7 changes: 4 additions & 3 deletions controllers/grid/admin/context/ContextGridRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function initialize($request, $template = null)
new AjaxModal(
$router->url($request, null, null, 'editContext', null, ['rowId' => $rowId]),
__('grid.action.edit'),
'modal_edit',
'side-modal',
true,
'context',
['editContext']
Expand All @@ -67,7 +67,8 @@ public function initialize($request, $template = null)
$request->getSession(),
__('admin.contexts.confirmDelete', ['contextName' => $element->getLocalizedName()]),
null,
$router->url($request, null, null, 'deleteContext', null, ['rowId' => $rowId])
$router->url($request, null, null, 'deleteContext', null, ['rowId' => $rowId]),
'negative'
),
__('grid.action.remove'),
'delete'
Expand All @@ -88,7 +89,7 @@ public function initialize($request, $template = null)
new AjaxModal(
$router->url($request, $element->getPath(), null, 'users', null),
__('manager.users'),
'modal_edit',
'side-modal',
true
),
__('manager.users'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function initialize($request, $args = null)
new AjaxModal(
$router->url($request, null, null, 'installLocale', null, null),
__('admin.languages.installLocale'),
null,
'side-modal',
true
),
__('admin.languages.installLocale'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getCellActions($request, $row, $column, $position = GridHandler:
new AjaxModal(
$router->url($request, null, null, 'editAnnouncementType', null, $actionArgs),
__('grid.action.edit'),
null,
'side-modal',
true
),
htmlspecialchars($announcementType->getLocalizedTypeName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function initialize($request, $args = null)
new AjaxModal(
$router->url($request, null, null, 'addAnnouncementType', null, null),
__('grid.action.addAnnouncementType'),
'modal_add_item',
'side-modal',
true
),
__('grid.action.addAnnouncementType'),
Expand Down
4 changes: 2 additions & 2 deletions controllers/grid/announcements/AnnouncementTypeGridRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function initialize($request, $template = null)
new AjaxModal(
$router->url($request, null, null, 'editAnnouncementType', null, $actionArgs),
__('grid.action.edit'),
'modal_edit',
'side-modal',
true
),
__('grid.action.edit'),
Expand All @@ -68,7 +68,7 @@ public function initialize($request, $template = null)
__('common.confirmDelete'),
__('common.remove'),
$router->url($request, null, null, 'deleteAnnouncementType', null, $actionArgs),
'modal_delete'
'negative'
),
__('grid.action.remove'),
'delete'
Expand Down
2 changes: 1 addition & 1 deletion controllers/grid/eventLog/linkAction/EmailLinkAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct($request, $modalTitle, $actionArgs)
$ajaxModal = new AjaxModal(
$router->url($request, null, null, 'viewEmail', null, $actionArgs),
$modalTitle,
'modal_email'
'side-modal'
);

// Configure the link action.
Expand Down
2 changes: 1 addition & 1 deletion controllers/grid/files/LibraryFileGridHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function initialize($request, $args = null)
new AjaxModal(
$router->url($request, null, null, 'addFile', null, $this->getActionArgs()),
__('grid.action.addFile'),
'modal_add_file'
'side-modal'
),
__('grid.action.addFile'),
'add'
Expand Down
Loading