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

WIP: implementing review feedback from @oliverguenther

Jonas Jabaria609070abbe1
diff --git a/app/components/work_packages/activities_tab/journals/filter_and_sorting_component.html.erb b/app/components/work_packages/activities_tab/journals/filter_and_sorting_component.html.erb
index e237db62596..e24c7750899 100644
--- a/app/components/work_packages/activities_tab/journals/filter_and_sorting_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/filter_and_sorting_component.html.erb
@@ -15,7 +15,7 @@
href: update_filter_work_package_activities_path(work_package),
content_arguments: {
data: {
- "turbo-stream": true, "action": "click->work-packages--activities-tab--index#unsetFilter",
+ turbo_stream: true, "action": "click->work-packages--activities-tab--index#unsetFilter",
"test_selector": "op-wp-journals-filter-show-all"
}
},
@@ -26,7 +26,7 @@
href: update_filter_work_package_activities_path(work_package, filter: :only_changes),
content_arguments: {
data: {
- "turbo-stream": true, "action": "click->work-packages--activities-tab--index#setFilterToOnlyChanges",
+ turbo_stream: true, "action": "click->work-packages--activities-tab--index#setFilterToOnlyChanges",
"test_selector": "op-wp-journals-filter-show-only-changes"
}
},
@@ -37,7 +37,7 @@
href: update_filter_work_package_activities_path(work_package, filter: :only_comments),
content_arguments: {
data: {
- "turbo-stream": true, "action": "click->work-packages--activities-tab--index#setFilterToOnlyComments",
+ turbo_stream: true, "action": "click->work-packages--activities-tab--index#setFilterToOnlyComments",
"test_selector": "op-wp-journals-filter-show-only-comments"
}
},
@@ -55,7 +55,7 @@
href: update_sorting_work_package_activities_path(work_package, sorting: :desc, filter:),
form_arguments: { method: :put },
content_arguments: {
- data: { "turbo-stream": true, "test_selector": "op-wp-journals-sorting-desc" }
+ data: { turbo_stream: true, "test_selector": "op-wp-journals-sorting-desc" }
},
active: desc_sorting?
)
@@ -64,7 +64,7 @@
href: update_sorting_work_package_activities_path(work_package, sorting: :asc, filter:),
form_arguments: { method: :put },
content_arguments: {
- data: { "turbo-stream": true, "test_selector": "op-wp-journals-sorting-asc" }
+ data: { turbo_stream: true, "test_selector": "op-wp-journals-sorting-asc" }
},
active: asc_sorting?
)
diff --git a/app/components/work_packages/activities_tab/journals/item_component.html.erb b/app/components/work_packages/activities_tab/journals/item_component.html.erb
index 09f463e2551..f14a0921b40 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component.html.erb
@@ -27,8 +27,8 @@
end
header_container.with_column(flex_layout: true, align_items: :center) do |header_end_container|
if has_unread_notifications?
- header_end_container.with_column(mr: 2, pt: 1, classes: "work-packages-activities-tab-journals-item-component--bubble-container") do
- bubble_html
+ header_end_container.with_column(mr: 2, pt: 1) do
+ render(Primer::Beta::Octicon.new(:"dot-fill", color: :accent, size: :medium))
end
end
header_end_container.with_column do
@@ -46,7 +46,7 @@
"##{journal.version}"
end
end
- header_end_container.with_column(ml: 1) do
+ header_end_container.with_column(ml: 1, classes: "work-packages-activities-tab-journals-item-component--action-menu") do
render(Primer::Alpha::ActionMenu.new(data: { "test_selector": "op-wp-journal-#{journal.id}-action-menu" })) do |menu|
menu.with_show_button(icon: "kebab-horizontal",
'aria-label': I18n.t(:button_actions),
@@ -64,7 +64,12 @@
data: { "test_selector": "op-journal-notes-body" }
) do
unless noop?
- content
+ case state
+ when :show
+ render(WorkPackages::ActivitiesTab::Journals::ItemComponent::Show.new(journal:, filter:))
+ when :edit
+ render(WorkPackages::ActivitiesTab::Journals::ItemComponent::Edit.new(journal:, filter:))
+ end
else
render(Primer::Beta::Text.new(font_style: :italic, color: :subtle, mt: 1)) { I18n.t(:"journals.changes_retracted") }
end
diff --git a/app/components/work_packages/activities_tab/journals/item_component.rb b/app/components/work_packages/activities_tab/journals/item_component.rb
index 15c512a5705..e79ecc2c766 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.rb
+++ b/app/components/work_packages/activities_tab/journals/item_component.rb
@@ -43,15 +43,6 @@ module WorkPackages
@filter = filter
end
- def content
- case state
- when :show
- render(WorkPackages::ActivitiesTab::Journals::ItemComponent::Show.new(**child_component_params))
- when :edit
- render(WorkPackages::ActivitiesTab::Journals::ItemComponent::Edit.new(**child_component_params))
- end
- end
-
private
attr_reader :journal, :state, :filter
@@ -60,10 +51,6 @@ module WorkPackages
journal.id
end
- def child_component_params
- { journal:, filter: }.compact
- end
-
def wrapper_data_attributes
{
controller: "work-packages--activities-tab--item",
@@ -126,7 +113,7 @@ module WorkPackages
menu.with_item(label: t("js.label_edit_comment"),
href: edit_work_package_activity_path(journal.journable, journal, filter:),
content_arguments: {
- data: { "turbo-stream": true, test_selector: "op-wp-journal-#{journal.id}-edit" }
+ data: { turbo_stream: true, test_selector: "op-wp-journal-#{journal.id}-edit" }
}) do |item|
item.with_leading_visual_icon(icon: :pencil)
end
@@ -146,15 +133,6 @@ module WorkPackages
item.with_leading_visual_icon(icon: :quote)
end
end
-
- def bubble_html
- "
- <span
- class=\"comments-number--bubble op-bubble op-bubble_mini\"
- data-test-selector=\"user-activity-bubble\"
- ></span>
- ".html_safe # rubocop:disable Rails/OutputSafety
- end
end
end
end
diff --git a/app/components/work_packages/activities_tab/journals/item_component.sass b/app/components/work_packages/activities_tab/journals/item_component.sass
index 137934f33f5..dcff2c3132a 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.sass
+++ b/app/components/work_packages/activities_tab/journals/item_component.sass
@@ -1,8 +1,5 @@
.work-packages-activities-tab-journals-item-component
- &--bubble-container
- padding-top: 2px
- action-menu
- // TODO: primer style adjustments, needs refactoring
+ &--action-menu
button
padding-top: 3px // for whatever reason, the dots in the action menu are not perfectly aligned in center vertically by default
diff --git a/app/components/work_packages/activities_tab/journals/item_component/details.rb b/app/components/work_packages/activities_tab/journals/item_component/details.rb
index fcfed00b4bf..9227eb0b56a 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/details.rb
+++ b/app/components/work_packages/activities_tab/journals/item_component/details.rb
@@ -126,9 +126,8 @@ module WorkPackages
end
def render_notification_bubble(container)
- container.with_column(mr: 2,
- classes: "work-packages-activities-tab-journals-item-component-details--bubble-container") do
- bubble_html
+ container.with_column(mr: 2) do
+ render(Primer::Beta::Octicon.new(:"dot-fill", color: :accent, size: :medium))
end
end
@@ -199,15 +198,6 @@ module WorkPackages
details_container.with_row(my: 1, font_size: :small, classes: "empty-line")
end
- def bubble_html
- "
- <span
- class=\"comments-number--bubble op-bubble op-bubble_mini\"
- data-test-selector=\"user-activity-bubble\"
- ></span>
- ".html_safe # rubocop:disable Rails/OutputSafety
- end
-
def journal_sorting
User.current.preference&.comments_sorting || "desc"
end
diff --git a/app/components/work_packages/activities_tab/journals/item_component/details.sass b/app/components/work_packages/activities_tab/journals/item_component/details.sass
index 96cead666a7..42119d658f8 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/details.sass
+++ b/app/components/work_packages/activities_tab/journals/item_component/details.sass
@@ -33,6 +33,4 @@
// quick hack to adapt the current detail rendering to desired primerised design
i
font-style: normal
- color: var(--fgColor-muted, var(--color-fg-subtle))
- &--bubble-container
- padding-top: 2px
\ No newline at end of file
+ color: var(--fgColor-muted, var(--color-fg-subtle))
\ No newline at end of file
diff --git a/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb b/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb
index 62ef4c4713b..95cfac1bec8 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb
@@ -19,7 +19,7 @@
size: :medium,
tag: :a,
href: cancel_edit_work_package_activity_path(work_package.id, id: journal.id, filter:),
- data: { "turbo-stream": true }
+ data: { turbo_stream: true }
)) do
t("button_cancel")
end