-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
102 additions
and
5 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
20 changes: 20 additions & 0 deletions
20
app/controllers/works_wizard_submission_complete_controller.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,20 @@ | ||
# frozen_string_literal: true | ||
|
||
require "nokogiri" | ||
require "open-uri" | ||
|
||
# Controller to handle the completion of a submission | ||
# | ||
# The wizard flow is shown in the [mermaid diagram here](https://github.com/pulibrary/pdc_describe/blob/main/docs/wizard_flow.md). | ||
# | ||
class WorksWizardSubmissionCompleteController < ApplicationController | ||
# get /works/policy | ||
def show | ||
@work = Work.find(params[:id]) | ||
@email = if @work.group == Group.plasma_laboratory | ||
"[email protected]" | ||
else | ||
"[email protected]" | ||
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,14 @@ | ||
<div class="wizard-area"> | ||
|
||
<h1>Submission complete</h1> | ||
<%= render "works_wizard/wizard_progress", wizard_step: 5 %> | ||
|
||
<p> Thank you for your submission. You should hear back from a curator within 5-10 business days. Your submission is not available to edit while the curators are reviewing it. | ||
Please contact <%= mail_to(@email) %> for assistance if you have any question. | ||
</p> | ||
|
||
<div class="actions"> | ||
<%= link_to "My Dashboard", user_path(current_user), class: "btn btn-primary" %> | ||
</div> | ||
|
||
</div> |
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
45 changes: 45 additions & 0 deletions
45
spec/controllers/works_wizard_submission_complete_controller_spec.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,45 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe WorksWizardSubmissionCompleteController do | ||
include ActiveJob::TestHelper | ||
|
||
let(:user) { FactoryBot.create :princeton_submitter } | ||
let(:work) { FactoryBot.create :draft_work, created_by_user_id: user.id } | ||
|
||
context "valid user login" do | ||
before do | ||
sign_in user | ||
end | ||
|
||
describe "#show" do | ||
it "show the user the work completion" do | ||
get(:show, params: { id: work.id }) | ||
expect(response.status).to be 200 | ||
expect(response).to render_template(:show) | ||
expect(assigns(:email)).to eq("[email protected]") | ||
end | ||
|
||
context "a pppl work" do | ||
let(:work) { FactoryBot.create :pppl_work } | ||
|
||
it "show the user the work completion with the pppl email" do | ||
get(:show, params: { id: work.id }) | ||
expect(response.status).to be 200 | ||
expect(response).to render_template(:show) | ||
expect(assigns(:email)).to eq("[email protected]") | ||
end | ||
end | ||
end | ||
end | ||
|
||
context "invalid user" do | ||
describe "#show" do | ||
it "redirects the user" do | ||
get(:show, params: { id: work.id }) | ||
expect(response.status).to be 302 | ||
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
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