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

chore[Op#40437]: remove unused constant, touch up formatting

Kabiru Mwenja7b632c319ca8
diff --git a/app/components/work_packages/activities_tab/journals/index_component.html.erb b/app/components/work_packages/activities_tab/journals/index_component.html.erb
index d6aa9ddc56c..adc7832bac0 100644
--- a/app/components/work_packages/activities_tab/journals/index_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/index_component.html.erb
@@ -1,25 +1,32 @@
<%=
component_wrapper(class: "work-packages-activities-tab-journals-index-component") do
flex_layout do |journals_index_wrapper_container|
- journals_index_wrapper_container.with_row(classes: "work-packages-activities-tab-journals-index-component--journals-inner-container", mb: inner_container_margin_bottom) do
- flex_layout(id: insert_target_modifier_id, data: { "test_selector": "op-wp-journals-container" }) do |journals_index_container|
+ journals_index_wrapper_container.with_row(
+ classes: "work-packages-activities-tab-journals-index-component--journals-inner-container",
+ mb: inner_container_margin_bottom
+ ) do
+ flex_layout(id: insert_target_modifier_id,
+ data: { test_selector: "op-wp-journals-container" }) do |journals_index_container|
if empty_state?
journals_index_container.with_row(mt: 2, mb: 3) do
render(
- WorkPackages::ActivitiesTab::Journals::EmptyComponent.new()
+ WorkPackages::ActivitiesTab::Journals::EmptyComponent.new
)
end
end
+
journals.each do |journal|
journals_index_container.with_row do
- render(
- WorkPackages::ActivitiesTab::Journals::ItemComponent.new(journal:, filter:)
- )
+ render(WorkPackages::ActivitiesTab::Journals::ItemComponent.new(journal:, filter:))
end
end
end
end
- journals_index_wrapper_container.with_row(classes: "work-packages-activities-tab-journals-index-component--stem-connection") unless empty_state? || journal_sorting == "desc"
+
+ unless empty_state? || journal_sorting_desc?
+ journals_index_wrapper_container
+ .with_row(classes: "work-packages-activities-tab-journals-index-component--stem-connection")
+ end
end
end
%>
diff --git a/app/components/work_packages/activities_tab/journals/index_component.rb b/app/components/work_packages/activities_tab/journals/index_component.rb
index 3e503df4334..ecacf00f175 100644
--- a/app/components/work_packages/activities_tab/journals/index_component.rb
+++ b/app/components/work_packages/activities_tab/journals/index_component.rb
@@ -59,6 +59,10 @@ module WorkPackages
User.current.preference&.comments_sorting || "desc"
end
+ def journal_sorting_desc?
+ journal_sorting == "desc"
+ end
+
def journals
work_package.journals.includes(:user, :notifications).reorder(version: journal_sorting)
end
@@ -72,7 +76,7 @@ module WorkPackages
end
def inner_container_margin_bottom
- if journal_sorting == "desc"
+ if journal_sorting_desc?
3
else
0
diff --git a/app/components/work_packages/activities_tab/journals/item_component/add_reactions.html.erb b/app/components/work_packages/activities_tab/journals/item_component/add_reactions.html.erb
index e451fae6786..2860b93aaba 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/add_reactions.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component/add_reactions.html.erb
@@ -2,11 +2,11 @@
component_wrapper do
if journal.available_emoji_reactions.any?
render(Primer::Alpha::Overlay.new(
- title: I18n.t("reactions.action_title"),
- padding: :condensed,
- anchor_side: :outside_top,
- visually_hide_title: true
- )) do |d|
+ title: I18n.t("reactions.action_title"),
+ padding: :condensed,
+ anchor_side: :outside_top,
+ visually_hide_title: true
+ )) do |d|
d.with_show_button(
icon: "smiley",
"aria-label": I18n.t("reactions.add_reaction"),
@@ -20,13 +20,13 @@
journal.available_emoji_reactions.each do |emoji, reaction|
add_reactions_container.with_column(mr: 2) do
render(Primer::Beta::Button.new(
- scheme: :invisible,
- id: "#{journal.id}-#{reaction}",
- tag: :a,
- href: toggle_reaction_work_package_activity_path(journal.journable.id, id: journal.id, reaction:),
- data: { "turbo-stream": true, "turbo-method": :put },
- "aria-label": I18n.t("reactions.react_with", reaction: reaction.tr("_", "")),
- )) do
+ scheme: :invisible,
+ id: "#{journal.id}-#{reaction}",
+ tag: :a,
+ href: toggle_reaction_work_package_activity_path(journal.journable.id, id: journal.id, reaction:),
+ data: { "turbo-stream": true, "turbo-method": :put },
+ "aria-label": I18n.t("reactions.react_with", reaction: reaction.tr("_", ""))
+ )) do
emoji
end
end
diff --git a/app/components/work_packages/activities_tab/journals/item_component/reactions.rb b/app/components/work_packages/activities_tab/journals/item_component/reactions.rb
index 6d4637c4dbf..c8e74f9c7b2 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/reactions.rb
+++ b/app/components/work_packages/activities_tab/journals/item_component/reactions.rb
@@ -30,8 +30,6 @@ module WorkPackages
module ActivitiesTab
module Journals
class ItemComponent::Reactions < ApplicationComponent
- MAX_DISPLAYED_USERS_COUNT = 5
-
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable