Skip to content

Commit 49d80d3

Browse files
Merge pull request #113 from nycrecords/develop
2 parents 6b117f0 + 0f89268 commit 49d80d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1039
-78
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Rails Settings
22
RAILS_HOST=<RAILS HOST>
3+
APP_NAME=<APPLICATION NAME>
34
SECRET_KEY_BASE=<SECRET_KEY>
45
PORT=<RAILS PORT>
56

app/assets/javascripts/app.js.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ Hyrax.workEditor = function () {
55
new Editor(element).init();
66
}
77
}
8+
9+
// Override sortAndPerPage to not auto reload on change
10+
Hyrax.sortAndPerPage = function () {}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
3+
$(document).ready(function () {
4+
// Get current values from URL query string
5+
let agencyFilter = $('#agency-filter');
6+
let url = new URL(window.location.href);
7+
let params = new URLSearchParams(url.search);
8+
let agency = params.get('agency') || 'All';
9+
10+
// Initialize select2 and set initial value
11+
agencyFilter.select2();
12+
agencyFilter.select2('val', agency);
13+
$('#s2id_agency-filter').attr('aria-label', 'Filter required reports by agency');
14+
15+
// Handle change of agency event
16+
agencyFilter.on('change', function (data) {
17+
agency = data.val;
18+
params.set('agency', agency);
19+
params.delete('page');
20+
url.search = params.toString();
21+
window.location.href = url.toString();
22+
})
23+
});

app/assets/stylesheets/gpp.scss

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,59 @@ body.gpp-dashboard {
244244
max-width: 250px;
245245
word-wrap: break-word;
246246
}
247+
}
248+
249+
.gpp-nav-link {
250+
color: black !important;
251+
}
252+
253+
#required-report-filters {
254+
text-align: center;
255+
padding-bottom: 10px;
256+
}
257+
258+
.agency-filter {
259+
text-align: left;
260+
padding-right: 10px;
261+
min-width: 20%;
262+
}
263+
264+
.center {
265+
text-align: center;
266+
}
267+
268+
.underline-link {
269+
text-decoration: underline;
270+
color: #036 !important;
271+
}
272+
273+
.navbar-link {
274+
text-decoration: underline;
275+
}
276+
277+
a.gpp-nav-link:hover, a.gpp-nav-link:focus {
278+
text-decoration: underline !important;
279+
}
280+
281+
// Adds underline to links on the view submissions page
282+
li.attribute a {
283+
text-decoration: underline;
284+
color: #036 !important;
285+
}
286+
287+
// Adds underline to links on the search results page
288+
dl.dl-horizontal dd a {
289+
text-decoration: underline;
290+
color: #036 !important;
291+
}
292+
293+
// Adds underline to links in the user activity table on file details page
294+
table#activity a {
295+
text-decoration: underline;
296+
color: #036 !important;
297+
}
298+
299+
// Changes color of focus outline globally
300+
:focus{
301+
outline: 2px solid #337ab7 !important;
247302
}

app/controllers/required_reports_controller.rb

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,21 @@ class RequiredReportsController < ApplicationController
88
# GET /required_reports
99
# GET /required_reports.json
1010
def index
11-
@required_reports = RequiredReport.all
11+
if params[:per_page].nil?
12+
params[:per_page] = 20
13+
end
14+
15+
if params[:agency].nil?
16+
params[:agency] = 'All'
17+
end
18+
19+
if params[:agency] == 'All' or params[:agency].nil?
20+
@required_reports = RequiredReport.all.order(agency_name: :asc, name: :asc).page(params[:page]).per(params[:per_page])
21+
else
22+
@required_reports = RequiredReport.where(agency_name: params[:agency]).order(name: :asc).page(params[:page]).per(params[:per_page])
23+
end
24+
25+
@agencies = Agency.all.order(name: :asc)
1226
end
1327

1428
# GET /required_reports/1
@@ -94,7 +108,21 @@ def agency_required_reports
94108

95109
# GET /required_reports/public_list
96110
def public_list
97-
@required_reports = RequiredReport.all.order(agency_name: :asc, name: :asc)
111+
if params[:per_page].nil?
112+
params[:per_page] = 20
113+
end
114+
115+
if params[:agency].nil?
116+
params[:agency] = 'All'
117+
end
118+
119+
if params[:agency] == 'All' or params[:agency].nil?
120+
@required_reports = RequiredReport.all.order(agency_name: :asc, name: :asc).page(params[:page]).per(params[:per_page])
121+
else
122+
@required_reports = RequiredReport.where(agency_name: params[:agency]).order(name: :asc).page(params[:page]).per(params[:per_page])
123+
end
124+
125+
@agencies = Agency.all.order(name: :asc)
98126
@search_url = [
99127
root_url(locale: nil) + 'catalog?utf8=%E2%9C%93&locale=en&agency=',
100128
'&required_report_name=',

app/controllers/users/omniauth_callbacks_controller.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ def saml
1616
end
1717

1818
user_json = nycidwebservices.search_user(saml_attrs[:GUID])
19+
if user_json['nycEmployee'] == false
20+
flash[:notice] = "Looks like you logged in with a public user account. That isn't needed to search reports so we've logged you out."
21+
gpp_collection = Collection.where(title: 'Government Publications').first
22+
path = gpp_collection.present? ? hyrax.collection_path(gpp_collection) : root_path
23+
redirect_to path and return
24+
end
1925
@user = User.from_omniauth(user_json)
2026
last_login_datetime = @user.last_sign_in_at
2127

0 commit comments

Comments
 (0)