From b1c975fa4cf72316bc4a1156523e1bd33c2bdde0 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Thu, 19 Oct 2017 19:58:16 +0100 Subject: [PATCH] project widget: Fix long title appearing on new line (Fix #324) * Only affects simple list mode, not card mode --- layouts/partials/css/academic.css | 1 - layouts/partials/widgets/projects.html | 4 +- static/js/hugo-academic.js | 51 +++++++++++++------------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/layouts/partials/css/academic.css b/layouts/partials/css/academic.css index c57288ab..9ab332b9 100644 --- a/layouts/partials/css/academic.css +++ b/layouts/partials/css/academic.css @@ -667,7 +667,6 @@ article { } #projects.home-section .project-title { - display: inline-block; margin-bottom: 6px; } diff --git a/layouts/partials/widgets/projects.html b/layouts/partials/widgets/projects.html index f09a3f4a..e8af8a4c 100644 --- a/layouts/partials/widgets/projects.html +++ b/layouts/partials/widgets/projects.html @@ -31,7 +31,7 @@ {{ if eq $page.Params.view 0 }} -
+
{{ range where $.Site.RegularPages "Type" "project" }}
@@ -52,7 +52,7 @@ {{ else }} -
+
{{ range $project := where $.Site.RegularPages "Type" "project" }} {{ $.Scratch.Set "project_url" $project.Permalink }} diff --git a/static/js/hugo-academic.js b/static/js/hugo-academic.js index b0daa065..2ddb9bbc 100644 --- a/static/js/hugo-academic.js +++ b/static/js/hugo-academic.js @@ -97,31 +97,6 @@ } }); - /* --------------------------------------------------------------------------- - * Filter projects. - * --------------------------------------------------------------------------- */ - - $('.projects-container').each(function(index, container) { - let $container = $(container); - let $section = $container.closest('section'); - - $container.imagesLoaded(function() { - // Initialize Isotope after all images have loaded. - $container.isotope({ - itemSelector: '.isotope-item', - layoutMode: 'masonry', - filter: $section.find('.default-project-filter').text() - }); - // Filter items when filter link is clicked. - $section.find('.project-filters a').click(function() { - let selector = $(this).attr('data-filter'); - $container.isotope({filter: selector}); - $(this).removeClass('active').addClass('active').siblings().removeClass('active all'); - return false; - }); - }); - }); - /* --------------------------------------------------------------------------- * Filter publications. * --------------------------------------------------------------------------- */ @@ -262,6 +237,32 @@ resizeTimer = setTimeout(fixScrollspy, 200); }); + // Filter projects. + $('.projects-container').each(function(index, container) { + let $container = $(container); + let $section = $container.closest('section'); + let layout = 'masonry'; + if ($section.find('.isotope').hasClass('js-layout-row')) { + layout = 'fitRows'; + } + + $container.imagesLoaded(function() { + // Initialize Isotope after all images have loaded. + $container.isotope({ + itemSelector: '.isotope-item', + layoutMode: layout, + filter: $section.find('.default-project-filter').text() + }); + // Filter items when filter link is clicked. + $section.find('.project-filters a').click(function() { + let selector = $(this).attr('data-filter'); + $container.isotope({filter: selector}); + $(this).removeClass('active').addClass('active').siblings().removeClass('active all'); + return false; + }); + }); + }); + // Enable publication filter for publication index page. if ($('.pub-filters-select')) { filter_publications();