Skip to content
Snippets Groups Projects
Commit 7c787fc8 authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

Merge branch 'bug_fix/270-list-works-in-under-review-tab' into 'develop'

Fixed under review tab to show works

Closes FDM/rdm-system/antleaf-projectmanagement#270

See merge request !280
parents 055a093c f95d0c50
Branches
Tags
1 merge request!280Fixed under review tab to show works
Pipeline #13307 canceled
......@@ -17,9 +17,9 @@ module Hyrax
add_breadcrumb t(:'hyrax.admin.sidebar.workflow_review'), request.path
@status_list = actionable_objects.reject(&:published?).select{|object| under_review?(object.workflow_state) }
@published_list = ActiveFedora::Base.where(workflow_state_name_ssim: 'published')
@archived_list = ActiveFedora::Base.where(workflow_state_name_ssim: 'archived')
@tombstoned_list = ActiveFedora::Base.where(is_tombstoned_ssim: 'true')
@published_list = actionable_objects.select(&:published?)
@archived_list = Hyrax::SolrQueryService.new(query: ["workflow_state_name_ssim:archived"]).accessible_by(ability: current_ability).solr_documents
@tombstoned_list = Hyrax::SolrQueryService.new(query: ["is_tombstoned_ssim:true"]).accessible_by(ability: current_ability).solr_documents
end
private
......
<% documents.each do |document| %>
<tr>
<td>
<%= link_to document, [main_app, document] %>
</td>
<td>
<%= safe_join(document.creator, tag(:br)) %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending"><%= document.workflow_state %></span>
</td>
</tr>
<% end %>
\ No newline at end of file
......@@ -34,22 +34,7 @@
</tr>
</thead>
<tbody>
<% @status_list.each do |document| %>
<tr>
<td>
<%= link_to document, [main_app, document] %>
</td>
<td>
<%= safe_join(document.creator, tag(:br)) %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending"><%= document.workflow_state %></span>
</td>
</tr>
<% end %>
<%= render 'list', documents: @status_list %>
</tbody>
</table>
</div>
......@@ -70,22 +55,7 @@
</tr>
</thead>
<tbody>
<% @published_list.each do |document| %>
<tr>
<td>
<%= link_to document, [main_app, document] %>
</td>
<td>
<%= safe_join(document.creator.to_a, tag(:br)) %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending">Published</span>
</td>
</tr>
<% end %>
<%= render 'list', documents: @published_list %>
</tbody>
</table>
</div>
......@@ -106,22 +76,7 @@
</tr>
</thead>
<tbody>
<% @archived_list.each do |document| %>
<tr>
<td>
<%= link_to document.title[0], main_app.polymorphic_path(document) %>
</td>
<td>
<%= safe_join(document.creator.to_a, tag(:br)) %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending">Archived</span>
</td>
</tr>
<% end %>
<%= render 'list', documents: @archived_list %>
</tbody>
</table>
</div>
......@@ -142,22 +97,7 @@
</tr>
</thead>
<tbody>
<% @tombstoned_list.each do |document| %>
<tr>
<td>
<%= link_to document.title[0], main_app.polymorphic_path(document) %>
</td>
<td>
<%= safe_join(document.creator.to_a, tag(:br)) %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending">Tombstoned</span>
</td>
</tr>
<% end %>
<%= render 'list', documents: @tombstoned_list %>
</tbody>
</table>
</div>
......
Rails.configuration.to_prepare do
Hyrax::Workflow::ActionableObjects.class_eval do
def each
return enum_for(:each) unless block_given?
ids_and_states = id_state_pairs
return if ids_and_states.none?
docs = Hyrax::SolrQueryService.new.with_ids(ids: ids_and_states.map(&:first)).solr_documents({rows: 5000})
docs.each do |solr_doc|
object = Hyrax::Workflow::ObjectInWorkflowDecorator.new(solr_doc)
_, state = ids_and_states.find { |id, _| id == object.id }
object.workflow_state = state
yield object
end
end
end
end
\ No newline at end of file
Rails.configuration.to_prepare do
Hyrax::Workflow::SolrQueryService.class_eval do
def get(**args)
solr_service.get(build, **args)
end
def solr_documents(**args)
get(**args)['response']['docs'].map { |doc| self.class.document_model.new(doc) }
end
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment