Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ gem "sass-rails", "~> 6.0"
gem "font-awesome-rails", ">= 4.7.0.9"
gem "terser"

gem "turbolinks", "~> 5"
gem "redcarpet"
gem "wicked_pdf", "1.4.0"
gem "wkhtmltopdf-binary", "0.12.3.1"
Expand Down
4 changes: 0 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,6 @@ GEM
tilt (2.8.0)
timeout (0.6.1)
tsort (0.2.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.2.0)
Expand Down Expand Up @@ -444,7 +441,6 @@ DEPENDENCIES
spring
spring-watcher-listen (~> 2.1.0)
terser
turbolinks (~> 5)
tzinfo-data
web-console (>= 3.3.0)
wicked_pdf (= 1.4.0)
Expand Down
4 changes: 0 additions & 4 deletions Gemfile.next.lock
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,6 @@ GEM
tilt (2.8.0)
timeout (0.6.1)
tsort (0.2.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.2.0)
Expand Down Expand Up @@ -444,7 +441,6 @@ DEPENDENCIES
spring
spring-watcher-listen (~> 2.1.0)
terser
turbolinks (~> 5)
tzinfo-data
web-console (>= 3.3.0)
wicked_pdf (= 1.4.0)
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
//
//= require fastruby/styleguide
//
//= require turbolinks
//= require_tree .
33 changes: 11 additions & 22 deletions app/assets/javascripts/form.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
// Custom file upload input functionality
$(document).on('turbolinks:load', function() {

$('.new_gemfile').on('change', function(e){
var fileName = e.target.value.split( '\\' ).pop();
$('.file-custom').text(fileName);
$('.file-custom').css('color', '#222');
$('.check_button').removeAttr('disabled');
$('.check_button').show();
$('.file-upload').hide();
})

$('.edit_gemfile').on('change', function(e){
var fileName = e.target.value.split( '\\' ).pop();
$('.file-custom').text(fileName);
$('.file-custom').css('color', '#222');
$('.check_button').removeAttr('disabled');
$('.check_button').show();
$('.file-upload').hide();
})

})
// Custom file upload input functionality.
// Delegated from `document` so it binds once and keeps working across full
// page loads regardless of script load order.
$(document).on('change', '.new_gemfile, .edit_gemfile', function(e) {
var fileName = e.target.value.split('\\').pop();
$('.file-custom').text(fileName);
$('.file-custom').css('color', '#222');
$('.check_button').removeAttr('disabled');
$('.check_button').show();
$('.file-upload').hide();
});
72 changes: 37 additions & 35 deletions app/assets/javascripts/header.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
// All header behaviours
$(document).on('turbolinks:load', function() {
// Navbar toggle button
$('.navbar-toggler').click(function(){
$(this).toggleClass('open');
$('.cta').toggleClass('show');
$('header').toggleClass('open');
});
// All header behaviours.
// Interactive handlers are delegated from `document` so they bind once
// regardless of script load order; the sticky-on-load state is set on DOM
// ready (fires on each full page load).

// Makes navbar sticky on load if scrollTop >= topSectionHeight
// Navbar toggle button
$(document).on('click', '.navbar-toggler', function() {
$(this).toggleClass('open');
$('.cta').toggleClass('show');
$('header').toggleClass('open');
});

// Closes menu on mobile when clicking a menu item
$(document).on('click', '.navbar-nav a', function() {
$('.navbar-toggler').removeClass('open');
$('.navbar-collapse').removeClass('in');
$('.navbar-toggler').addClass('collapsed');
});

// Makes navbar sticky on scroll if scrollTop >= topSectionHeight
$(document).on('scroll', function() {
var topSectionHeight = $('.top-section').outerHeight() / 2;
var scrollTop = $(document).scrollTop();
if(scrollTop >= topSectionHeight){

if (scrollTop >= topSectionHeight) {
$('header').addClass('fixed');
$('.cta').addClass('show');
} else if ($('.navbar-collapse').hasClass('in')) {
$('header').addClass('fixed');
} else {
$('header').removeClass('fixed');
}
});

// Makes navbar sticky on scroll if scrollTop >= topSectionHeight
$(document).scroll(function(){

var topSectionHeight = $('.top-section').outerHeight() / 2;
var scrollTop = $(document).scrollTop();

if(scrollTop >= topSectionHeight){
$('header').addClass('fixed');
}else if($('.navbar-collapse').hasClass('in')){
$('header').addClass('fixed');
}
else{
$('header').removeClass('fixed');
}

})

// Closes menu on mobile when clicking a menu item
$('.navbar-nav a').on('click', function() {
$('.navbar-toggler').removeClass('open');
$('.navbar-collapse').removeClass('in');
$('.navbar-toggler').addClass('collapsed');
})
})
// Makes navbar sticky on load if scrollTop >= topSectionHeight
function initHeaderStickyState() {
var topSectionHeight = $('.top-section').outerHeight() / 2;
var scrollTop = $(document).scrollTop();
if (scrollTop >= topSectionHeight) {
$('header').addClass('fixed');
$('.cta').addClass('show');
}
}
$(initHeaderStickyState);
44 changes: 22 additions & 22 deletions app/assets/javascripts/utils.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
$(document).on('turbolinks:load', function() {
// Smooth scroll behaviour
$('a.scrollto').on('click', function(event) {
// Smooth scroll behaviour — delegated from `document` so it binds once
// regardless of script load order.
$(document).on('click', 'a.scrollto', function(event) {
var hash = this.hash;
event.preventDefault();
var menuHeight = $('header').outerHeight();
$('html, body').animate({
scrollTop: $(hash).offset().top - menuHeight
}, 800);
});

var hash = this.hash;
event.preventDefault();
var menuHeight = $('header').outerHeight();
$('html, body').animate({
scrollTop: $(hash).offset().top - menuHeight
}, 800);
// Hide the "read more" toggle when an advisory description isn't clipped.
// Runs on DOM ready (fires on each full page load).
function initReadMoreToggles() {
$('.results-content').each(function() {
var advisoryDescriptionHeight = $('.advisory-description', this).outerHeight();
var advisoryDescriptionContentHeight = $('.advisory-description .advisory-description-content', this).outerHeight();
var collapseButton = $('.btn-readmore', this);

if (advisoryDescriptionHeight >= advisoryDescriptionContentHeight) {
collapseButton.hide();
}
});

$('.results-content').each(function(e){

var advisoryDescriptionHeight = $('.advisory-description', this).outerHeight();
var advisoryDescriptionContentHeight = $('.advisory-description .advisory-description-content', this).outerHeight();
var collapseButton = $('.btn-readmore', this);

if(advisoryDescriptionHeight >= advisoryDescriptionContentHeight){
collapseButton.hide();
}
})

});
}
$(initReadMoreToggles);
Loading