-
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.
general graduate scholarship despoit item
- Loading branch information
1 parent
c59739f
commit 25710bb
Showing
11 changed files
with
114 additions
and
13 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
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,32 @@ | ||
# frozen_string_literal: true | ||
class GradScholarship < Contribution | ||
self.attributes += [:department] | ||
self.ignore_attributes += [:department] | ||
attr_accessor :department | ||
validates :department, presence: true | ||
|
||
self.attributes += [:advisor] | ||
self.ignore_attributes += [:advisor] | ||
attr_accessor :advisor | ||
validates :advisor, presence: true | ||
|
||
protected | ||
|
||
def copy_attributes | ||
super | ||
@tufts_pdf.subject = [department] | ||
@tufts_pdf.creator_department = [creator_dept] | ||
end | ||
|
||
private | ||
|
||
# TODO: copied from Honors Thesis, problally needs work in both places | ||
def creator_dept | ||
terms = Qa::Authorities::Local.subauthority_for('departments').all | ||
if department == terms.find { |t| t[:label] == department } | ||
term[:id] | ||
else | ||
'NEEDS FIXING' | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
app/views/contribute/deposit_view/_grad_scholarship.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,22 @@ | ||
<%# NOTE: this form uses bootstrap_form_for and bootstrap_forms helpers - see: https://github.com/sethvargo/bootstrap_forms %> | ||
<%= f.text_field :title, label: 'Title', required: true %> | ||
<%= f.text_field :creator, label: 'Creator', value: @contribution.creator, required: true, readonly: 'readonly' %> | ||
<% if params['contribution'] && params['contribution']['contributor'] %> | ||
<%= react_component('ContributeOtherAuthors', {contributor: params['contribution']['contributor']}, {camelize_props: true}) %> | ||
<% else %> | ||
<%= react_component('ContributeOtherAuthors', {contributor: []}, {camelize_props: true}) %> | ||
<% end %> | ||
<%= f.text_field :department, label: 'Department', 'data-autocomplete': '/authorities/search/local/departments' %> | ||
<script> | ||
Tufts.autocomplete() | ||
</script> | ||
|
||
<%= f.text_field :advisor, label: 'Advisor' %> | ||
<%= f.select :embargo, standard_embargos, label: 'Embargo', help: 'An embargo will restrict all access to your work until the selected time has passed' %> | ||
<%= f.text_area :abstract, label: 'Short Description', rows: 5, class: 'col-sm-8' %> |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
display_name,deposit_view,license_name,deposit_agreement | ||
Faculty Scholarship,faculty_scholarship,Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
Fletcher School Capstone Project,capstone_project,Tufts Non-Exclusive Deposit License: Fletcher v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
GIS Expo Student Winners,gis_poster,Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>. | ||
" | ||
GIS Expo Student Winners,gis_poster,Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
General Undergraduate Scholarship,generic_tisch_deposit,Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
Graduate School of Arts and Sciences Education Qualifying Papers,qualifying_paper,Tufts Non-Exclusive Deposit License: Graduate Arts & Science v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
Masters in Animal and Public Policy,cummings_thesis,Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
PHPD Field Experience/Capstone,public_health,Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
Tisch Library Undergraduate Research Award,generic_deposit,Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
Undergraduate Honors Thesis,honors_thesis,Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
Undergraduate Summer Scholars,undergrad_summer_scholar, Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." | ||
General Graduate Scholarship,grad_scholarship,Tufts Non-Exclusive Deposit License v1.0,"I understand and acknowledge that this submission is governed by the <a href=""/contribute/license"" rel=""nofollow"">Tufts Non-Exclusive Deposit License</a>." |
47 changes: 47 additions & 0 deletions
47
spec/features/contribute/general_grad_scholarship_contribute_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,47 @@ | ||
# frozen_string_literal: true | ||
require 'rails_helper' | ||
require 'ffaker' | ||
require 'import_export/deposit_type_importer.rb' | ||
include Warden::Test::Helpers | ||
|
||
# NOTE: If you generated more than one work, you have to set "js: true" | ||
RSpec.feature 'General Graduate Scholarship', :clean, js: true do | ||
# TODO: make a csv file | ||
let(:csv_path) { Rails.root.join('config', 'deposit_type_seed.csv').to_s } | ||
let(:importer) { DepositTypeImporter.new(csv_path) } | ||
let(:pdf_path) { Rails.root.join('spec', 'fixtures', 'hello.pdf') } | ||
let(:user) { FactoryBot.create(:user) } | ||
let(:admin) { FactoryBot.create(:admin) } | ||
let(:title) { FFaker::Movie.unique.title } | ||
let(:advisory) { "advisory" } | ||
let(:short_description) { FFaker::Book.description } | ||
|
||
before do | ||
allow(CharacterizeJob).to receive(:perform_later).and_return(true) # Don't run fits | ||
login_as user | ||
# loads the deposit_types | ||
importer.import_from_csv | ||
end | ||
|
||
scenario do | ||
visit '/contribute' | ||
select 'General Graduate Scholarship', from: 'deposit_type' | ||
click_button 'Begin' | ||
attach_file('PDF to upload', pdf_path) | ||
fill_in 'Title', with: title | ||
fill_in 'Short Description', with: short_description | ||
|
||
# Test department autocomplete | ||
fill_in 'Department', with: 'geol' | ||
page.execute_script %{ $('#contribution_department').trigger('focus') } | ||
page.execute_script %{ $('#contribution_department').trigger('keydown') } | ||
expect(page).to have_selector('ul.ui-autocomplete li.ui-menu-item') | ||
page.execute_script %{ $('ul.ui-autocomplete li.ui-menu-item:contains("Dept. of Geology")').trigger('mouseenter').click() } | ||
expect(find_field('Department').value).to eq 'Dept. of Geology' | ||
|
||
fill_in 'Advisor', with: advisory | ||
|
||
click_button 'Agree & Deposit' | ||
expect(page).to have_content 'Your deposit has been submitted for approval.' | ||
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