Skip to content

Commit

Permalink
Merge ea1269d into 4ee4d01
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreben committed Nov 19, 2019
2 parents 4ee4d01 + ea1269d commit 6e8bd55
Show file tree
Hide file tree
Showing 37 changed files with 700 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ gem 'config'
# Use okcomputer to set up checks to monitor
gem 'okcomputer'
# Use nokogiri for xml printing
gem 'nokogiri'
gem 'nokogiri', ' >= 1.10.5'
# Use systemu to handle OS calls
gem 'systemu'
# For exception reporting
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ DEPENDENCIES
honeybadger
jbuilder
jquery-rails
nokogiri
nokogiri (>= 1.10.5)
okcomputer
rails (~> 5.2)
rails-controller-testing
Expand Down
Binary file removed app/assets/images/SUL-logo-stacked.png
Binary file not shown.
Binary file removed app/assets/images/SUL-logo-stacked@2x.png
Binary file not shown.
Binary file added app/assets/images/StanfordLibraries-logo-cmyk.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/assets/images/sul-logo-small.png
Binary file not shown.
Binary file removed app/assets/images/sul-logo-small@2x.png
Binary file not shown.
Binary file removed app/assets/images/sul-logo.png
Binary file not shown.
Binary file removed app/assets/images/sul-logo@2x.png
Binary file not shown.
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
//= require jquery_ujs
//= require bootstrap
//= require bootstrap-datepicker
// = stub ssds
1 change: 1 addition & 0 deletions app/assets/javascripts/ssds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//= require ssds
1 change: 1 addition & 0 deletions app/assets/stylesheets/home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
@import 'modules/top-navbar';
@import 'modules/forms';
@import 'modules/sorting';
@import 'ssds';
45 changes: 45 additions & 0 deletions app/assets/stylesheets/ssds.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
$blackish-yellow: #2e2d29;
$dark-grey-red: #544948;

.fill-width {
width: 66%;
}

h1 {
color: $blackish-yellow;
font-size: 2.323em;
font-weight: 300;
line-height: 1.2em;
}

h2 {
color: $dark-grey-red;
font-size: 1.793em;
font-weight: 400;
line-height: 1.2em;

span {
font-weight: 300;
}
}

label {
font-size: inherit;
font-weight: normal;
line-height: 1.5;
margin-bottom: 0;
padding-bottom: calc(.375rem + 1px);
padding-top: calc(.375rem + 1px);
text-align: right;
}

//scss-lint:disable SelectorFormat
#new_ssds_request {
margin-top: 2em;
}
//scss-lint:enable SelectorFormat

#topnav-container #topnav {
padding: 5px 0;
}

2 changes: 1 addition & 1 deletion app/assets/stylesheets/sul-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $light-grayish-yellow: #f7f7f4;
$pure-yellow: #ff0;
$white: #fff;
$dark-cyan: #007c5d;
$dark-gray:#737373;
$dark-gray: #737373;

// Mappings
$sul-admin-h3-color: $gray-41-percent;
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ def user_id
end
helper_method :user_id

def display_name
request.env['displayName'] || ENV['displayName'] || current_user_name
end
helper_method :display_name

def webauth_user?
current_user.present? && user_id.present?
end
Expand Down
31 changes: 31 additions & 0 deletions app/controllers/ssds_requests_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Controller for SSDS request form
class SsdsRequestsController < ApplicationController
layout 'ssds'

def index
@ssds_request = SsdsRequest.new(ssds_request_params)
end

def new
@ssds_request = SsdsRequest.new(new_ssds_request_params)
end

def create
@ssds_request = SsdsRequest.new(ssds_request_params)
WebformsMailer.ssds_request(@ssds_request).deliver_now
flash[:notice] = 'SSRC will be notified of your request'
render 'index', ssds_request_params
end

private

# Never trust parameters from the scary internet, only allow the white list through.
def ssds_request_params
params.require(:ssds_request).permit(:affiliation, :call_no_in, :dataset_type, :department, :name,
:notes, :phone, :sponsor, :sunet, :title_in, :unicorn_id_in)
end

def new_ssds_request_params
params.permit(:call_no_in, :title_in, :unicorn_id_in)
end
end
5 changes: 5 additions & 0 deletions app/mailers/webforms_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ def sal3_batch_email(sal3_batch_requests_batch)
all_recipients.join(',')
mail(to: all_recipients, subject: 'SAL3 pull request')
end

def ssds_request(ssds_request)
@ssds_request = ssds_request
mail(to: Settings.ssds_contact_email, subject: 'SSDS Request')
end
end
52 changes: 52 additions & 0 deletions app/models/ssds_request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Create the SSDS Request model
class SsdsRequest
include ActiveModel::Model

attr_accessor :affiliation, :call_no_in, :dataset_type, :notes, :department, :name, :phone, :referer, :sponsor,
:sunet, :title_in, :unicorn_id_in

validates :call_no_in, :title_in, :unicorn_id_in, presence: true

def affiliations
%w(Other Faculty Graduate Staff Undergraduate)
end

def departments
[
'Other',
'Anthropology',
'Business',
'Communication',
'Computer Science',
'Economics',
'Education',
'Engineering',
'History',
'Human Biology',
'International Relations',
'Law',
'Medicine',
'Political Science',
'Psychology',
'Public Policy',
'Sociology'
]
end

def datasets
%w[Other TAPE ICPSR ROPER]
end

def dataset_default
case call_no_in
when /TAPE/
'TAPE'
when /ICPSR/
'ICPSR'
when /ROPER/
'ROPER'
else
'Other'
end
end
end
13 changes: 5 additions & 8 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<link href="https://www.stanford.edu/su-identity/css/su-identity.css" rel="stylesheet">
<link rel="stylesheet" href="https://sul-cdn.stanford.edu/sul_styles/0.5.0/sul-icons.min.css">
<%= favicon_link_tag 'favicon.ico' %>
<%= stylesheet_link_tag "application", media: "all" %>
<%= stylesheet_link_tag "https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.css" %>
<%= javascript_include_tag "application" %>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= stylesheet_link_tag 'https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.css' %>
<%= javascript_include_tag 'application' %>
<%= yield :javascript_includes %>
<%= javascript_include_tag "https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.js" %>
<%= javascript_include_tag "https://cdn.jsdelivr.net/webshim/1.15.8/polyfiller.js" %>
<%= javascript_include_tag 'https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.js' %>
<%= javascript_include_tag 'https://cdn.jsdelivr.net/webshim/1.15.8/polyfiller.js' %>
<%= csrf_meta_tags %>
<%= content_for(:head) %>
<!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
Expand All @@ -34,8 +34,5 @@
</div>
</div>
</div>

<%= render 'shared/sul_footer' %>

</body>
</html>
35 changes: 35 additions & 0 deletions app/views/layouts/ssds.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="Stanford University Libraries - LibSys Web Form" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">

<title>SSRC dataset request</title>
<link href="https://www.stanford.edu/su-identity/css/su-identity.css" rel="stylesheet">
<link rel="stylesheet" href="https://sul-cdn.stanford.edu/sul_styles/0.5.0/sul-icons.min.css">
<%= favicon_link_tag 'favicon.ico' %>
<%= stylesheet_link_tag 'ssds', media: 'all' %>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= yield :javascript_includes %>
<%= csrf_meta_tags %>
<%= content_for(:head) %>
<!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
<!--[if IE 8]> <link rel="stylesheet" type="text/css" href="https://www.stanford.edu/su-identity/css/ie/ie8.css" /> <![endif]-->
<!--[if IE 7]> <link rel="stylesheet" type="text/css" href="https://www.stanford.edu/su-identity/css/ie/ie7.css" /> <![endif]-->
</head>
<body>
<div id="su-wrap"> <!-- #su-wrap start -->
<div id="su-content"> <!-- #su-content start -->
<div id="outer-container" class="container-fluid">
<%= render 'shared/ssds_top_navbar' %>
<section id="main-container" role="main">
<%= render 'shared/flashes' %>
<%= yield %>
</section>
</div>
</div>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions app/views/shared/_ssds_top_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div id="topnav-container">
<header id="topnav" class="header-logo" role="banner">
<%= link_to 'http://library.stanford.edu' do %>
<%= content_tag :span, 'Stanford University Libraries', class: 'sr-only' %>
<%= image_tag 'StanfordLibraries-logo-cmyk.png', alt: '', height: 25 %>
<% end %>
</header>
</div>

<div class="topnav-divider">
</div>
2 changes: 1 addition & 1 deletion app/views/shared/_sul_footer.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<footer role="contentinfo">
<footer role="contentinfo">
<div id="sul-footer-container">
<div id="sul-footer">
<div id="sul-footer-img" class="span2">
Expand Down
9 changes: 4 additions & 5 deletions app/views/shared/_top_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<div id="topnav-container">
<header id="topnav" class="header-logo" role="banner">
<%= link_to 'http://library.stanford.edu' do %>
<%= content_tag :span, "Stanford University Libraries", class: "sr-only" %>
<%= image_tag "sul-logo.png", class: "hidden-xs", alt: "", height: 25 %>
<%= image_tag "sul-logo-small.png", class: "visible-xs", alt: "", height: 25 %>
<%= content_tag :span, 'Stanford University Libraries', class: 'sr-only' %>
<%= image_tag 'StanfordLibraries-logo-cmyk.png', alt: '', height: 25 %>
<% end %>

<div class="header-links" id="login_id" data="<%= user_id %>">
<% if webauth_user? %>
<% if can? :manage, AuthorizedUser %>
<%= link_to "Administer users", authorized_users_index_path %>
<%= link_to 'Administer users', authorized_users_index_path %>
<% end %>
<% else %>
<%= link_to "Login here", login_path(referrer: request.original_url) %>
<%= link_to 'Login here', login_path(referrer: request.original_url) %>
<% end %>
</div>

Expand Down
34 changes: 34 additions & 0 deletions app/views/ssds_requests/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<h1>Thank you for submitting your data request to SSRC.</h1>
<p>
<b>Requestor:</b> <%= @ssds_request.name %>
</p>
<p>
<b>Dataset type:</b> <%= @ssds_request.dataset_type %>
</p>
<p>
<b>Dataset number:</b> <%= @ssds_request.call_no_in %>
</p>
<p>
<b>Dataset title:</b> <%= @ssds_request.title_in %>
</p>
<p>
<b>Catalog key:</b> <%= @ssds_request.unicorn_id_in %>
</p>
<p>
<b>Notes:</b> <%= @ssds_request.notes %>
</p>
<hr />
<div>
<p>
Datasets listed in SearchWorks or the ICPSR data archive are routinely available within 1-3 working days. Datasets from ROPER or other sources can take a week or more to arrive depending on the data provider.
</p>
<p>
You will be notified by email when your dataset is available.
</p>
<p>
If you have questions, please <%= mail_to 'consult-data@lists.stanford.edu', 'Contact SSRC' %>.
</p>
<p>
Return to <%= link_to 'SearchWorks', "#{Settings.searchworks_url}/#{@ssds_request.unicorn_id_in}" %>
</p>
</div>

0 comments on commit 6e8bd55

Please sign in to comment.