OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
The Email Updates Mode Selector is used to let users enable or disable automatic email updates when significant events take place. It serves as both a mode indicator and, if the user has the necessary permissions, control to change the mode.
## Overview
<%= embed OpPrimer::EmailUpdatesModeSelectorComponentPreview, :playground %>
## Anatomy
The component is simple: it consists of a static header, a text that indicates mode (and what that status means) and, in some cases, a button to change the mode.
The current mode is always indicated in bold.
The action to change the mode (often 'Enable' or 'Disable') is a button with scheme `link`, with a leading icon. If a suitable leading icon is not available, it can also be used without an icon.
This action is not present in some views; for example, if it is not possible to change the mode in the current view. (For example, in an occurrence of a meeting series, this component simply indicates mode; the actual change has to happen in the meeting template and the text is updated to convey this).
## Best practices
**Do**
- Only use the component on the right side panel.
- Use simple, non-jargon language when describing what the current mode is doing.
- If the information concerning current mode is not relevant in a particular view (eg. if a meeting is closed or the user does not have any rights to modify the state), then hide the component altogether.
**Don't**
- Do not use this component when a checkbox or a toggle is more relevant. However, because toggle switches are activated immediately and the request sent asynchronously before a form submit (regardless of whether the request is successful or not), they might not always be the right component to use. This is the case for email updates.
## Used in
The component is used in:
* Meetings to indicate (and, when the user has the necessary permissions, control) the automatic sending of updated calendar invites by email to all participants when there are significant changes to meeting details, such as date, time or location.
* File storage health check email updates to admins.
## Examples
For detailed examples have a look at the other [preview examples](/lookbook/inspect/OpenProject/Primer/email_updates_mode_selector/playground) of the component.
This is an example playground of the `OpPrimer::EmailUpdatesModeSelectorComponent`.
<%= embed OpPrimer::EmailUpdatesModeSelectorComponentPreview, :playground, panels: %i[params source] %>
## Technical notes
The parameters that can be passed are:
* `enabled`: (required) the boolean attribute that is being toggled (e.g. `@meeting.notify?`, `@storage.health_notifications_should_be_sent?`)
* `path`: (required) the path for the toggle button
* `title`: (required) the title of the sidebar section
* `enabled_description`: (required) the description when email updates are enabled
* `disabled_description`: (required) the description when email updates are disabled
* `alt_text`: (optional, but required when setting `show_button`) the alternative text displayed when the toggle button is hidden - defaults to `nil`
* `show_button`: (optional) a boolean/conditional value that sets when the button is hidden and `alt_text` is shown instead - defaults to `true`
* `method`: (optional) the method for the toggle button - defaults to `:get`