Skip to content

Commit

Permalink
Merge pull request #168 from minicomp/bug/handle-no-img-132
Browse files Browse the repository at this point in the history
Bug/handle no img 132
  • Loading branch information
mnyrop committed Jul 19, 2023
2 parents f608a64 + 99bbd01 commit 9c64634
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
3 changes: 1 addition & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#
# Questions ?
# ~> https://minicomp.github.io/wiki/#/
# ~> https://gitter.im/minicomp/wax/
#
# ---------------------------------------------------------------
# MAIN SETTINGS
Expand All @@ -24,6 +23,7 @@ url: 'https://minicomp.github.io'
baseurl: '/wax'
copyright: 'Example copyright org, 2023'
logo: '/assets/logo.png'
default_thumb: '/assets/default.png'

# ---------------------------------------------------------------
# BUILD SETTINGS
Expand All @@ -34,7 +34,6 @@ permalink: 'pretty'
sass:
style: compressed
exclude: ["Gemfile*", "*.gemspec", "Rakefile", "vendor", "spec", "README.md", "LICENSE.txt", "Docker*"]
incremental: true
webrick:
headers:
'Access-Control-Allow-Origin': '*'
Expand Down
4 changes: 2 additions & 2 deletions _includes/collection_gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
{% if subset %}
{% for item in subset %}
{%- capture item_html -%}
"<div class='gallery-item {{ item[include.facet_by] | slugify }} all'><a href='{{ item.url | absolute_url }}'><div class='hovereffect'><img class='img-responsive gallery-thumb' src='{{ item.thumbnail | absolute_url }}' alt='{{ item.label | escape }}'/><div class='overlay'><p class='info'>{{ item.label | escape }}</p></div></div></a></div>"
"<div class='gallery-item {{ item[include.facet_by] | slugify }} all'><a href='{{ item.url | absolute_url }}'><div class='hovereffect'><img class='img-responsive gallery-thumb' src='{{ item.thumbnail | default: site.default_thumb | absolute_url }}' alt='{{ item.label | escape }}'/><div class='overlay'><p class='info'>{{ item.label | escape }}</p></div></div></a></div>"
{%- endcapture -%}
gallery.append({{ item_html | strip_newlines }});
{% endfor %}
{% else %}
{% for item in collection %}
{%- capture item_html -%}
"<div class='gallery-item {{ item[include.facet_by] | default: undefined | slugify }} all'><a href='{{ item.url | absolute_url }}'><div class='hovereffect'><img class='img-responsive gallery-thumb' src='{{ item.thumbnail | absolute_url }}' alt='{{ item.label | escape }}'/><div class='overlay'><p class='info'>{{ item.label | escape }}</p></div></div></a></div>"
"<div class='gallery-item {{ item[include.facet_by] | default: undefined | slugify }} all'><a href='{{ item.url | absolute_url }}'><div class='hovereffect'><img class='img-responsive gallery-thumb' src='{{ item.thumbnail | default: site.default_thumb | absolute_url }}' alt='{{ item.label | escape }}'/><div class='overlay'><p class='info'>{{ item.label | escape }}</p></div></div></a></div>"
{%- endcapture -%}
gallery.append({{ item_html | strip_newlines }});
{% endfor %}
Expand Down
19 changes: 8 additions & 11 deletions _layouts/generic_collection_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,21 @@

<h3 alt="{{ page.label | escape }}" class='item-label'>{{ page.label }}</h3>

{% if page.image_viewer %}
{% assign viewer = page.image_viewer %}
{% elsif layout.image_viewer %}
{% assign viewer = layout.image_viewer %}
{% endif %}
{% assign viewer = page.image_viewer | default: layout.image_viewer %}
{% assign image = page.manifest | default: page.full %}

{% if viewer %}
<div class='item-view'>
<span class='pagination-link' id='prevlink'></span>
{% if viewer == 'openseadragon' %}
{% include osd_iiif_image_viewer.html manifest=page.manifest prevlink=prevlink nextlink=nextlink %}
{% else %}
{% include simple_image_viewer.html full_image=page.full prevlink=prevlink nextlink=nextlink %}
{% if viewer and image.size > 0 %}
{% if viewer == 'openseadragon' %}
{% include osd_iiif_image_viewer.html manifest=page.manifest prevlink=prevlink nextlink=nextlink %}
{% else %}
{% include simple_image_viewer.html full_image=page.full prevlink=prevlink nextlink=nextlink %}
{% endif %}
{% endif %}
<span class='pagination-link' id='nextlink'></span>
</div>
{% unless layout.pagination == false %}{% include item_pagination.html %}{% endunless %}
{% endif %}

{% comment %}
The block below controls the item metadata table
Expand Down
Binary file added assets/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions assets/search-ui.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
---
DEFAULT = "{{ site.default_thumb }}";

// Methods and jQuery UI for Wax search box
function excerptedString(str) {
str = str || ''; // handle null > string
Expand All @@ -10,11 +14,11 @@ function excerptedString(str) {
}

function getThumbnail(item, url) {
if ('thumbnail' in item) {
if (item.thumbnail) {
return `<img class='sq-thumb-sm' src='${url}${item.thumbnail}'/>&nbsp;&nbsp;&nbsp;`
}
else {
return '';
return `<img class='sq-thumb-sm' src='${url}${DEFAULT}'/>&nbsp;&nbsp;&nbsp;`
}
}

Expand Down

0 comments on commit 9c64634

Please sign in to comment.