Skip to content

Commit

Permalink
Grant license notification dialogue (#1808)
Browse files Browse the repository at this point in the history
* Add dialogue box for grant license page

Co-authored-by: Beck Davis <[email protected]>
Co-authored-by: Hector Correa <[email protected]>
Co-authored-by: Sean Warren <[email protected]>

* remove extra POST method

* Adds step for the user to accept dialogue

---------

Co-authored-by: Beck Davis <[email protected]>
Co-authored-by: Hector Correa <[email protected]>
Co-authored-by: Sean Warren <[email protected]>
  • Loading branch information
4 people authored May 10, 2024
1 parent 0fe77f8 commit f2b37ab
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/views/works_wizard/review.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@
<textarea id="submission_notes" name="submission_notes" cols="80", rows="10"
placeholder="(optional) Type here to leave a message for the curators"><%= @work.submission_notes %></textarea>
<div class="actions">
<%= submit_tag "Grant License and Complete", class: "btn btn-primary wizard-next-button" %>
<%= submit_tag "Grant License and Complete", class: "btn btn-primary wizard-next-button", id: "grant-button" %>
<%= form.button 'Save', type: 'submit', name: 'save_only', value: 'true', class: "btn btn-save wizard-next-button" %>
<%= link_to "Previous", file_location_url , class: "btn btn-previous wizard-next-button" %>
<%= link_to "Cancel", user_path(current_user), class: "btn btn-secondary" %>
</div>
<% end %>
</div>

<script>
$("#grant-button").on("click", (event) => {
var message = "You're about to grant license for this dataset. Are you sure?";
var input = confirm(message);
if(input == false){
event.preventDefault();
}
});
</script>
1 change: 1 addition & 0 deletions spec/system/authz_super_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
click_on "Next"
click_on "Next"
click_on "Complete"
page.driver.browser.switch_to.alert.accept

expect(page).to have_content "awaiting_approval"
work = Work.last
Expand Down
1 change: 1 addition & 0 deletions spec/system/external_ids_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
click_on "Next"
click_on "Next"
click_on "Complete"
page.driver.browser.switch_to.alert.accept

expect(page).to have_content "awaiting_approval"
expect(Ezid::Identifier).not_to have_received(:mint)
Expand Down
1 change: 1 addition & 0 deletions spec/system/pppl_work_create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
click_on "Next"
expect(page).to have_content("In furtherance of its non-profit educational mission, Princeton University")
click_on "Complete"
page.driver.browser.switch_to.alert.accept

expect(page).to have_content "awaiting_approval"
end
Expand Down
1 change: 1 addition & 0 deletions spec/system/work_create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
click_on "Next"
expect(page).to have_content("In furtherance of its non-profit educational mission, Princeton University")
click_on "Complete"
page.driver.browser.switch_to.alert.accept

work.reload
expect(work.awaiting_approval?).to be true
Expand Down
20 changes: 20 additions & 0 deletions spec/system/work_wizard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,30 @@
expect(page).to have_css(validate_form_css)
expect(page).to have_content("this is not on the page")
click_on "Grant License and Complete"
page.driver.browser.switch_to.alert.accept
expect(page).to have_content("Welcome")
expect(page).to have_content(work.title)
end

context "User submits their work" do
it "displays confirm dialogue when user grants license", js: true do
sign_in user
work = FactoryBot.create :draft_work
visit work_review_path(work)
click_on "Grant License and Complete"
page.driver.browser.switch_to.alert.accept
expect(page).to have_content("Welcome")
end
it "remains on the same page if cancel is clicked", js: true do
sign_in user
work = FactoryBot.create :draft_work
visit work_review_path(work)
click_on "Grant License and Complete"
page.driver.browser.switch_to.alert.dismiss
expect(page).to have_content("New Submission")
end
end

context "file is in another location" do
it "allows me to stay on each page and then move forward" do
sign_in user
Expand Down

0 comments on commit f2b37ab

Please sign in to comment.