Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[89] Submission Detail View for Evaluators #378

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.sass.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ dialog::backdrop {
.usa-combo-box .border-secondary + input {
border: 1px solid red;
}

.icon-primary-blue {
filter: brightness(0) saturate(100%) invert(19%) sepia(28%) saturate(2849%) hue-rotate(197deg) brightness(94%) contrast(87%);
}
5 changes: 5 additions & 0 deletions app/controllers/evaluations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class EvaluationsController < ApplicationController
before_action -> { authorize_user('evaluator') }
before_action :set_evaluation_and_submission_assignment, only: %i[save_draft mark_complete]
before_action :set_phase, only: [:submissions]
before_action :set_submission, only: [:show]

def index
@phases = Phase.joins(:evaluator_submission_assignments).
Expand Down Expand Up @@ -98,6 +99,10 @@ def set_phase
@challenge = @phase.challenge
end

def set_submission
@submission = Submission.by_user(current_user).find(params[:submission_id])
end

def find_or_initialize_evaluation
if params[:id]
Evaluation.includes([:evaluation_criteria]).find(params[:id])
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class SubmissionsController < ApplicationController
before_action -> { authorize_user('challenge_manager') }
before_action :set_submission, only: [:show, :update]
before_action :set_phase, only: [:show]

def show; end

Expand All @@ -28,6 +29,10 @@ def set_submission
@submission = Submission.by_user(current_user).find(params[:id])
end

def set_phase
@phase = @submission.phase
end

def handle_successful_update(format)
format.html do
flash[:success] = I18n.t("submission_updated")
Expand Down
7 changes: 5 additions & 2 deletions app/views/evaluations/_submissions_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@
</td>
<td>
<div class="display-flex flex-no-wrap grid-row grid-gap-1">
<button class="usa-button font-body-2xs width-full text-no-wrap">
<% unless assignment.recused? %>
<%= link_to submission_evaluation_path(assignment.submission),
class: "usa-button font-body-2xs width-full text-no-wrap" do %>
Evaluate
</button>
<% end %>
<% end %>
</div>
</td>
</tr>
Expand Down
21 changes: 21 additions & 0 deletions app/views/evaluations/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<%= render 'shared/back_link', path: submissions_evaluation_path %>

<h1>Submission ID <%= @submission.id %></h1>
<h2 class="font-body-sm text-normal">View submission materials and provide your scores to evaluate the submission.</h2>

<% if params[:submission_materials_only] %>
<div class="padding-top-2 padding-bottom-4">
<%= render partial: 'submissions/submission_materials' %>
</div>
<% else %>
<%= render partial: "layouts/hotdog", locals: {
left: 'evaluations/form',
right: 'submissions/submission_materials',
name: 'Submission Materials',
evaluation_form_locals: {
form_method: :post,
draft_action: save_draft_evaluations_path,
complete_action: mark_complete_evaluations_path
}
} %>
<% end %>
22 changes: 16 additions & 6 deletions app/views/layouts/_hotdog.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,30 @@
<%= render partial: right %>
</div>
<div class="bg-primary-darker margin-y-1 width-full cursor-pointer padding-1" data-action="click->hotdog#burgerCollapse" data-hotdog-target="burgerCollapse">
<%= image_tag('images/usa-icons/arrow_upward.svg', class: "usa-icon--size-3 icon-white margin-bottom-05", alt: "Hide #{name}") %>
<span class="text-white width-15 display-inline-block">Hide <%= name %></span>
<div class="display-flex">
<div class="display-flex flex-align-center">
<%= image_tag('images/usa-icons/arrow_upward.svg', class: "usa-icon--size-3 icon-white margin-bottom-05 margin-right-1", alt: "Hide #{name}") %>
<span class="text-white width-15 display-inline-block">Hide <%= name %></span>
</div>
<%= render 'submissions/open_in_new_tab' %>
</div>
</div>
<div class="bg-primary-darker margin-y-1 width-full cursor-pointer display-none padding-1" data-action="click->hotdog#burgerExpand" data-hotdog-target="burgerExpand">
<%= image_tag('images/usa-icons/arrow_downward.svg', class: "usa-icon--size-3 icon-white margin-bottom-05", alt: "Show #{name}") %>
<span class="text-white width-15 display-inline-block">Show <%= name %></span>
<div class="display-flex">
<div class="display-flex flex-align-center">
<%= image_tag('images/usa-icons/arrow_downward.svg', class: "usa-icon--size-3 icon-white margin-bottom-05 margin-right-1", alt: "Show #{name}") %>
<span class="text-white width-15 display-inline-block">Show <%= name %></span>
</div>
<%= render 'submissions/open_in_new_tab' %>
</div>
</div>
<%= render partial: left %>
<%= render partial: left, locals: local_assigns[:evaluation_form_locals] %>
</div>

<%# hotdog orientation, for tablet and above %>
<div class="display-none tablet:display-flex flex-row width-full border-top-1px" data-controller="hotdog">
<div class="width-half" data-hotdog-target="leftPane">
<%= render partial: left %>
<%= render partial: left, locals: local_assigns[:evaluation_form_locals] %>
</div>
<div class="bg-primary-darker margin-x-5 width-3 cursor-pointer" data-action="click->hotdog#hotdogCollapse" data-hotdog-target="hotdogCollapse">
<%= image_tag('images/usa-icons/arrow_forward.svg', class: "usa-icon--size-3 icon-white", alt: "Hide #{name}") %>
Expand Down
23 changes: 23 additions & 0 deletions app/views/submissions/_open_in_new_tab.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div class="display-flex flex-justify-end desktop:margin-bottom-2 padding-left-5">
<% path = current_user.role == 'evaluator' ?
submission_evaluation_path(@submission, submission_materials_only: true) :
submission_path(@submission, submission_materials_only: true) %>

<%= link_to path,
class: "text-primary display-flex flex-align-center margin-top-2 margin-bottom-2 text-no-underline",
target: "_blank",
rel: "noopener" do %>
<%= image_tag(
"images/usa-icons/launch.svg",
class: "usa-icon margin-right-05 icon-primary-blue tablet:display-block display-none",
alt: "Open submission information in new window"
)%>
<%= image_tag(
"images/usa-icons-bg/launch--white.svg",
class: "usa-icon usa-icon--size-3 margin-left-neg-1 tablet:display-none display-block",
alt: "Open submission information in new window"
)%>
<span class="tablet:display-block display-none text-underline">Open in New Tab</span>
<span class="tablet:display-none display-block text-white text-right width-card display-inline-block">Open Submission Materials in New Tab</span>
<% end %>
</div>
4 changes: 4 additions & 0 deletions app/views/submissions/_submission_materials.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<div class="desktop:display-block tablet:display-block display-none">
<%= render partial: 'submissions/open_in_new_tab' unless params[:submission_materials_only] %>
</div>

<h3>Brief Description:</h3>
<p class="text-normal"><%= @submission.brief_description %></p>

Expand Down
10 changes: 9 additions & 1 deletion app/views/submissions/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<%= render 'shared/back_link', path: submissions_phase_path(@phase) %>

<h1>Submission ID <%= @submission.id %></h1>
<h2 class="font-body-sm text-normal">View submission information and assign evaluators to evaluate the submission.</h2>

<%= render partial: "layouts/hotdog", locals: {left: 'submissions/submission_details', right: 'submissions/submission_materials', name: 'Submission Materials'} %>
<% if params[:submission_materials_only] %>
<div class="padding-top-2 padding-bottom-4">
<%= render partial: 'submissions/submission_materials' %>
</div>
<% else %>
<%= render partial: "layouts/hotdog", locals: {left: 'submissions/submission_details', right: 'submissions/submission_materials', name: 'Submission Materials'} %>
<% end %>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
resources :evaluator_submission_assignments, only: [:index, :update, :create]
end
resources :submissions, only: [:index, :show, :update] do
resources :evaluations, only: [:new]
resources :evaluations, only: [:new, :show]
end

# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
Expand Down