From b76df96b064c3f6f3156246eb81b18bdaca49356 Mon Sep 17 00:00:00 2001 From: yurabakhtin Date: Wed, 23 Feb 2022 12:54:36 +0300 Subject: [PATCH] Update wording --- assets/CalendarAsset.php | 10 +++++----- models/CalendarEntry.php | 6 +++--- models/forms/CalendarEntryForm.php | 12 +++++++++++- models/forms/CalendarEntryParticipationForm.php | 4 ++-- tests/codeception/_support/AcceptanceTester.php | 2 +- .../acceptance/CreateSpaceEntryCest.php | 14 +++++++------- .../codeception/acceptance/GlobalCalendarCest.php | 2 +- tests/codeception/acceptance/ParticipationCest.php | 14 +++++++------- tests/codeception/acceptance/SettingsCest.php | 4 ++-- views/entry/edit-basic.php | 4 ++++ views/entry/edit-participation.php | 4 ++-- views/entry/edit.php | 6 +++--- views/entry/modal-participants.php | 2 +- widgets/DownloadIcsLink.php | 2 +- widgets/EditLink.php | 2 +- widgets/ParticipantItem.php | 4 ++-- widgets/ParticipantsLink.php | 2 +- widgets/views/participantAddForm.php | 2 +- widgets/views/participantList.php | 2 +- widgets/views/participants.php | 8 ++++---- 20 files changed, 60 insertions(+), 46 deletions(-) diff --git a/assets/CalendarAsset.php b/assets/CalendarAsset.php index 0fedf7f3..e426e115 100644 --- a/assets/CalendarAsset.php +++ b/assets/CalendarAsset.php @@ -39,11 +39,11 @@ public static function register($view) { $view->registerJsConfig('calendar.Calendar', [ 'text' => [ - 'button.today' => Yii::t('CalendarModule.calendar', 'today'), - 'button.month' => Yii::t('CalendarModule.calendar', 'month'), - 'button.week' => Yii::t('CalendarModule.calendar', 'week'), - 'button.day' => Yii::t('CalendarModule.calendar', 'day'), - 'button.list' => Yii::t('CalendarModule.calendar', 'list'), + 'button.today' => Yii::t('CalendarModule.calendar', 'Today'), + 'button.month' => Yii::t('CalendarModule.calendar', 'Month'), + 'button.week' => Yii::t('CalendarModule.calendar', 'Week'), + 'button.day' => Yii::t('CalendarModule.calendar', 'Day'), + 'button.list' => Yii::t('CalendarModule.calendar', 'List'), ] ]); return parent::register($view); diff --git a/models/CalendarEntry.php b/models/CalendarEntry.php index ca0d813a..8873ca95 100644 --- a/models/CalendarEntry.php +++ b/models/CalendarEntry.php @@ -317,9 +317,9 @@ public function attributeLabels() 'all_day' => Yii::t('CalendarModule.base', 'All Day'), 'recurring' => Yii::t('CalendarModule.base', 'Recurring'), 'reminder' => Yii::t('CalendarModule.base', 'Enable Reminder'), - 'allow_decline' => Yii::t('CalendarModule.base', 'Allow participation state \'decline\''), - 'allow_maybe' => Yii::t('CalendarModule.base', 'Allow participation state \'maybe\''), - 'participation_mode' => Yii::t('CalendarModule.base', 'Participation Mode'), + 'allow_decline' => Yii::t('CalendarModule.base', 'Allow option \'Decline\''), + 'allow_maybe' => Yii::t('CalendarModule.base', 'Allow option \'Undecided\''), + 'participation_mode' => Yii::t('CalendarModule.base', 'Mode'), 'max_participants' => Yii::t('CalendarModule.base', 'Maximum number of participants'), 'location' => Yii::t('CalendarModule.base', 'Location'), ]; diff --git a/models/forms/CalendarEntryForm.php b/models/forms/CalendarEntryForm.php index 5dc797b9..1532d0e7 100644 --- a/models/forms/CalendarEntryForm.php +++ b/models/forms/CalendarEntryForm.php @@ -76,6 +76,11 @@ class CalendarEntryForm extends Model */ public $topics = []; + /** + * @var bool + */ + public $sendUpdateNotification = 0; + /** * @var CalendarEntry */ @@ -218,7 +223,7 @@ public function rules() return [ ['timeZone', 'in', 'range' => DateTimeZone::listIdentifiers()], ['topics', 'safe'], - [['is_public', 'type_id'], 'integer'], + [['is_public', 'type_id', 'sendUpdateNotification'], 'integer'], [['start_date', 'end_date'], 'required'], [['start_time', 'end_time'], 'date', 'type' => 'time', 'format' => CalendarUtils::getTimeFormat()], ['start_date', CalendarDateFormatValidator::class, 'timeField' => 'start_time'], @@ -240,6 +245,7 @@ public function attributeLabels() 'location' => Yii::t('CalendarModule.base', 'Location'), 'is_public' => Yii::t('CalendarModule.base', 'Public'), 'topics' => Yii::t('TopicModule.base', 'Topics'), + 'sendUpdateNotification' => Yii::t('CalendarModule.base', 'Notify participants about changes'), ]; } @@ -440,6 +446,10 @@ public function save() Topic::attach($this->entry->content, $this->topics); + if ($this->sendUpdateNotification && !$this->entry->isNewRecord) { + $this->entry->participation->sendUpdateNotification(); + } + $result = true; if ($this->showReminderTab()) { diff --git a/models/forms/CalendarEntryParticipationForm.php b/models/forms/CalendarEntryParticipationForm.php index 545f700b..2c99e09e 100644 --- a/models/forms/CalendarEntryParticipationForm.php +++ b/models/forms/CalendarEntryParticipationForm.php @@ -88,10 +88,10 @@ public function rules() public function attributeLabels() { return [ - 'sendUpdateNotification' => Yii::t('CalendarModule.base', 'Send update notification'), + 'sendUpdateNotification' => Yii::t('CalendarModule.base', 'Notify participants about changes'), 'forceJoin' => ($this->entry->isNewRecord) ? Yii::t('CalendarModule.base', 'Add all space members to this event') - : Yii::t('CalendarModule.base', 'Invite all participants from the space'), + : Yii::t('CalendarModule.base', 'Invite all Space members'), ]; } diff --git a/tests/codeception/_support/AcceptanceTester.php b/tests/codeception/_support/AcceptanceTester.php index 3556da68..f2e7dfed 100644 --- a/tests/codeception/_support/AcceptanceTester.php +++ b/tests/codeception/_support/AcceptanceTester.php @@ -27,7 +27,7 @@ public function createEventToday($title = 'My Test Entry', $description = 'My Te { $this->waitForElementVisible('.fc-today'); $this->click('.fc-today'); - $this->waitForText('Create event'); + $this->waitForText('Create Event'); $this->fillField('CalendarEntry[title]', $title); $this->fillField('#calendarentry-description .humhub-ui-richtext' , $description); diff --git a/tests/codeception/acceptance/CreateSpaceEntryCest.php b/tests/codeception/acceptance/CreateSpaceEntryCest.php index bcf5f62a..a20f48b9 100644 --- a/tests/codeception/acceptance/CreateSpaceEntryCest.php +++ b/tests/codeception/acceptance/CreateSpaceEntryCest.php @@ -14,7 +14,7 @@ class CreateSpaceEntryCest { - + public function testInstallAndCreatEntry(AcceptanceTester $I) { $I->amAdmin(); @@ -30,7 +30,7 @@ public function testInstallAndCreatEntry(AcceptanceTester $I) $I->click('Calendar', '.layout-nav-container'); $I->waitForElementVisible('.fc-today'); $I->click('.fc-today'); - $I->waitForText('Create event', null, '#globalModal'); + $I->waitForText('Create Event', null, '#globalModal'); $I->fillField('CalendarEntry[title]', 'My Test Entry'); $I->fillField('#calendarentry-description .humhub-ui-richtext', 'My Test Entry Description'); @@ -90,7 +90,7 @@ public function testAddAll(AcceptanceTester $I) $I->waitForElementVisible('.fc-today'); $I->click('.fc-today'); - $I->waitForText('Create event'); + $I->waitForText('Create Event'); $I->fillField('CalendarEntry[title]', 'New Test Event'); @@ -104,7 +104,7 @@ public function testAddAll(AcceptanceTester $I) $I->expect('All space members to be attending'); $I->click('New Test Event'); - $I->waitForText('2 attending', null,'#globalModal'); + $I->waitForText('2 Attending', null,'#globalModal'); $I->amOnSpace(1, '/calendar/view/index'); $I->wantToTest('Adding a new space member and using then using the add all members again'); @@ -126,7 +126,7 @@ public function testAddAll(AcceptanceTester $I) $I->waitForText('New Test Event',null, '#globalModal'); $I->click('Invite', '#globalModal .modal-footer'); - $I->waitForText('Event Participants', null, '#globalModal'); + $I->waitForText('Participants', null, '#globalModal'); $I->waitForElementVisible('[for="calendarentryparticipationform-forcejoin"]', null, '#globalModal'); $I->click('[for="calendarentryparticipationform-forcejoin"]'); $I->click('Save', '#globalModal'); @@ -135,7 +135,7 @@ public function testAddAll(AcceptanceTester $I) $memberCount = Membership::getSpaceMembersQuery(Space::findOne(['id' => 1]))->count(); - $I->waitForText($memberCount.' attending', null,'#globalModal'); + $I->waitForText($memberCount.' Attending', null,'#globalModal'); $I->wantToTest('closing the event'); @@ -161,7 +161,7 @@ public function testAddAll(AcceptanceTester $I) $I->waitForElementVisible('.fc-today'); $I->click('.fc-today'); - $I->waitForText('Create event', null, '#globalModal'); + $I->waitForText('Create Event', null, '#globalModal'); $I->fillField('CalendarEntry[title]', 'User Test Event 2'); $I->click('Next', '#globalModal'); $I->waitForText('Participants', null, '#globalModal'); diff --git a/tests/codeception/acceptance/GlobalCalendarCest.php b/tests/codeception/acceptance/GlobalCalendarCest.php index 3814d6fb..fae5b691 100644 --- a/tests/codeception/acceptance/GlobalCalendarCest.php +++ b/tests/codeception/acceptance/GlobalCalendarCest.php @@ -58,7 +58,7 @@ public function testGlobalCalendarCreateEntry(AcceptanceTester $I) $I->waitForText('Next', null, '#globalModal'); $I->click('Next', '#globalModal'); - $I->waitForText('Create event', null, '#globalModal'); + $I->waitForText('Create Event', null, '#globalModal'); $I->fillField('CalendarEntry[title]', 'My Test Profile Entry'); $I->fillField('#calendarentry-description .humhub-ui-richtext', 'My Test Profile Entry Description'); $I->click('Next', '#globalModal'); diff --git a/tests/codeception/acceptance/ParticipationCest.php b/tests/codeception/acceptance/ParticipationCest.php index 4941542c..d2de4453 100644 --- a/tests/codeception/acceptance/ParticipationCest.php +++ b/tests/codeception/acceptance/ParticipationCest.php @@ -30,14 +30,14 @@ public function testInstallAndCreatEntry(AcceptanceTester $I) $I->selectOption('#calendarentry-participation_mode', 2); $I->canSee('Maximum number of participants', '#globalModal'); - $I->canSee('Allow participation state', '#globalModal'); + $I->canSee('Allow option', '#globalModal'); $I->selectOption('#calendarentry-participation_mode', 0); $I->wait(1); $I->cantSee('Maximum number of participants', '#globalModal'); - $I->cantSee('Allow participation state', '#globalModal'); + $I->cantSee('Allow option', '#globalModal'); $I->click('[type="submit"]'); $I->wait(1); @@ -48,7 +48,7 @@ public function testInstallAndCreatEntry(AcceptanceTester $I) $I->dontSee('Decline', '#globalModal button'); $I->click('Invite', '#globalModal'); - $I->waitForText('Event Participants',null, '#globalModal'); + $I->waitForText('Participants',null, '#globalModal'); $I->selectOption('#calendarentry-participation_mode', 2); @@ -64,7 +64,7 @@ public function testInstallAndCreatEntry(AcceptanceTester $I) $I->see('Decline', '#globalModal button'); $I->click('Invite', '#globalModal'); - $I->waitForText('Event Participants',null, '#globalModal'); + $I->waitForText('Participants',null, '#globalModal h4'); $I->click('.tab-participation'); $I->click('[for="calendarentry-allow_decline"]', '#globalModal'); $I->click('[for="calendarentry-allow_maybe"]', '#globalModal'); @@ -78,9 +78,9 @@ public function testInstallAndCreatEntry(AcceptanceTester $I) $I->dontSee('Decline', '#globalModal button'); $I->click('Attend', '#globalModal'); - $I->waitForText('1 attending', null, '#globalModal'); - $I->click('1 attending', '#globalModal'); - $I->waitForText('Event Participants', null, '#globalModal'); + $I->waitForText('1 Attending', null, '#globalModal'); + $I->click('1 Attending', '#globalModal'); + $I->waitForText('Participants', null, '#globalModal'); $I->see('Admin Tester', '#globalModal'); } } \ No newline at end of file diff --git a/tests/codeception/acceptance/SettingsCest.php b/tests/codeception/acceptance/SettingsCest.php index 6a852b6b..35fd3b14 100644 --- a/tests/codeception/acceptance/SettingsCest.php +++ b/tests/codeception/acceptance/SettingsCest.php @@ -35,7 +35,7 @@ public function testInstallAndCreatEntry(AcceptanceTester $I) $I->createEventToday('Setting Event','Setting Description',null,null,false); $I->click('Next', '#globalModal'); - $I->waitForText('Event Participants',null, '#globalModal'); + $I->waitForText('Participants',null, '#globalModal'); $I->seeInField('#calendarentry-participation_mode', 0); $I->dontSeeElement('.participationOnly'); @@ -52,7 +52,7 @@ public function testInstallAndCreatEntry(AcceptanceTester $I) $I->amOnSpace1('/calendar/view'); $I->createEventToday('Setting Event','Setting Description',null,null,false); $I->click('Next', '#globalModal'); - $I->waitForText('Event Participants',null, '#globalModal'); + $I->waitForText('Participants',null, '#globalModal h4'); $I->seeInField('#calendarentry-participation_mode', 2); $I->seeElement('.participationOnly'); $I->dontSeeCheckboxIsChecked('#calendarentry-allow_decline'); diff --git a/views/entry/edit-basic.php b/views/entry/edit-basic.php index 7e389b55..d25d54f6 100644 --- a/views/entry/edit-basic.php +++ b/views/entry/edit-basic.php @@ -99,4 +99,8 @@ ])->label(false) ?> field($calendarEntryForm, 'topics')->widget(TopicPicker::class, ['contentContainer' => $contentContainer]); ?> + + entry->isNewRecord) : ?> + field($calendarEntryForm, 'sendUpdateNotification')->checkbox() ?> + \ No newline at end of file diff --git a/views/entry/edit-participation.php b/views/entry/edit-participation.php index 8a753f96..c2d0eee7 100644 --- a/views/entry/edit-participation.php +++ b/views/entry/edit-participation.php @@ -16,13 +16,13 @@ ?>