Skip to content

Commit

Permalink
show workflow name on modal (#4724)
Browse files Browse the repository at this point in the history
* show workflow name on modal

* update test

* fix styling
  • Loading branch information
peetucket authored Feb 15, 2025
1 parent 8abd69b commit e278534
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/controllers/workflows_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def build_show_presenter(workflow)
status = WorkflowStatus.new(workflow:,
workflow_steps: workflow_processes(params[:id]))
WorkflowPresenter.new(view: view_context,
workflow_name: params[:id],
workflow_status: status,
cocina_object: Repository.find(params[:item_id]))
end
Expand Down
5 changes: 3 additions & 2 deletions app/presenters/workflow_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ class WorkflowPresenter
# @param [Object] view the rails view context
# @param [WorkflowStatus] workflow_status
# @param [Cocina::Models::DRO,Cocina::Models::Collection] cocina_object the repository object that the workflow is about
def initialize(view:, workflow_status:, cocina_object:)
def initialize(view:, workflow_status:, cocina_object:, workflow_name:)
@view = view
@workflow_status = workflow_status
@cocina_object = cocina_object
@workflow_name = workflow_name
end

delegate :druid, :workflow_name, :workflow_context, to: :workflow_status
Expand All @@ -17,7 +18,7 @@ def processes
workflow_status.process_statuses
end

attr_reader :cocina_object
attr_reader :cocina_object, :workflow_name

private

Expand Down
2 changes: 1 addition & 1 deletion app/views/workflows/_show.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<span class="section-head-link">
<div class="h4"><%= @presenter.workflow_name %> - <%= @presenter.druid %></div>
View:
<%= link_to 'XML', item_workflow_path(item_id: @presenter.druid, id: @presenter.workflow_name, raw: 'true'),
title: @presenter.workflow_name,
data: { blacklight_modal: 'trigger' } %>
</span>
<%= @presenter.druid %>

<table class="detail table">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion spec/presenters/workflow_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RSpec.describe WorkflowPresenter do
subject(:presenter) do
described_class.new(view: stub_view, workflow_status:, cocina_object: item)
described_class.new(view: stub_view, workflow_status:, cocina_object: item, workflow_name:)
end

let(:stub_view) { double('view') }
Expand Down

0 comments on commit e278534

Please sign in to comment.