-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Add Action Bar to relations section
* Adds relation action bar * Adds blankslate
- Loading branch information
1 parent
b480a1e
commit a36a4ae
Showing
3 changed files
with
63 additions
and
25 deletions.
There are no files selected for viewing
69 changes: 50 additions & 19 deletions
69
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,32 +1,63 @@ | ||
<%= turbo_frame_tag "work-package-relations-tab-content" do %> | ||
<%= | ||
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, font_weight: :bold)) do | ||
t(relations_of_type.first.label_for(work_package)).capitalize | ||
flex_layout do |action_bar| | ||
action_bar.with_column do | ||
render(Primer::Beta::Text.new(color: :muted)) do | ||
"Add relations to other work packages to create a link between them." | ||
end | ||
end | ||
action_bar.with_column do | ||
render(Primer::Alpha::ActionMenu.new(menu_id: "relations-list-action-menu")) do |menu| | ||
menu.with_show_button do |button| | ||
button.with_leading_visual_icon(icon: :"plus") | ||
|
||
button.with_trailing_action_icon(icon: :"triangle-down") | ||
"Relation" | ||
end | ||
Relation::TYPES.values.each do |type_configuration_hash| | ||
menu.with_item(label: t(type_configuration_hash[:name]).capitalize) do |item| | ||
item.with_description.with_content("blugh") | ||
end | ||
end | ||
end | ||
end | ||
end | ||
%> | ||
<%= | ||
if relations.any? | ||
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, 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_of_type.size, | ||
round: true, | ||
scheme: :primary)) | ||
end | ||
end | ||
flex.with_column do | ||
render(Primer::Beta::Counter.new(count: relations_of_type.size, | ||
round: true, | ||
scheme: :primary)) | ||
end | ||
end | ||
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)) | ||
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 | ||
else | ||
render Primer::Beta::Blankslate.new(border: true) do |component| | ||
component.with_visual_icon(icon: "package-dependents") | ||
component.with_heading(tag: :h2).with_content("No relations") | ||
component.with_description { "This work package does not yet have any relations." } | ||
end | ||
end | ||
%> | ||
<% end %> |
2 changes: 2 additions & 0 deletions
2
app/components/work_package_relations_tab/index_component.sass
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,3 +1,5 @@ | ||
.work-package-relations-tab | ||
&--list-container | ||
gap: 1.5rem | ||
#relations-list-action-menu-list | ||
max-height: 300px |
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