Workflow display styling
This commit is contained in:
@@ -28,4 +28,10 @@
|
|||||||
.task-show-info {
|
.task-show-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row nowrap;
|
flex-flow: row nowrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5em;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
.workflow {
|
||||||
|
--bg-color: #D1D5DB; /* Pico zinc 150 */
|
||||||
|
--text-color: oklch(from var(--bg-color) calc(0.55 * l) calc(0.55 * c) h);
|
||||||
|
|
||||||
|
border-radius: 1em;
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
color: var(--text-color);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row nowrap;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 2em;
|
||||||
|
padding: 0.1em 0.5em;
|
||||||
|
gap: 0.5em;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
> img {
|
||||||
|
max-width: unset;
|
||||||
|
width: 1lh;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.red {
|
||||||
|
--bg-color: #F06048; /* Pico red 400 */
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
|
||||||
|
module WorkflowsHelper
|
||||||
|
def workflow_display(workflow, **)
|
||||||
|
render Workflows::DisplayViewModel.new(workflow, **)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Workflows
|
||||||
|
class DisplayViewModel
|
||||||
|
DEFAULT_ICON = 'task_line'
|
||||||
|
ICONS = {
|
||||||
|
warning: 'warning_line'
|
||||||
|
}.freeze
|
||||||
|
|
||||||
|
def initialize(workflow, full: false)
|
||||||
|
@workflow = workflow
|
||||||
|
@full = full
|
||||||
|
end
|
||||||
|
|
||||||
|
def icon
|
||||||
|
icon = ICONS.fetch(@workflow.icon.to_sym, DEFAULT_ICON)
|
||||||
|
|
||||||
|
"mingcute/#{icon}.svg"
|
||||||
|
end
|
||||||
|
|
||||||
|
def render_in(view_context)
|
||||||
|
view_context.render(
|
||||||
|
partial: 'workflows/display',
|
||||||
|
locals: @workflow.attributes.symbolize_keys.merge(icon:, full: @full)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
- cache task do
|
- cache task do
|
||||||
tr id="task_#{task.id}"
|
tr id="task_#{task.id}"
|
||||||
td
|
td= workflow_display task.workflow
|
||||||
/ TODO: extract into a presenter (and especially add color)
|
|
||||||
- wf_icon = 'task_line'
|
|
||||||
- if task.workflow.icon == 'warning'
|
|
||||||
- wf_icon = 'warning_line'
|
|
||||||
= image_tag("mingcute/#{wf_icon}.svg", title: task.workflow.name)
|
|
||||||
td= link_to task.full_number, task_path(task)
|
td= link_to task.full_number, task_path(task)
|
||||||
td
|
td
|
||||||
= task_status_selector task, with_form: true
|
= task_status_selector task, with_form: true
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ div
|
|||||||
h1= @task.title
|
h1= @task.title
|
||||||
|
|
||||||
section.task-show-info
|
section.task-show-info
|
||||||
|
= workflow_display @task.workflow, full: true
|
||||||
= task_status_selector @task, with_form: true
|
= task_status_selector @task, with_form: true
|
||||||
= turbo_stream_from @task, :status, :with_form
|
= turbo_stream_from @task, :status, :with_form
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
div.workflow class=color title=name
|
||||||
|
= image_tag(icon)
|
||||||
|
- if full
|
||||||
|
span= name
|
||||||
Reference in New Issue
Block a user