[ticket/17344] Improve webpush class names

PHPBB-17344
This commit is contained in:
Matt Friedman 2024-06-16 09:43:02 -07:00
parent f3ca92ffe7
commit 16743e9345
No known key found for this signature in database
6 changed files with 16 additions and 19 deletions

View file

@ -45,10 +45,10 @@
<a href="{U_VIEW_ALL_NOTIFICATIONS}"><span>{L_SEE_ALL}</span></a>
</div>
{% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is not defined %}
<div class="notification-dropdown-footer">
<div class="footer webpush-subscribe">
<span class="ellipsis-text">{{ lang('NOTIFY_WEB_PUSH_ENABLE') ~ lang('COLON') }}</span>
<button id="subscribe_webpush" name="subscribe_webpush" class="notification-subscribe_toggle" data-l-err="{{ lang('INFORMATION') }}" data-l-msg="{{ lang('NOTIFY_WEB_PUSH_DENIED') }}">{{ Icon('font', 'toggle-off', lang('NOTIFY_WEB_PUSH_SUBSCRIBE'), false, '', {'style' : 'color:#9e9e9e;'}) }}</button>
<button id="unsubscribe_webpush" name="unsubscribe_webpush" class="notification-subscribe_toggle hidden">{{ Icon('font', 'toggle-on', lang('NOTIFY_WEB_PUSH_SUBSCRIBED'), false, '', {'style' : 'color:#0059b3;'}) }}</button>
<button id="subscribe_webpush" name="subscribe_webpush" class="notification-subscribe-toggle" data-l-err="{{ lang('INFORMATION') }}" data-l-msg="{{ lang('NOTIFY_WEB_PUSH_DENIED') }}">{{ Icon('font', 'toggle-off', lang('NOTIFY_WEB_PUSH_SUBSCRIBE'), false, '', {'style' : 'color:#9e9e9e;'}) }}</button>
<button id="unsubscribe_webpush" name="unsubscribe_webpush" class="notification-subscribe-toggle hidden">{{ Icon('font', 'toggle-on', lang('NOTIFY_WEB_PUSH_SUBSCRIBED'), false, '', {'style' : 'color:#0059b3;'}) }}</button>
</div>
{% endif %}
{% EVENT notification_dropdown_footer_after %}

View file

@ -223,6 +223,6 @@ button::-moz-focus-inner {
/* Notification buttons
--------------------------------------------- */
.notification-subscribe_toggle:disabled {
.notification-subscribe-toggle:disabled {
opacity: 0.7;
}

View file

@ -1180,6 +1180,10 @@ input.disabled {
color: #ffffff;
}
.notification-subscribe_toggle {
.dropdown-extended .webpush-subscribe {
color: #536482;
}
.notification-subscribe-toggle {
color: #47536b;
}

View file

@ -1340,9 +1340,8 @@ ul.linklist:after,
display: block;
}
.dropdown-extended .notification-dropdown-footer {
.dropdown-extended .webpush-subscribe {
white-space: nowrap;
border-top: solid 1px #b9b9b9;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;

View file

@ -18,16 +18,10 @@
.dropdown-extended .dropdown-contents {
width: auto;
}
}
@media (max-width: 550px) {
.dropdown-extended .notification-dropdown-footer .notification-subscribe_toggle > span {
.dropdown-extended .dropdown-contents .webpush-subscribe .notification-subscribe-toggle > span {
display: none;
}
.dropdown-extended .notification-dropdown-footer .notification-subscribe_toggle > .icon {
font-size: 24px;
}
}
@media (max-width: 430px) {

View file

@ -99,19 +99,19 @@ class phpbb_functional_notification_webpush_test extends phpbb_functional_test_c
// Assert subscribe dropdown is present
$crawler = self::request('GET', 'index.php');
$this->assertCount(1, $crawler->filter('.notification-dropdown-footer'));
$this->assertContainsLang('NOTIFY_WEB_PUSH_SUBSCRIBE', $crawler->filter('.notification-dropdown-footer #subscribe_webpush')->text());
$this->assertContainsLang('NOTIFY_WEB_PUSH_SUBSCRIBED', $crawler->filter('.notification-dropdown-footer #unsubscribe_webpush')->text());
$this->assertCount(1, $crawler->filter('.webpush-subscribe'));
$this->assertContainsLang('NOTIFY_WEB_PUSH_SUBSCRIBE', $crawler->filter('.webpush-subscribe #subscribe_webpush')->text());
$this->assertContainsLang('NOTIFY_WEB_PUSH_SUBSCRIBED', $crawler->filter('.webpush-subscribe #unsubscribe_webpush')->text());
// Assert subscribe button is not displayed in UCP when dropdown subscribe is present
$crawler = self::request('GET', 'ucp.php?i=ucp_notifications&mode=notification_options');
$this->assertCount(0, $crawler->filter('.notification-dropdown-footer'));
$this->assertCount(0, $crawler->filter('.webpush-subscribe'));
$this->set_acp_option('webpush_dropdown_subscribe', 0);
// Assert subscribe dropdown is not present by default
$crawler = self::request('GET', 'index.php');
$this->assertCount(0, $crawler->filter('.notification-dropdown-footer'));
$this->assertCount(0, $crawler->filter('.webpush-subscribe'));
}
protected function set_acp_option($option, $value)