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
Incorporate feedback
Mir Bhatia67b3a3e835a6
diff --git a/app/components/op_primer/email_updates_mode_selector_component.rb b/app/components/op_primer/email_updates_mode_selector_component.rbindex 26b7aecb1c4..d408a5fc5f6 100644--- a/app/components/op_primer/email_updates_mode_selector_component.rb+++ b/app/components/op_primer/email_updates_mode_selector_component.rb@@ -33,7 +33,7 @@ module OpPrimerinclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpers- def initialize(toggle:, path:, title:, enabled_description:, disabled_description:, alt_text: nil, show_button: true,+ def initialize(enabled:, path:, title:, enabled_description:, disabled_description:, alt_text: nil, show_button: true,method: :get)super@@ -42,7 +42,7 @@ module OpPrimerend- @toggle = toggle+ @enabled = enabled@path = path@title = title@enabled_description = enabled_description@@ -54,22 +54,24 @@ module OpPrimerprivate+ def key+ @key ||= @enabled ? "enabled" : "disabled"+ end+def button_icon- @toggle ? :"bell-slash" : :bell+ @enabled ? :"bell-slash" : :bellenddef button_label- label_key = @toggle ? "disable" : "enable"- I18n.t("meeting.notifications.sidepanel.button.#{label_key}")+ I18n.t("email_calendar_updates.button.#{key}")enddef state- key = @toggle ? "enabled" : "disabled"- I18n.t("meeting.notifications.sidepanel.state.#{key}")+ I18n.t("email_calendar_updates.state.#{key}")enddef description- @toggle ? @enabled_description : @disabled_description+ @enabled ? @enabled_description : @disabled_descriptionendendenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 26a4f92d18d..7c9fbd855c5 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -2337,6 +2337,15 @@ en:consent_html: >I agree with the <a target="_blank" href="https://www.openproject.org/terms-of-service/">terms of service</a>and the <a target="_blank" href="https://www.openproject.org/data-privacy-and-security/">privacy policy</a>.++ email_calendar_updates:+ state:+ disabled: "Disabled."+ enabled: "Enabled."+ button:+ disabled: "Enable"+ enabled: "Disable"+enumeration_activities: "Time tracking activities"enumeration_work_package_priorities: "Work package priorities"enumeration_reported_project_statuses: "Reported project status"diff --git a/lookbook/docs/components/email-updates-mode-selector.md.erb b/lookbook/docs/components/email-updates-mode-selector.md.erbindex fb4f63ea092..54b241363bc 100644--- a/lookbook/docs/components/email-updates-mode-selector.md.erb+++ b/lookbook/docs/components/email-updates-mode-selector.md.erb@@ -45,7 +45,7 @@ This is an example playground of the `OpPrimer::EmailUpdatesModeSelectorComponenThe parameters that can be passed are:-* `toggle`: (required) the boolean attribute that is being toggled (e.g. `@meeting.notify?`, `@storage.health_notifications_should_be_sent?`)+* `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 enableddiff --git a/lookbook/previews/op_primer/email_updates_mode_selector_component_preview.rb b/lookbook/previews/op_primer/email_updates_mode_selector_component_preview.rbindex 979c9cc1c32..4ee0d44a2a4 100644--- a/lookbook/previews/op_primer/email_updates_mode_selector_component_preview.rb+++ b/lookbook/previews/op_primer/email_updates_mode_selector_component_preview.rb@@ -32,7 +32,7 @@ module OpPrimer# @logical_path OpenProject/Primerclass EmailUpdatesModeSelectorComponentPreview < Lookbook::Preview# See the [component documentation](/lookbook/pages/components/email_updates_mode_selector) for more details.- # @param toggle [Boolean]+ # @param enabled [Boolean]# @param path [String]# @param title [String]# @param enabled_description [String]@@ -41,7 +41,7 @@ module OpPrimer# @param show_button [Boolean]# @param method [Symbol] select [get, post, patch]def playground(- toggle: true,+ enabled: true,path: "/projects/demo-project/meetings/113/toggle_notifications",title: "Sidebar component title",enabled_description: "Email updates are enabled for all users.",@@ -51,7 +51,7 @@ module OpPrimermethod: :patch)render OpPrimer::EmailUpdatesModeSelectorComponent.new(- toggle:,+ enabled:,path:,title:,enabled_description:,@@ -62,55 +62,46 @@ module OpPrimer)end- def enabled(toggle: true, path: "", title: "Sidebar component title",- enabled_description: "Email updates are enabled for all users.",- disabled_description: "Email updates are disabled for all users.")+ def enabledrender OpPrimer::EmailUpdatesModeSelectorComponent.new(- toggle:,- path:,- title:,- enabled_description:,- disabled_description:+ enabled: true,+ path: "/projects/demo-project/meetings/113/toggle_notifications",+ title: "Sidebar component title",+ enabled_description: "Email updates are enabled for all users.",+ disabled_description: "Email updates are disabled for all users.")end- def disabled(toggle: false, path: "", title: "Sidebar component title",- enabled_description: "Email updates are enabled for all users.",- disabled_description: "Email updates are disabled for all users.")+ def disabledrender OpPrimer::EmailUpdatesModeSelectorComponent.new(- toggle:,- path:,- title:,- enabled_description:,- disabled_description:+ enabled: false,+ path: "/projects/demo-project/meetings/113/toggle_notifications",+ title: "Sidebar component title",+ enabled_description: "Email updates are enabled for all users.",+ disabled_description: "Email updates are disabled for all users.")end- def with_conditional_alt_text(toggle: true, path: "", title: "Sidebar component title",- enabled_description: "Email updates are enabled for all users.",- disabled_description: "Email updates are disabled for all users.",- alt_text: "To change this, edit the series template.", show_button: false)+ def with_conditional_alt_textrender OpPrimer::EmailUpdatesModeSelectorComponent.new(- toggle:,- path:,- title:,- enabled_description:,- disabled_description:,- alt_text:,- show_button:+ enabled: true,+ path: "/projects/demo-project/meetings/113/toggle_notifications",+ title: "Sidebar component title",+ enabled_description: "Email updates are enabled for all users.",+ disabled_description: "Email updates are disabled for all users.",+ alt_text: "To change this, edit the series template.",+ show_button: false)end- def with_different_button_method(toggle: true, path: "", title: "Sidebar component title",- enabled_description: "Email updates are enabled for all users.",- disabled_description: "Email updates are disabled for all users.", method: :patch)+ def with_different_button_methodrender OpPrimer::EmailUpdatesModeSelectorComponent.new(- toggle:,- path:,- title:,- enabled_description:,- disabled_description:,- method:+ enabled: true,+ path: "/projects/demo-project/meetings/113/toggle_notifications",+ title: "Sidebar component title",+ enabled_description: "Email updates are enabled for all users.",+ disabled_description: "Email updates are disabled for all users.",+ method: :patch)endenddiff --git a/modules/meeting/app/components/meetings/side_panel_component.rb b/modules/meeting/app/components/meetings/side_panel_component.rbindex ab0c1a6de0b..ef65d063f85 100644--- a/modules/meeting/app/components/meetings/side_panel_component.rb+++ b/modules/meeting/app/components/meetings/side_panel_component.rb@@ -43,7 +43,7 @@ module Meetingsdef email_updates_mode_selectorOpPrimer::EmailUpdatesModeSelectorComponent.new(- toggle: @meeting.notify?,+ enabled: @meeting.notify?,path: toggle_notifications_dialog_project_meeting_path(@meeting.project, @meeting),title: I18n.t("meeting.notifications.sidepanel.title"),enabled_description: I18n.t("meeting.notifications.sidepanel.description.enabled"),diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex a55a820222d..b650de5d836 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -285,16 +285,10 @@ en:notifications:sidepanel:title: "Email calendar updates"- state:- disabled: "Disabled."- enabled: "Enabled."description:disabled: "Participants will not receive an email informing them of changes."enabled: "All participants will receive updated calendar invites via email informing them of changes."change_via_template: "To change this, edit the series template."- button:- disable: "Disable"- enable: "Enable"dialog:title:enable: "Enable email calendar updates?"diff --git a/modules/storages/app/components/storages/admin/side_panel/email_updates_mode_selector_component.rb b/modules/storages/app/components/storages/admin/side_panel/email_updates_mode_selector_component.rbindex 8056b51259b..f735304feb5 100644--- a/modules/storages/app/components/storages/admin/side_panel/email_updates_mode_selector_component.rb+++ b/modules/storages/app/components/storages/admin/side_panel/email_updates_mode_selector_component.rb@@ -47,7 +47,7 @@ module Storagesdef callcomponent_wrapper dorender OpPrimer::EmailUpdatesModeSelectorComponent.new(- toggle: @storage.health_notifications_should_be_sent?,+ enabled: @storage.health_notifications_should_be_sent?,path: change_health_notifications_enabled_admin_settings_storage_path(@storage),title: I18n.t("storages.health_email_notifications.title"),enabled_description: I18n.t("storages.health_email_notifications.description_enabled"),diff --git a/spec/components/op_primer/email_updates_mode_selector_component_spec.rb b/spec/components/op_primer/email_updates_mode_selector_component_spec.rbindex e000afb6836..1ff00f4a547 100644--- a/spec/components/op_primer/email_updates_mode_selector_component_spec.rb+++ b/spec/components/op_primer/email_updates_mode_selector_component_spec.rb@@ -31,7 +31,7 @@require "rails_helper"RSpec.describe OpPrimer::EmailUpdatesModeSelectorComponent, type: :component do- let(:toggle) { true }+ let(:enabled) { true }let(:path) { "example.com" }let(:title) { "Title" }let(:enabled_description) { "Enabled description" }@@ -41,7 +41,7 @@ RSpec.describe OpPrimer::EmailUpdatesModeSelectorComponent, type: :component dosubject(:component) dodescribed_class.new(- toggle:,+ enabled:,path:,title:,enabled_description:,@@ -51,7 +51,7 @@ RSpec.describe OpPrimer::EmailUpdatesModeSelectorComponent, type: :component do)end- context "when toggle is true" do+ context "when enabled is true" doit "renders the enabled variant" dorender_inline(component)@@ -64,8 +64,8 @@ RSpec.describe OpPrimer::EmailUpdatesModeSelectorComponent, type: :component doendend- context "when toggle is false" do- let(:toggle) { false }+ context "when enabled is false" do+ let(:enabled) { false }it "renders the disabled variant" dorender_inline(component)