From 5cc4f6407cebc5accb982c74d8ef33e9af763ba8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Nov 2016 09:44:35 -0800 Subject: [PATCH] Make the modal choice between "Edit This Event" and "Edit Future Events" more clear Summary: Fixes T11909. Ref T11816. Instead of offering a dropdown with choices between "Edit/Cancel/Reinstate This Event" and "Edit/Cancel/Reinstate Future Events", make the choice more explicit. This dialog ends up pretty wordy but this edit is rare, so I think that's alright. Test Plan: {F2046863} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11816, T11909 Differential Revision: https://secure.phabricator.com/D16956 --- ...abricatorCalendarEventCancelController.php | 52 ++++++++++++++++--- ...PhabricatorCalendarEventEditController.php | 32 ++++++++---- 2 files changed, 66 insertions(+), 18 deletions(-) diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventCancelController.php b/src/applications/calendar/controller/PhabricatorCalendarEventCancelController.php index cf4cde5308..0cdfa4c4b3 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventCancelController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventCancelController.php @@ -138,18 +138,54 @@ final class PhabricatorCalendarEventCancelController ->addSubmitButton($submit); if ($show_control) { + $start_time = phutil_tag( + 'strong', + array(), + phabricator_datetime($event->getStartDateTimeEpoch(), $viewer)); + + if ($is_cancelled) { + $this_name = pht('Reinstate Only This Event'); + $this_caption = pht( + 'Reinstate only the event which occurs on %s.', + $start_time); + + $future_name = pht('Reinstate This And All Later Events'); + $future_caption = pht( + 'Reinstate this event and all events in the series which occur '. + 'on or after %s.', + $start_time); + } else { + $this_name = pht('Cancel Only This Event'); + $this_caption = pht( + 'Cancel only the event which occurs on %s.', + $start_time); + + $future_name = pht('Cancel This And All Later Events'); + $future_caption = pht( + 'Cancel this event and all events in the series which occur '. + 'on or after %s.', + $start_time); + } + + $form = id(new AphrontFormView()) ->setViewer($viewer) ->appendControl( - id(new AphrontFormSelectControl()) - ->setLabel(pht('Cancel Events')) + id(new AphrontFormRadioButtonControl()) ->setName('mode') - ->setOptions( - array( - 'this' => pht('Only This Event'), - 'future' => pht('All Future Events'), - ))); - $dialog->appendForm($form); + ->setValue(PhabricatorCalendarEventEditEngine::MODE_THIS) + ->addButton( + PhabricatorCalendarEventEditEngine::MODE_THIS, + $this_name, + $this_caption) + ->addButton( + PhabricatorCalendarEventEditEngine::MODE_FUTURE, + $future_name, + $future_caption)); + + $dialog + ->setWidth(AphrontDialogView::WIDTH_FORM) + ->appendForm($form); } return $dialog; diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php index 928526f33f..431c1ea71d 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php @@ -46,22 +46,34 @@ final class PhabricatorCalendarEventEditController } if (!$mode) { + $start_time = phutil_tag( + 'strong', + array(), + phabricator_datetime($event->getStartDateTimeEpoch(), $viewer)); + $form = id(new AphrontFormView()) ->setViewer($viewer) ->appendControl( - id(new AphrontFormSelectControl()) - ->setLabel(pht('Edit Events')) + id(new AphrontFormRadioButtonControl()) ->setName('mode') - ->setOptions( - array( - PhabricatorCalendarEventEditEngine::MODE_THIS - => pht('Edit Only This Event'), - PhabricatorCalendarEventEditEngine::MODE_FUTURE - => pht('Edit All Future Events'), - ))); - + ->setValue(PhabricatorCalendarEventEditEngine::MODE_THIS) + ->addButton( + PhabricatorCalendarEventEditEngine::MODE_THIS, + pht('Edit Only This Event'), + pht( + 'Edit only the event which occurs at %s.', + $start_time)) + ->addButton( + PhabricatorCalendarEventEditEngine::MODE_FUTURE, + pht('Edit This And All Later Events'), + pht( + 'Edit this event and all events in the series which '. + 'occur on or after %s. This will overwrite previous '. + 'edits!', + $start_time))); return $this->newDialog() ->setTitle(pht('Edit Event')) + ->setWidth(AphrontDialogView::WIDTH_FORM) ->appendParagraph( pht( 'This event is part of a series. Which events do you '.