-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
28 changed files
with
523 additions
and
22 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
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
10 changes: 10 additions & 0 deletions
10
app/components/dashboard/show/pending_review_list_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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<%= render Elements::Tables::TableComponent.new( | ||
id:, label: 'Drafts', show_label: false | ||
) do |component| %> | ||
<% component.with_header( | ||
headers: ['Deposit', 'Collection', 'Owner', 'Last modified'] | ||
) %> | ||
<% works.each do |work| %> | ||
<% component.with_row(values: values_for(work), id: id_for(work)) %> | ||
<% end %> | ||
<% end %> |
40 changes: 40 additions & 0 deletions
40
app/components/dashboard/show/pending_review_list_component.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,40 @@ | ||
# frozen_string_literal: true | ||
|
||
module Dashboard | ||
module Show | ||
# Component for rendering a table on the work show page with works pending review. | ||
class PendingReviewListComponent < ApplicationComponent | ||
def initialize(works:) | ||
@works = works | ||
super() | ||
end | ||
|
||
attr_reader :works | ||
|
||
def id | ||
'pending-review-table' | ||
end | ||
|
||
def id_for(work) | ||
dom_id(work, id) | ||
end | ||
|
||
def values_for(work) | ||
[ | ||
link_to(work.title, link_for(work)), | ||
link_to(work.collection.title, collection_path(druid: work.collection.druid)), | ||
work.user.name, | ||
I18n.l(work.updated_at, format: '%b %d, %Y') | ||
] | ||
end | ||
|
||
private | ||
|
||
def link_for(work) | ||
return wait_works_path(work) unless work.druid | ||
|
||
work_path(druid: work.druid) | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<%= render Elements::AlertComponent.new do %> | ||
<div class="h3">Review all details below then approve or reject this deposit.</div> | ||
<%= form_with model: review_form, url: review_work_path, method: :put do |form| %> | ||
<div class="form-check mb-3"> | ||
<%= form.radio_button :review_option, 'approve', class: 'form-check-input' %> | ||
<%= form.label :review_option_approve, 'Approve', class: 'form-check-label' %> | ||
</div> | ||
<div class="form-check mb-3"> | ||
<%= form.radio_button :review_option, 'reject', class: 'form-check-input' %> | ||
<%= form.label :review_option_reject, 'Reject', class: 'form-check-label' %> | ||
<%= render Elements::Forms::TextareaFieldComponent.new(form:, field_name: :reject_reason, label: 'Reason for rejecting') %> | ||
</div> | ||
|
||
<%= render Elements::Forms::SubmitComponent.new(label: 'Submit') %> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module Works | ||
module Show | ||
# Component providing a form for submitting a review. | ||
class ReviewComponent < ApplicationComponent | ||
def initialize(work:, review_form:) | ||
@work = work | ||
@review_form = review_form | ||
super() | ||
end | ||
|
||
attr_reader :review_form | ||
|
||
def render? | ||
@work.pending_review? && helpers.allowed_to?(:review?, @work) | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<%= render Elements::AlertComponent.new(variant: :warning) do %> | ||
<div class="h3">Reviewer has rejected your deposit.</div> | ||
<p>Fix the following and then submit again for approval:</p> | ||
<blockquote class="blockquote"> | ||
<p><%= review_rejected_reason %></p> | ||
</blockquote> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Works | ||
module Show | ||
# Component for rendering an alert for a rejected review. | ||
class ReviewRejectedComponent < ApplicationComponent | ||
def initialize(work:) | ||
@work = work | ||
super() | ||
end | ||
|
||
delegate :review_rejected_reason, to: :@work | ||
|
||
def render? | ||
@work.rejected_review? | ||
end | ||
end | ||
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
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,10 @@ | ||
# frozen_string_literal: true | ||
|
||
# Form object for reviewing a work. | ||
class ReviewForm < ApplicationForm | ||
attribute :review_option, :string, default: 'approve' | ||
validates :review_option, inclusion: { in: %w[approve reject] } | ||
|
||
attribute :reject_reason, :string | ||
validates :reject_reason, presence: true, if: -> { review_option == 'reject' } | ||
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
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
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
Oops, something went wrong.