Skip to content

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

Replace regular button with accent link

Mir Bhatia03b4b9441d62
diff --git a/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erb b/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erb
index dc2e5933814..c7f56e7ab1a 100644
--- a/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erb
+++ b/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erb
@@ -29,43 +29,32 @@ See COPYRIGHT and LICENSE files for more details.
<%=
component_wrapper do
- render(Primer::OpenProject::FlexLayout.new) do |flex|
- flex.with_row do
- render(Primer::OpenProject::FlexLayout.new(align_items: :center)) do |row|
- row.with_column do
- render(Primer::Beta::Heading.new(tag: :h5)) { I18n.t("label_send_email_updates") }
- end
+ render(Primer::OpenProject::SidePanel::Section.new) do |section|
+ section.with_title { I18n.t("meeting.notifications.sidepanel.title") }
- row.with_column(ml: 2) do
- if @meeting.notify?
- concat(
- render(Primer::Beta::Text.new(color: :success, font_size: :small)) do
- I18n.t("label_status_enabled")
- end
- )
- else
- concat(
- render(Primer::Beta::Text.new(color: :danger, font_size: :small)) do
- I18n.t("label_status_muted")
- end
- )
- end
- end
+ 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
- if show_button?
- flex.with_row(mt: 2) do
- render(
- Primer::Beta::Button.new(
- scheme: :default,
- block: true,
- tag: :a,
- href: toggle_notifications_dialog_project_meeting_path(@project, @meeting),
- title: I18n.t("label_send_email_updates"),
- data: { "turbo-stream": true }
- )
- ) { title }
+ flex_layout do |flex|
+ flex.with_row do
+ concat(render(Primer::Beta::Text.new(font_weight: :semibold)) { "#{state} " })
+ concat(render(Primer::Beta::Text.new) { description })
+ end
+
+ unless show_button?
+ flex.with_row(mt: 2) do
+ render(Primer::Beta::Text.new) { additional_text }
+ end
end
end
end
diff --git a/modules/meeting/app/components/meetings/side_panel/notifications_button_component.rb b/modules/meeting/app/components/meetings/side_panel/notifications_button_component.rb
index e72aed72993..1c6cd17b1d9 100644
--- a/modules/meeting/app/components/meetings/side_panel/notifications_button_component.rb
+++ b/modules/meeting/app/components/meetings/side_panel/notifications_button_component.rb
@@ -43,13 +43,32 @@ module Meetings
private
- def title
- @meeting.notify? ? I18n.t("label_mute") : I18n.t("label_enable")
+ def key
+ @key ||= @meeting.notify? ? "enabled" : "disabled"
end
- def show_button?
- return false unless @meeting.editable?
+ def state
+ I18n.t("meeting.notifications.sidepanel.state.#{key}")
+ end
+
+ def description
+ I18n.t("meeting.notifications.sidepanel.description.#{key}")
+ end
+
+ def additional_text
+ I18n.t("meeting.notifications.sidepanel.description.change_via_template")
+ end
+ def button_label
+ label_key = @meeting.notify? ? "disable" : "enable"
+ I18n.t("meeting.notifications.sidepanel.button.#{label_key}")
+ end
+
+ def button_icon
+ @meeting.notify? ? :"bell-slash" : :bell
+ end
+
+ def show_button?
[email protected]? || @meeting.templated?
end
end
diff --git a/modules/meeting/app/components/meetings/side_panel/state_component.html.erb b/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
index 090116b69bd..140e54a17fc 100644
--- a/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
+++ b/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
@@ -16,6 +16,7 @@
if edit_enabled?
section.with_footer_button(
+ color: :accent,
tag: :a,
href: href("in_progress"),
classes: "hide-when-print",
@@ -40,7 +41,9 @@
if edit_enabled?
section.with_footer_button(
+ color: :accent,
tag: :a,
+ scheme: :link,
href: href("open"),
classes: "hide-when-print",
data: button_data_attributes(href("open"))
@@ -63,7 +66,9 @@
if edit_enabled?
section.with_footer_button(
+ color: :accent,
tag: :a,
+ scheme: :link,
href: href("closed"),
classes: "hide-when-print",
test_selector: "close-meeting-button",
diff --git a/modules/meeting/app/components/meetings/side_panel/toggle_notifications_dialog_component.rb b/modules/meeting/app/components/meetings/side_panel/toggle_notifications_dialog_component.rb
index e0a0f0b8fd0..beb150a25f4 100644
--- a/modules/meeting/app/components/meetings/side_panel/toggle_notifications_dialog_component.rb
+++ b/modules/meeting/app/components/meetings/side_panel/toggle_notifications_dialog_component.rb
@@ -46,33 +46,33 @@ module Meetings
def title
if @meeting.notify?
- I18n.t("meeting.notifications_dialog.title.mute")
+ I18n.t("meeting.notifications.dialog.title.mute")
else
- I18n.t("meeting.notifications_dialog.title.enable")
+ I18n.t("meeting.notifications.dialog.title.enable")
end
end
def heading
if @meeting.notify?
- I18n.t("meeting.notifications_dialog.title.mute")
+ I18n.t("meeting.notifications.dialog.title.mute")
else
- I18n.t("meeting.notifications_dialog.title.enable")
+ I18n.t("meeting.notifications.dialog.title.enable")
end
end
def confirmation_message
if @meeting.notify?
- I18n.t("meeting.notifications_dialog.message.mute")
+ I18n.t("meeting.notifications.dialog.message.mute")
else
- I18n.t("meeting.notifications_dialog.message.enable")
+ I18n.t("meeting.notifications.dialog.message.enable")
end
end
def confirm_button_text
if @meeting.notify?
- I18n.t("meeting.notifications_dialog.confirm_label.mute")
+ I18n.t("meeting.notifications.dialog.confirm_label.mute")
else
- I18n.t("meeting.notifications_dialog.confirm_label.enable")
+ I18n.t("meeting.notifications.dialog.confirm_label.enable")
end
end
diff --git a/modules/meeting/app/components/meetings/side_panel_component.html.erb b/modules/meeting/app/components/meetings/side_panel_component.html.erb
index c5a223abe69..dcb1352159d 100644
--- a/modules/meeting/app/components/meetings/side_panel_component.html.erb
+++ b/modules/meeting/app/components/meetings/side_panel_component.html.erb
@@ -3,7 +3,9 @@
render(Primer::OpenProject::SidePanel.new) do |panel|
panel.with_section(Meetings::SidePanel::DetailsComponent.new(meeting: @meeting))
- panel.with_section(Meetings::SidePanel::NotificationsButtonComponent.new(meeting: @meeting))
+ if @meeting.editable?
+ panel.with_section(Meetings::SidePanel::NotificationsButtonComponent.new(meeting: @meeting))
+ end
unless @meeting.template?
panel.with_section(Meetings::SidePanel::StateComponent.new(meeting: @meeting))
diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml
index 2b2f431d076..9aa2f4c08dd 100644
--- a/modules/meeting/config/locales/en.yml
+++ b/modules/meeting/config/locales/en.yml
@@ -281,20 +281,33 @@ en:
label: Footer text
caption: This text will appear on every page at the center of the footer.
submit_button: Download
- notifications_dialog:
- title:
- enable: "Enable email calendar updates?"
- mute: "Mute email calendar updates?"
- message:
- enable: >
- All participants will receive updated calendar invites via email informing them of changes to the meeting.
- One will be sent immediately now.
- mute: >
- Participants will no longer receive updated calendar invites via email with changes to the meeting.
- If they already had an invite for this meeting, it might no longer be accurate.
- confirm_label:
- enable: "Enable email updates"
- mute: "Mute email updates"
+ 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?"
+ mute: "Mute email calendar updates?"
+ message:
+ enable: >
+ All participants will receive updated calendar invites via email informing them of changes to the meeting.
+ One will be sent immediately now.
+ mute: >
+ Participants will no longer receive updated calendar invites via email with changes to the meeting.
+ If they already had an invite for this meeting, it might no longer be accurate.
+ confirm_label:
+ enable: "Enable email updates"
+ mute: "Mute email updates"
meeting_section:
untitled_title: "Untitled section"
@@ -547,10 +560,3 @@ en:
text_email_updates_muted: "Email calendar updates are muted. Participants will not receive updated invites via email when you make changes."
text_email_updates_enabled: "Email calendar updates are enabled. All participants will receive updated invites via email when you make changes."
- label_send_email_updates: "Send email calendar updates"
- label_mute: "Mute"
- label_enable: "Enable"
- label_status_muted: "muted"
- label_status_enabled: "enabled"
-
-