Skip to content

Commit

Permalink
XWIKI-19751: Move the "watch" button for a page to the page content menu
Browse files Browse the repository at this point in the history
  * Slightly improve UX
  • Loading branch information
surli committed Jun 7, 2024
1 parent 285014f commit 2b0c10e
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
By setting this property, we make sure this application would be automatically uninstalled if the administrator
installs the old Activity Stream Application. -->
<xwiki.extension.features>org.xwiki.platform:xwiki-platform-notifications-filters-api</xwiki.extension.features>
<xwiki.jacoco.instructionRatio>0.08</xwiki.jacoco.instructionRatio>
<xwiki.jacoco.instructionRatio>0.07</xwiki.jacoco.instructionRatio>
</properties>
<dependencies>
<!-- Trigger xwiki-platform-notifications-filters-api dependencies (but without
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@
}
.help-icon {
float: right;
}
.panel-group .panel.wiki-option {
margin-top: 2em;
}</code>
</property>
<property>
Expand Down Expand Up @@ -526,8 +529,8 @@
#end
## TODO: better way for that?
#set ($isTerminal = ($doc.getDocumentReference().name != 'WebHome'))
#macro (_displayOption $attributeName $optionValue $translationSuffix $iconName)
&lt;div class="panel panel-default"&gt;
#macro (_displayOption $attributeName $optionValue $translationSuffix $iconName $panelClass)
&lt;div class="panel panel-default $panelClass"&gt;
&lt;div class="panel-radio"&gt;
&lt;input type="radio" name="watch-option" id="option-$attributeName" value="$optionValue" aria-labelledby="title-$attributeName" /&gt;
&lt;/div&gt;
Expand All @@ -547,19 +550,19 @@
&lt;/div&gt;&lt;!-- end collapsed xhint --&gt;
&lt;/div&gt;&lt;!-- end panel --&gt;
#end
#set ($watchPageOption = "#_displayOption('watch-page','watchPage','watchpage','page')")
#set ($watchSpaceOption = "#_displayOption('watch-space','watchSpace','watchspace','chart-organisation')")
#set ($unwatchPageAndWatchSpaceOption = "#_displayOption('unwatch-page-watch-space','unwatchPageWatchSpace','watchspace','chart-organisation')")
#set ($watchWikiOption = "#_displayOption('watch-wiki','watchWiki','watchwiki','world')")
#set ($blockPageOption = "#_displayOption('block-page','blockPage','blockpage','page')")
#set ($unblockPageAndBlockSpaceOption = "#_displayOption('unblock-page-block-space','unblockPageBlockSpace','blockspace','chart-organisation')")
#set ($blockSpaceOption = "#_displayOption('block-space','blockSpace','blockspace','chart-organisation')")
#set ($unwatchPageOption = "#_displayOption('unwatch-page','unwatchPage','unwatchpage','page')")
#set ($unwatchSpaceOption = "#_displayOption('unwatch-space','unwatchSpace','unwatchspace','chart-organisation')")
#set ($unwatchWikiOption = "#_displayOption('unwatch-wiki','unwatchWiki','unwatchwiki','world')")
#set ($unblockPageOption = "#_displayOption('unblock-page','unblockPage','unblockpage','page')")
#set ($unblockSpaceOption = "#_displayOption('unblock-space','unblockSpace','unblockspace','chart-organisation')")
#set ($unblockWikiOption = "#_displayOption('unblock-wiki','unblockWiki','unblockwiki','world')")
#set ($watchPageOption = "#_displayOption('watch-page','watchPage','watchpage','page','')")
#set ($watchSpaceOption = "#_displayOption('watch-space','watchSpace','watchspace','chart-organisation','')")
#set ($unwatchPageAndWatchSpaceOption = "#_displayOption('unwatch-page-watch-space','unwatchPageWatchSpace','watchspace','chart-organisation','')")
#set ($watchWikiOption = "#_displayOption('watch-wiki','watchWiki','watchwiki','world','wiki-option')")
#set ($blockPageOption = "#_displayOption('block-page','blockPage','blockpage','page','')")
#set ($unblockPageAndBlockSpaceOption = "#_displayOption('unblock-page-block-space','unblockPageBlockSpace','blockspace','chart-organisation','')")
#set ($blockSpaceOption = "#_displayOption('block-space','blockSpace','blockspace','chart-organisation','')")
#set ($unwatchPageOption = "#_displayOption('unwatch-page','unwatchPage','unwatchpage','page','')")
#set ($unwatchSpaceOption = "#_displayOption('unwatch-space','unwatchSpace','unwatchspace','chart-organisation','')")
#set ($unwatchWikiOption = "#_displayOption('unwatch-wiki','unwatchWiki','unwatchwiki','world','wiki-option')")
#set ($unblockPageOption = "#_displayOption('unblock-page','unblockPage','unblockpage','page','')")
#set ($unblockSpaceOption = "#_displayOption('unblock-space','unblockSpace','unblockspace','chart-organisation','')")
#set ($unblockWikiOption = "#_displayOption('unblock-wiki','unblockWiki','unblockwiki','world','wiki-option')")

#set ($buttonTitle = $services.localization.render('notifications.watch.button.title', [$watchText]))
{{html clean='false'}}
Expand All @@ -577,7 +580,7 @@
$services.icon.renderHTML('cross')
&lt;/span&gt;&lt;/button&gt;
&lt;h4 class="modal-title"&gt;
$services.localization.render('notifications.watch.modal.title', 'html/5.0', [])
&lt;span class="fa $watchIcon"&gt;&lt;/span&gt; $services.localization.render("notifications.watch.modal.title.$watchedStatus", 'html/5.0', [])
&lt;/h4&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
Expand All @@ -590,13 +593,8 @@
#set ($ancestorDocTitle = $ancestorDoc.displayTitle)
#set ($ancestorLink = "&lt;a href=""$ancestorDocUrl""&gt;$ancestorDocTitle&lt;/a&gt;")
$services.localization.render('notifications.watch.modal.description.ancestoroption', [$ancestorLink])
#else
$services.localization.render('notifications.watch.modal.description.options', 'html/5.0', [])
#end
&lt;/p&gt;
#if ($isTerminal)
&lt;p class="terminal-page-info"&gt;$services.localization.render('notifications.watch.modal.terminalpage.info', 'html/5.0', [])&lt;/p&gt;
#end
&lt;div class="watch-options-container panel-group" id="watch-options-accordion" role="tablist" aria-multiselectable="false"&gt;
#set ($blockedByAncestor = ("$!ancestorWatchStatus" == '' || $ancestorWatchStatus.isBlocked()))
#set ($watchedByAncestor = ($ancestorWatchStatus.isWatched()))
Expand Down Expand Up @@ -662,17 +660,21 @@
&lt;/div&gt;&lt;!-- end panel group --&gt;
&lt;div class="modal-body-footer"&gt;
#set ($userDoc = $xwiki.getDocument($xcontext.userReference))
#set ($notifUrl = "$userDoc.getURL('view','category=notifications')#Hnotifications.settings.filters.preferences.custom.title")
$services.localization.render('notifications.watch.modal.option.settingslink', ["&lt;a href='$notifUrl'&gt;", '&lt;/a&gt;'])
#set ($settingsLink = "$userDoc.getURL('view','category=notifications')#Hnotifications.settings.filters.preferences.custom.title")
&lt;a href="$settingsLink" class="goto-settings"&gt;
$services.localization.render('notifications.watch.modal.gotosettings', 'html/5.0', []) $services.icon.renderHTML('move')
&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;!-- end modal body --&gt;
&lt;div class="modal-footer"&gt;
&lt;button type="button" class="btn btn-default close-modal" data-dismiss="modal"&gt;
$services.localization.render('notifications.watch.modal.close', 'html/5.0', [])
&lt;/button&gt;
#if ($watchedStatus != 'CUSTOM')
&lt;button type="button" class="btn btn-primary" disabled="disabled"&gt;
$services.localization.render('notifications.watch.modal.savechanges', 'html/5.0', [])
&lt;/button&gt;
#end
&lt;/div&gt;
&lt;/div&gt;&lt;!-- /.modal-content --&gt;
&lt;/div&gt;&lt;!-- /.modal-dialog --&gt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,46 +251,60 @@ notifications.watch.button.status.custom=Custom
notifications.watch.modal.title=Notification settings for this page
notifications.watch.modal.description.options=You can change the current notification settings with the following options:
notifications.watch.modal.description.ancestoroption=You can either go to {0} and modify the notification settings there or directly apply settings on the current page with the following options:

notifications.watch.modal.title.WATCHED_FOR_ALL_EVENTS_AND_FORMATS=Followed page watch settings
notifications.watch.modal.description.WATCHED_FOR_ALL_EVENTS_AND_FORMATS=You are following this page: you will receive notifications for it.

notifications.watch.modal.title.WATCHED_BY_ANCESTOR_FOR_ALL_EVENTS_AND_FORMATS=Followed page by parent watch settings
notifications.watch.modal.description.WATCHED_BY_ANCESTOR_FOR_ALL_EVENTS_AND_FORMATS=You are following this page through a parent in the hierarchy: you will receive notifications for it.

notifications.watch.modal.title.WATCHED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS=Followed page and children watch settings
notifications.watch.modal.description.WATCHED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS=You are following this page and its children: you will receive notifications for it.
notifications.watch.modal.description.NOT_SET=You are not following this page: you won't receive notifications for it.

notifications.watch.modal.title.NOT_SET=Not set watch settings
notifications.watch.modal.description.NOT_SET=You haven't configured any settings for watching this page yet and so you are not following this page: you won't receive notifications for it.

notifications.watch.modal.title.BLOCKED_FOR_ALL_EVENTS_AND_FORMATS=Blocked page watch settings
notifications.watch.modal.description.BLOCKED_FOR_ALL_EVENTS_AND_FORMATS=You are ignoring this page: you won't receive any notifications for it.

notifications.watch.modal.title.BLOCKED_BY_ANCESTOR_FOR_ALL_EVENTS_AND_FORMATS=Blocked page by parent watch settings
notifications.watch.modal.description.BLOCKED_BY_ANCESTOR_FOR_ALL_EVENTS_AND_FORMATS=You are ignoring this page through a parent in the hierarchy: you won't receive any notifications for it.

notifications.watch.modal.title.BLOCKED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS=Blocked page and children watch settings
notifications.watch.modal.description.BLOCKED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS=You are ignoring this page and its children: you won't receive any notifications for it.
notifications.watch.modal.description.CUSTOM=You are using custom notification settings for this page: you should review them to know exactly which notifications you might receive.

notifications.watch.modal.terminalpage.info=This is a terminal page: some options for following or ignoring page and children are not displayed.
notifications.watch.modal.option.settingslink=You can find and manipulate all page notification settings in {0}your user profile{1}.
notifications.watch.modal.title.CUSTOM=Custom watch settings
notifications.watch.modal.description.CUSTOM=You are using custom notification settings for this page: you might be following or blocking specific events for the page or you might target only specific channels for the notifications. We invite you to review your notification settings from your profile.

notifications.watch.modal.option.watchpage.title=Follow current page
notifications.watch.modal.option.watchpage.hint=You will receive notifications for that page only.
notifications.watch.modal.option.watchspace.title=Follow current page and its children
notifications.watch.modal.option.watchspace.hint=You will receive notifications for that page and its children.
notifications.watch.modal.option.watchwiki.title=Follow current wiki
notifications.watch.modal.option.watchwiki.hint=You will receive notifications for any page in the wiki.
notifications.watch.modal.option.watchwiki.title=Follow entire wiki
notifications.watch.modal.option.watchwiki.hint=This option doesn't only impact current page or space: you will receive notifications for any page in the wiki.

notifications.watch.modal.option.blockpage.title=Ignore current page
notifications.watch.modal.option.blockpage.hint=You will ignore any notifications for that page only.
notifications.watch.modal.option.blockspace.title=Ignore current page and its children
notifications.watch.modal.option.blockspace.hint=You will ignore any notifications for that page and all of its children.
notifications.watch.modal.option.blockpage.title=Block current page
notifications.watch.modal.option.blockpage.hint=You will block any notifications for that page only.
notifications.watch.modal.option.blockspace.title=Block current page and its children
notifications.watch.modal.option.blockspace.hint=You will block any notifications for that page and all of its children.

notifications.watch.modal.option.unwatchpage.title=Unfollow current page
notifications.watch.modal.option.unwatchpage.hint=You will stop receiving notifications for that page only.
notifications.watch.modal.option.unwatchspace.title=Unfollow current page and its children
notifications.watch.modal.option.unwatchspace.hint=You will stop receiving notifications for that page and its children.
notifications.watch.modal.option.unwatchwiki.title=Unfollow current wiki
notifications.watch.modal.option.unwatchwiki.hint=You will stop receiving notifications for any page in the wiki.
notifications.watch.modal.option.unwatchwiki.title=Unfollow entire wiki
notifications.watch.modal.option.unwatchwiki.hint=This option doesn't only impact current page or space: you will stop receiving notifications for any page in the wiki.

notifications.watch.modal.option.unblockpage.title=Unignore current page
notifications.watch.modal.option.unblockpage.title=Unblock current page
notifications.watch.modal.option.unblockpage.hint=You will receive notifications for that page only.
notifications.watch.modal.option.unblockspace.title=Unignore current page and its children
notifications.watch.modal.option.unblockspace.title=Unblock current page and its children
notifications.watch.modal.option.unblockspace.hint=You will receive notifications for that page and its children.
notifications.watch.modal.option.unblockwiki.title=Unignore current wiki
notifications.watch.modal.option.unblockwiki.hint=You will stop ignoring notifications for any page in the wiki.
notifications.watch.modal.option.unblockwiki.title=Unblock entire wiki
notifications.watch.modal.option.unblockwiki.hint=This option doesn't only impact current page or space: you will stop ignoring notifications for any page in the wiki.

notifications.watch.modal.close=Close without saving
notifications.watch.modal.savechanges=Save changes
notifications.watch.modal.gotosettings=Manage all notifications settings

## Used to indicate where deprecated keys start
#@deprecatedstart
Expand Down

0 comments on commit 2b0c10e

Please sign in to comment.