mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Rename component to EmailUpdatesModeSelectorComponent
This commit is contained in:
+2
-2
@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.
|
||||
++#%>
|
||||
|
||||
<%=
|
||||
component_wrapper(data: { "test-selector": "email-updates-switch" }) do
|
||||
component_wrapper(data: { "test-selector": "email-updates-mode-selector" }) do
|
||||
render(Primer::OpenProject::SidePanel::Section.new) do |section|
|
||||
section.with_title { @title }
|
||||
|
||||
@@ -38,7 +38,7 @@ See COPYRIGHT and LICENSE files for more details.
|
||||
tag: :a,
|
||||
href: @path,
|
||||
classes: "hide-when-print",
|
||||
data: { "turbo-stream": true, "turbo-method": @method, "test-selector": "email-updates-switch-button" }
|
||||
data: { "turbo-stream": true, "turbo-method": @method, "test-selector": "email-updates-mode-selector-button" }
|
||||
) do |button|
|
||||
button.with_leading_visual_icon(icon: button_icon)
|
||||
button_label
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
#++
|
||||
|
||||
module OpPrimer
|
||||
class EmailUpdatesSwitchComponent < Primer::Component # rubocop:disable OpenProject/AddPreviewForViewComponent
|
||||
class EmailUpdatesModeSelectorComponent < Primer::Component # rubocop:disable OpenProject/AddPreviewForViewComponent
|
||||
include OpTurbo::Streamable
|
||||
include OpPrimer::ComponentHelpers
|
||||
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
<%#-- copyright
|
||||
OpenProject is an open source project management software.
|
||||
Copyright (C) the OpenProject GmbH
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 3.
|
||||
|
||||
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
Copyright (C) 2010-2013 the ChiliProject Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
See COPYRIGHT and LICENSE files for more details.
|
||||
|
||||
++#%>
|
||||
|
||||
<%=
|
||||
component_wrapper(data: { "test-selector": "notifications-button" }) do
|
||||
render(Primer::OpenProject::SidePanel::Section.new) do |section|
|
||||
section.with_title { I18n.t("meeting.notifications.sidepanel.title") }
|
||||
|
||||
if show_button?
|
||||
section.with_footer_button(
|
||||
color: :accent,
|
||||
tag: :a,
|
||||
href: toggle_notifications_dialog_project_meeting_path(@project, @meeting),
|
||||
classes: "hide-when-print",
|
||||
data: { "turbo-stream": true }
|
||||
) do |button|
|
||||
button.with_leading_visual_icon(icon: button_icon)
|
||||
button_label
|
||||
end
|
||||
end
|
||||
|
||||
flex_layout do |flex|
|
||||
flex.with_row do
|
||||
concat(render(Primer::Beta::Text.new(font_weight: :semibold, color: :subtle)) { "#{state} " })
|
||||
concat(render(Primer::Beta::Text.new(color: :subtle)) { description })
|
||||
end
|
||||
|
||||
unless show_button?
|
||||
flex.with_row(mt: 2) do
|
||||
render(Primer::Beta::Text.new(color: :subtle)) { additional_text }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
@@ -4,7 +4,7 @@
|
||||
panel.with_section(Meetings::SidePanel::DetailsComponent.new(meeting: @meeting))
|
||||
|
||||
if @meeting.editable?
|
||||
panel.with_section(email_updates_switch)
|
||||
panel.with_section(email_updates_mode_selector)
|
||||
end
|
||||
|
||||
unless @meeting.template?
|
||||
|
||||
@@ -41,8 +41,8 @@ module Meetings
|
||||
|
||||
private
|
||||
|
||||
def email_updates_switch
|
||||
OpPrimer::EmailUpdatesSwitchComponent.new(
|
||||
def email_updates_mode_selector
|
||||
OpPrimer::EmailUpdatesModeSelectorComponent.new(
|
||||
toggle: @meeting.notify?,
|
||||
path: toggle_notifications_dialog_project_meeting_path(@meeting.project, @meeting),
|
||||
title: I18n.t("meeting.notifications.sidepanel.title"),
|
||||
|
||||
@@ -99,7 +99,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
show_page.visit!
|
||||
|
||||
# check calendar updates sidepanel component
|
||||
page.within("[data-test-selector='email-updates-switch']") do
|
||||
page.within("[data-test-selector='email-updates-mode-selector']") do
|
||||
expect(page).to have_text("Email calendar updates")
|
||||
expect(page).to have_text("Enabled.")
|
||||
expect(page).to have_text("All participants will receive updated calendar invites via email informing them of changes.")
|
||||
@@ -125,7 +125,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
# disable updates from the sidepanel
|
||||
page.within("[data-test-selector='email-updates-switch']") do
|
||||
page.within("[data-test-selector='email-updates-mode-selector']") do
|
||||
click_on "Disable"
|
||||
end
|
||||
|
||||
@@ -139,7 +139,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
# check that updates are now disabled
|
||||
expect(meeting.reload.notify).to be false
|
||||
|
||||
page.within("[data-test-selector='email-updates-switch']") do
|
||||
page.within("[data-test-selector='email-updates-mode-selector']") do
|
||||
expect(page).to have_text("Email calendar updates")
|
||||
expect(page).to have_text("Disabled.")
|
||||
expect(page).to have_text("Participants will not receive an email informing them of changes.")
|
||||
@@ -160,7 +160,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
wait_for_network_idle
|
||||
|
||||
# enable updates and check that an email is sent out immediately
|
||||
page.within("[data-test-selector='notifications-button']") do
|
||||
page.within("[data-test-selector='email-updates-mode-selector']") do
|
||||
click_on "Enable"
|
||||
end
|
||||
|
||||
@@ -178,7 +178,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
# check that no mails are sent on edit/delete when disabled
|
||||
page.within("[data-test-selector='notifications-button']") do
|
||||
page.within("[data-test-selector='email-updates-mode-selector']") do
|
||||
click_on "Disable"
|
||||
end
|
||||
|
||||
@@ -259,7 +259,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
template_page.visit!
|
||||
|
||||
# check sidepanel component
|
||||
page.within("[data-test-selector='email-updates-switch']") do
|
||||
page.within("[data-test-selector='email-updates-mode-selector']") do
|
||||
expect(page).to have_text("Email calendar updates")
|
||||
expect(page).to have_text("Enabled.")
|
||||
expect(page).to have_text("All participants will receive updated calendar invites via email informing them of changes.")
|
||||
@@ -289,7 +289,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
# switch to occurrence and check sidepanel component
|
||||
occurrence_page.visit!
|
||||
|
||||
page.within("[data-test-selector='email-updates-switch']") do
|
||||
page.within("[data-test-selector='email-updates-mode-selector']") do
|
||||
expect(page).to have_text("Email calendar updates")
|
||||
expect(page).to have_text("Enabled.")
|
||||
expect(page).to have_text("All participants will receive updated calendar invites via email informing them of changes.")
|
||||
@@ -320,7 +320,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
# turn off updates from the template
|
||||
template_page.visit!
|
||||
|
||||
page.within("[data-test-selector='email-updates-switch']") do
|
||||
page.within("[data-test-selector='email-updates-mode-selector']") do
|
||||
click_on "Disable"
|
||||
end
|
||||
|
||||
@@ -336,7 +336,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
# check that this is reflected for occurrences too
|
||||
occurrence_page.visit!
|
||||
|
||||
page.within("[data-test-selector='email-updates-switch']") do
|
||||
page.within("[data-test-selector='email-updates-mode-selector']") do
|
||||
expect(page).to have_text("Email calendar updates")
|
||||
expect(page).to have_text("Disabled.")
|
||||
expect(page).to have_text("Participants will not receive an email informing them of changes.")
|
||||
@@ -371,7 +371,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
it "does not show the sidebar component" do
|
||||
show_page.visit!
|
||||
|
||||
expect(page).to have_no_css("[data-test-selector='email-updates-switch']")
|
||||
expect(page).to have_no_css("[data-test-selector='email-updates-mode-selector']")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -392,7 +392,7 @@ RSpec.describe "Meeting notifications", :js do
|
||||
it "does not show the sidebar component" do
|
||||
show_page.visit!
|
||||
|
||||
expect(page).to have_no_css("[data-test-selector='email-updates-switch']")
|
||||
expect(page).to have_no_css("[data-test-selector='email-updates-mode-selector']")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@
|
||||
|
||||
module Storages
|
||||
module Admin
|
||||
class SidePanel::EmailUpdatesSwitchComponent < ApplicationComponent
|
||||
class SidePanel::EmailUpdatesModeSelectorComponent < ApplicationComponent
|
||||
include OpTurbo::Streamable
|
||||
include OpPrimer::ComponentHelpers
|
||||
|
||||
@@ -46,7 +46,7 @@ module Storages
|
||||
|
||||
def call
|
||||
component_wrapper do
|
||||
render OpPrimer::EmailUpdatesSwitchComponent.new(
|
||||
render OpPrimer::EmailUpdatesModeSelectorComponent.new(
|
||||
toggle: @storage.health_notifications_should_be_sent?,
|
||||
path: change_health_notifications_enabled_admin_settings_storage_path(@storage),
|
||||
title: I18n.t("storages.health_email_notifications.title"),
|
||||
@@ -6,7 +6,7 @@
|
||||
if @storage.automatic_management_enabled?
|
||||
panel.with_section(Storages::Admin::SidePanel::HealthNotificationsComponent.new(storage: @storage))
|
||||
|
||||
panel.with_section(Storages::Admin::SidePanel::EmailUpdatesSwitchComponent.new(storage: @storage))
|
||||
panel.with_section(Storages::Admin::SidePanel::EmailUpdatesModeSelectorComponent.new(storage: @storage))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -160,7 +160,7 @@ class Storages::Admin::StoragesController < ApplicationController
|
||||
|
||||
def change_health_notifications_enabled
|
||||
if @storage.update(health_notifications_enabled: !@storage.health_notifications_enabled)
|
||||
update_via_turbo_stream(component: Storages::Admin::SidePanel::EmailUpdatesSwitchComponent.new(storage: @storage))
|
||||
update_via_turbo_stream(component: Storages::Admin::SidePanel::EmailUpdatesModeSelectorComponent.new(storage: @storage))
|
||||
respond_with_turbo_streams
|
||||
else
|
||||
flash.now[:error] = I18n.t("storages.health_email_notifications.error_could_not_be_saved")
|
||||
|
||||
+3
-3
@@ -31,7 +31,7 @@
|
||||
require "spec_helper"
|
||||
require_module_spec_helper
|
||||
|
||||
RSpec.describe Storages::Admin::SidePanel::EmailUpdatesSwitchComponent, type: :component do
|
||||
RSpec.describe Storages::Admin::SidePanel::EmailUpdatesModeSelectorComponent, type: :component do
|
||||
describe "storage without automatically managed project folders" do
|
||||
let(:storage) { build_stubbed(:nextcloud_storage, :as_not_automatically_managed) }
|
||||
|
||||
@@ -52,7 +52,7 @@ RSpec.describe Storages::Admin::SidePanel::EmailUpdatesSwitchComponent, type: :c
|
||||
|
||||
it "renders a 'Disable' option with info" do
|
||||
text = "Admins will receive updates by email when there are important updates."
|
||||
expect(page).to have_test_selector("email-updates-switch", text: text)
|
||||
expect(page).to have_test_selector("email-updates-mode-selector", text: text)
|
||||
expect(page).to have_selector(:link_or_button, "Disable")
|
||||
end
|
||||
end
|
||||
@@ -62,7 +62,7 @@ RSpec.describe Storages::Admin::SidePanel::EmailUpdatesSwitchComponent, type: :c
|
||||
|
||||
it "renders an 'Enable' option with info" do
|
||||
text = "Admins will not receive updates by email when there are important updates."
|
||||
expect(page).to have_test_selector("email-updates-switch", text:)
|
||||
expect(page).to have_test_selector("email-updates-mode-selector", text:)
|
||||
expect(page).to have_selector(:link_or_button, "Enable")
|
||||
end
|
||||
end
|
||||
@@ -229,14 +229,14 @@ RSpec.describe "Admin Edit File storage",
|
||||
|
||||
aggregate_failures "Health notifications" do
|
||||
expect(page).to have_test_selector("storage-health-status", text: "Pending")
|
||||
expect(page).to have_test_selector("email-updates-switch-button", text: "Disable")
|
||||
expect(page).to have_test_selector("email-updates-switch",
|
||||
expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Disable")
|
||||
expect(page).to have_test_selector("email-updates-mode-selector",
|
||||
text: "Admins will receive updates by email when there are important updates.")
|
||||
|
||||
click_on "Disable"
|
||||
|
||||
expect(page).to have_test_selector("email-updates-switch-button", text: "Enable")
|
||||
expect(page).to have_test_selector("email-updates-switch",
|
||||
expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Enable")
|
||||
expect(page).to have_test_selector("email-updates-mode-selector",
|
||||
text: "Admins will not receive updates by email when there are important updates.")
|
||||
end
|
||||
end
|
||||
@@ -358,14 +358,14 @@ RSpec.describe "Admin Edit File storage",
|
||||
aggregate_failures "Health notifications" do
|
||||
expect(page).to have_test_selector("storage-health-status", text: "Pending")
|
||||
|
||||
expect(page).to have_test_selector("email-updates-switch-button", text: "Disable")
|
||||
expect(page).to have_test_selector("email-updates-switch",
|
||||
expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Disable")
|
||||
expect(page).to have_test_selector("email-updates-mode-selector",
|
||||
text: "Admins will receive updates by email when there are important updates.")
|
||||
|
||||
click_on "Disable"
|
||||
|
||||
expect(page).to have_test_selector("email-updates-switch-button", text: "Enable")
|
||||
expect(page).to have_test_selector("email-updates-switch",
|
||||
expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Enable")
|
||||
expect(page).to have_test_selector("email-updates-mode-selector",
|
||||
text: "Admins will not receive updates by email when there are important updates.")
|
||||
end
|
||||
end
|
||||
@@ -492,14 +492,14 @@ RSpec.describe "Admin Edit File storage",
|
||||
aggregate_failures "Health notifications" do
|
||||
expect(page).to have_test_selector("storage-health-status", text: "Pending")
|
||||
|
||||
expect(page).to have_test_selector("email-updates-switch-button", text: "Disable")
|
||||
expect(page).to have_test_selector("email-updates-switch",
|
||||
expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Disable")
|
||||
expect(page).to have_test_selector("email-updates-mode-selector",
|
||||
text: "Admins will receive updates by email when there are important updates.")
|
||||
|
||||
click_on "Disable"
|
||||
|
||||
expect(page).to have_test_selector("email-updates-switch-button", text: "Enable")
|
||||
expect(page).to have_test_selector("email-updates-switch",
|
||||
expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Enable")
|
||||
expect(page).to have_test_selector("email-updates-mode-selector",
|
||||
text: "Admins will not receive updates by email when there are important updates.")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user