-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Render work package details in each relation group box
- Loading branch information
1 parent
cca4b76
commit b480a1e
Showing
5 changed files
with
74 additions
and
21 deletions.
There are no files selected for viewing
41 changes: 21 additions & 20 deletions
41
app/components/work_package_relations_tab/index_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
<%= turbo_frame_tag "work-package-relations-tab-content" do %> | ||
<%= flex_layout(classes: "work-package-relations-tab--list-container") do |flex| %> | ||
<% @relations.group_by(&:relation_type).each do |relation_type, relations| %> | ||
<%= flex.with_row do %> | ||
<%= render(border_box_container(padding: :condensed)) do |border_box| | ||
border_box.with_header do | ||
flex_layout do |flex| | ||
<%= | ||
blah_blah = "Blah blah" | ||
flex_layout(classes: "work-package-relations-tab--list-container") do |flex| | ||
relations.group_by(&:relation_type).each do |relation_type, relations_of_type| | ||
flex.with_row do | ||
render(border_box_container(padding: :condensed)) do |border_box| | ||
border_box.with_header(py: 3) do | ||
flex_layout(align_items: :center) do |flex| | ||
flex.with_column(mr: 2) do | ||
render(Primer::Beta::Text.new(font_size: :normal, color: :muted)) do | ||
t(relations.first.label_for(@work_package)).capitalize | ||
render(Primer::Beta::Text.new(font_size: :normal, font_weight: :bold)) do | ||
t(relations_of_type.first.label_for(work_package)).capitalize | ||
end | ||
end | ||
flex.with_column do | ||
render(Primer::Beta::Counter.new(count: relations.size, | ||
round: true, | ||
scheme: :primary)) | ||
render(Primer::Beta::Counter.new(count: relations_of_type.size, | ||
round: true, | ||
scheme: :primary)) | ||
end | ||
end | ||
end | ||
relations.each do |relation| | ||
border_box.with_row do | ||
render(Primer::Beta::Text.new(font_size: :normal, color: :muted)) do | ||
relation.to.subject.to_s | ||
end | ||
relations_of_type.each do |relation| | ||
border_box.with_row(style: "padding-top: 12px; padding-bottom: 12px;") do | ||
render(WorkPackageRelationsTab::RelationComponent.new(work_package: relation.to)) | ||
end | ||
end | ||
end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
end | ||
end | ||
end | ||
end | ||
%> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/components/work_package_relations_tab/relation_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<%= flex_layout(direction: :column, style: "gap: 0.25rem;") do |flex| | ||
flex.with_row(flex_layout: true, | ||
justify_content: :flex_start, | ||
style: "gap: 0.5rem;") do |meta_information_row| | ||
meta_information_row.with_column do | ||
render(Primer::Beta::Text.new(font_size: :small, | ||
font_weight: :bold, | ||
color: :muted)) { "#{work_package.type.name.upcase}" } | ||
end | ||
|
||
meta_information_row.with_column do | ||
render(Primer::Beta::Text.new(font_size: :small, | ||
color: :muted)) { "##{work_package.id}" } | ||
end | ||
meta_information_row.with_column do | ||
render(Primer::Beta::Label.new(font_weight: :bold)) { work_package.status.name } | ||
end | ||
end | ||
|
||
flex.with_row(flex_layout: true, justify_content: :flex_start) do |subject_line_row| | ||
subject_line_row.with_column do | ||
render(Primer::Beta::Link.new(href: work_package_path(work_package), | ||
color: :default, | ||
underline: false, | ||
font_size: :normal, | ||
font_weight: :bold, | ||
target: "_blank")) { work_package.subject } | ||
end | ||
end | ||
|
||
flex.with_row(flex_layout: true, justify_content: :flex_start) do |description_row| | ||
description_row.with_column do | ||
render(Primer::Beta::Text.new(font_size: :small, | ||
color: :muted)) do | ||
format_text(work_package, :description) | ||
end | ||
end | ||
end | ||
end %> |
12 changes: 12 additions & 0 deletions
12
app/components/work_package_relations_tab/relation_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class WorkPackageRelationsTab::RelationComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpPrimer::ComponentHelpers | ||
|
||
attr_reader :work_package | ||
|
||
def initialize(work_package:) | ||
super() | ||
|
||
@work_package = work_package | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters