jekyll-page-asset 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4bc75d0d43f30ae672d870c5e0a6cf6f59c5d4c5e265defae10c1ecaca01d8c
4
- data.tar.gz: a248414dec9ef31592ae271ee6648f6f50ed4d2deb98d1891dd43df1e680515e
3
+ metadata.gz: 4d6d2997cebfa6648d100a3335cf78425358a609ad5d524eb38d5ee4671d0b32
4
+ data.tar.gz: 70559d1c925bc506b6f037b4fdd1d2fc5e8989e359f9755fdc85e9b97e0cabb7
5
5
  SHA512:
6
- metadata.gz: 02ba586c38e6b1c12116b0b485d7c260fce71ee3d3eb3e8d270e8302fc70ca65990fab037f9f59a632eb602091dbcb7f5b6f2ab001729a2ac84ca35f2d18da70
7
- data.tar.gz: 9a76aea336af968aef5452afde8f8dddd314d63b629cea171bae8f0f71fd4bf3d3827be0f7af8a7f70221570cdc5a6a66a7b75b8ce59b8d9dafd73b07ef42eab
6
+ metadata.gz: 2b56178cd9e58f14ce07230045a85528fdf11a0189095ae75fcd242711859170f78dd4a983daad8db5d6ab3d29c951353ae2daf628127214d4e57a4460943dfa
7
+ data.tar.gz: '0890f071dd316148b87d3f470a9ce88c160f094b8936c2aba6f1fdda19f5a2e273b9e383efaef08fbe622fa45524d287a3c2dfed19abaee60950cdcb7962ba21'
data/README.md CHANGED
@@ -38,10 +38,13 @@ Pass a folder name in the media asset directory and all images in that folder wi
38
38
 
39
39
  The generated html and script for this will also write tags to two target mount points in the site, if found.
40
40
 
41
- * `project-asset-gallery-lightbox` is the target for the lightbox html. By default this is styled to fill the viewport area of the component that it is mounted in to act as a full area takeover.
41
+ * `page-asset-gallery-lightbox` is the target for the lightbox html. By default this is styled to fill the viewport area of the component that it is mounted in to act as a full area takeover. This is optional, but if not included, the gallery will only display as thumbnails and cannot be expanded.
42
+
43
+ * `page-asset-gallery-controls` is the target for the gallery controls - to move to next/previous images and close the lightbox. This appears when the lightbox is open. Optional, if not included, the controls will be rendered at the top of the lightbox.
44
+
45
+ Gallery can take optional `title` and `description` arguments to provide a heading and descriptive text for the gallery.
46
+ `{% page_asset gallery <gallery-folder-name> [title="<title-text>"] [description="<description-text>"] %}`
42
47
 
43
- * `project-asset-gallery-controls` is the target for the gallery controls - to move to next/previous images and close the lightbox. This appears when the lightbox is open.
44
- `{% page_asset gallery <gallery-folder-name> %}`
45
48
 
46
49
 
47
50
  ### fountain script reader
@@ -21,6 +21,16 @@
21
21
  lightboxMount.setAttribute(MOUNTED_ATTR, "true");
22
22
  }
23
23
 
24
+ if (!controlsMount) {
25
+ var fallbackControlsDiv = document.createElement("div");
26
+ fallbackControlsDiv.id = "page-asset-gallery-controls-fallback";
27
+ fallbackControlsDiv.className = "gallery-controls-fallback";
28
+ if (lightboxMount) {
29
+ lightboxMount.insertBefore(fallbackControlsDiv, lightboxMount.firstChild);
30
+ }
31
+ controlsMount = fallbackControlsDiv;
32
+ }
33
+
24
34
  if (controlsMount) {
25
35
  controlsMount.innerHTML =
26
36
  '<div class="gallery-controls" id="gallery-controls" hidden aria-label="Gallery controls">' +
@@ -45,9 +45,12 @@ module Jekyll
45
45
  HTML
46
46
  end
47
47
 
48
+ title_html = render_title(@params["title"])
49
+ description_html = render_description(@params["description"])
50
+
48
51
  <<~HTML + gallery_template
49
52
  <section class="project-gallery" data-gallery="#{html_escape(@asset_path_arg)}" aria-label="Image gallery">
50
- <div class="project-gallery-grid">
53
+ #{title_html}#{description_html}<div class="project-gallery-grid">
51
54
  #{thumbnails.join("\n")}
52
55
  </div>
53
56
  </section>
@@ -108,6 +111,16 @@ module Jekyll
108
111
  HTML
109
112
  end
110
113
 
114
+ def render_title(title)
115
+ return "" if title.nil? || title.to_s.strip.empty?
116
+ "<h2 class=\"project-gallery-title\">#{html_escape(title)}</h2>\n"
117
+ end
118
+
119
+ def render_description(description)
120
+ return "" if description.nil? || description.to_s.strip.empty?
121
+ "<p class=\"project-gallery-description\">#{html_escape(description)}</p>\n"
122
+ end
123
+
111
124
  def html_escape(value)
112
125
  CGI.escape_html(value.to_s)
113
126
  end
@@ -171,6 +171,7 @@
171
171
  width: 100%;
172
172
  height: 100%;
173
173
  position: absolute;
174
+ pointer-events: none;
174
175
  }
175
176
 
176
177
  #page-asset-gallery-controls {
@@ -199,6 +200,15 @@
199
200
  }
200
201
  }
201
202
 
203
+ .gallery-controls-fallback {
204
+ position: relative;
205
+ width: 100%;
206
+ padding: $spacing-sm 0;
207
+ background: transparent;
208
+ pointer-events: all;
209
+ z-index: 221;
210
+ }
211
+
202
212
  .gallery-lightbox-desc {
203
213
  margin-top: $spacing-md;
204
214
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllPageAsset
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-page-asset
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alastair King