-
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.
Show available options for WorkPackage::StatusButtonComponent
- Loading branch information
Showing
5 changed files
with
71 additions
and
17 deletions.
There are no files selected for viewing
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
27 changes: 20 additions & 7 deletions
27
app/components/work_packages/status_button_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,11 +1,24 @@ | ||
<%= | ||
render(Primer::Alpha::ActionMenu.new(**@menu_arguments)) do |menu| | ||
menu.with_show_button(**@button_arguments) do |button| | ||
button.with_trailing_action_icon(icon: "triangle-down") | ||
'Placeholder Status' | ||
end | ||
if @editable | ||
render(Primer::Alpha::ActionMenu.new(**@menu_arguments)) do |menu| | ||
menu.with_show_button(**button_arguments) do |button| | ||
button.with_trailing_action_icon(icon: "triangle-down") | ||
button.with_leading_visual_icon(icon: "lock") if readonly? | ||
@status.name | ||
end | ||
|
||
menu.with_item { "OPTION 1"} | ||
menu.with_item { "OPTION 2"} | ||
@items.each do |item| | ||
menu.with_item(label: item.name, | ||
content_arguments: { classes: "__hl_inline_status_#{item.id}", | ||
align_items: :center }) do |menu_item| | ||
menu_item.with_trailing_visual_icon(icon: :lock) if item.is_readonly? | ||
end | ||
end | ||
end | ||
else | ||
render(Primer::Beta::Button.new(**button_arguments)) do |button| | ||
button.with_leading_visual_icon(icon: "lock") if readonly? | ||
@status.name | ||
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
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
17 changes: 17 additions & 0 deletions
17
lookbook/previews/open_project/work_packages/status_button_component_preview.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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module OpenProject::WorkPackages | ||
# @logical_path OpenProject/WorkPackages | ||
class StatusButtonComponentPreview < ViewComponent::Preview | ||
# @display min_height 400px | ||
# @param editable [Boolean] | ||
# @param size [Symbol] select [small, medium, large] | ||
def playground(editable: true, size: :medium) | ||
user = FactoryBot.build_stubbed(:admin) | ||
render(WorkPackages::StatusButtonComponent.new(work_package: WorkPackage.visible.first, | ||
user:, | ||
editable:, | ||
button_arguments: { size: })) | ||
end | ||
end | ||
end |