From b1917cf8420e368eb03e80f0a10d17502c1e01fa Mon Sep 17 00:00:00 2001 From: Edwin Steele Date: Wed, 10 Oct 2018 17:09:28 +1100 Subject: [PATCH 1/3] Separate galleria album, album_list, base logic --- sigal/themes/galleria/templates/album.html | 101 +++++------------- .../themes/galleria/templates/album_list.html | 42 +------- sigal/themes/galleria/templates/base.html | 52 +++++++++ 3 files changed, 84 insertions(+), 111 deletions(-) create mode 100644 sigal/themes/galleria/templates/base.html diff --git a/sigal/themes/galleria/templates/album.html b/sigal/themes/galleria/templates/album.html index cf422ad..bd8f320 100644 --- a/sigal/themes/galleria/templates/album.html +++ b/sigal/themes/galleria/templates/album.html @@ -1,17 +1,6 @@ - - - - - +{% extends "base.html" %} - {{ album.title|striptags }} - - - - - - - +{% block extra_head %} {# We will always want to show the first image when we're on an album page #} {# Start loading now for faster document complete instead of waiting for js to load it #} {% if album.medias %} @@ -25,60 +14,10 @@ {% if settings.show_map and album.show_map %} {% endif %} +{% endblock %} - {% include 'analytics.html' %} - - - {% include 'gtm.html' %} -
-
-

{{ index_title }}

- - {% if settings.links %} - - {% endif %} - - {% if album.breadcrumb %} -

- {%- for url, title in album.breadcrumb -%} - {{ title }} - {%- if not loop.last %} » {% endif -%} - {% endfor -%} -

-
- {% endif %} -
- -
+{% block content %} {% if album.medias %} - {% macro img_description(media) -%} - {%- if media.big -%}Full size{%- endif -%} - {# clean up tags and whitespace, including newlines, in the description #} - {%- if media.description -%}
{{ media.description | striptags }}{%- endif -%} - {%- if media.exif -%} -
- {%- if media.exif.iso -%}{{ media.exif.iso }} {%- endif -%} - {%- if media.exif.exposure -%}{{ media.exif.exposure }} {%- endif -%} - {%- if media.exif.fstop -%}{{ media.exif.fstop }} {%- endif -%} - {%- if media.exif.focal -%}{{ media.exif.focal }} {%- endif -%} -
- {%- if media.exif.gps -%} - {{ 'N{:.6f}'.format(media.exif.gps.lat) if media.exif.gps.lat > 0 else 'S{:.6f}'.format(-media.exif.gps.lat) }}{{ 'E{:.6f}'.format(media.exif.gps.lon) if media.exif.gps.lon > 0 else 'W{:.6f}'.format(-media.exif.gps.lon) }} - {%- endif -%} - {%- if media.exif.Make or media.exif.Model -%} - {{ media.exif.Make }} {{ media.exif.Model }} - {%- endif -%} - {%- if media.exif.datetime -%} - {{ media.exif.datetime }} - {%- endif -%} - {% endif %} - {%- endmacro %}
{% if settings.show_map and album.show_map %} {% endif %} -
- - {% include 'footer.html' %} -
+{% endblock %} +{% block late_js %} + {% macro img_description(media) -%} + {%- if media.big -%}Full size{%- endif -%} + {# clean up tags and whitespace, including newlines, in the description #} + {%- if media.description -%}
{{ media.description | striptags }}{%- endif -%} + {%- if media.exif -%} +
+ {%- if media.exif.iso -%}{{ media.exif.iso }} {%- endif -%} + {%- if media.exif.exposure -%}{{ media.exif.exposure }} {%- endif -%} + {%- if media.exif.fstop -%}{{ media.exif.fstop }} {%- endif -%} + {%- if media.exif.focal -%}{{ media.exif.focal }} {%- endif -%} +
+ {%- if media.exif.gps -%} + {{ 'N{:.6f}'.format(media.exif.gps.lat) if media.exif.gps.lat > 0 else 'S{:.6f}'.format(-media.exif.gps.lat) }}{{ 'E{:.6f}'.format(media.exif.gps.lon) if media.exif.gps.lon > 0 else 'W{:.6f}'.format(-media.exif.gps.lon) }} + {%- endif -%} + {%- if media.exif.Make or media.exif.Model -%} + {{ media.exif.Make }} {{ media.exif.Model }} + {%- endif -%} + {%- if media.exif.datetime -%} + {{ media.exif.datetime }} + {%- endif -%} + {% endif %} + {%- endmacro %} {% if album.medias %} {% if settings.show_map and album.show_map %} @@ -293,6 +252,4 @@ {% endif %} - {% include 'piwik.html' %} - - +{% endblock %} diff --git a/sigal/themes/galleria/templates/album_list.html b/sigal/themes/galleria/templates/album_list.html index 299d583..bc3ab66 100644 --- a/sigal/themes/galleria/templates/album_list.html +++ b/sigal/themes/galleria/templates/album_list.html @@ -1,36 +1,6 @@ - - - - - +{% extends "base.html" %} - {{ album.title|striptags }} - - - - - - - - - - {% include 'gtm.html' %} -
-
-

{{ index_title }}

- - {% if settings.links %} - - {% endif %} -
- -
+{% block content %}
    @@ -42,10 +12,4 @@ {% endfor %}
-
- - {% include 'footer.html' %} -
- {% include 'piwik.html' %} - - +{% endblock %} diff --git a/sigal/themes/galleria/templates/base.html b/sigal/themes/galleria/templates/base.html new file mode 100644 index 0000000..e7119dc --- /dev/null +++ b/sigal/themes/galleria/templates/base.html @@ -0,0 +1,52 @@ + + + + + + + {{ album.title|striptags }} + + + + + + + + {% block extra_head %}{% endblock extra_head %} + {% include 'analytics.html' %} + + + {% include 'gtm.html' %} +
+
+

{{ index_title }}

+ + {% if settings.links %} + + {% endif %} + {% if album.breadcrumb %} +

+ {%- for url, title in album.breadcrumb -%} + {{ title }} + {%- if not loop.last %} » {% endif -%} + {% endfor -%} +

+
+ {% endif %} +
+ +
+ {% block content %}{% endblock content %} +
+ {% include 'footer.html' %} +
+ {% block late_js %}{% endblock late_js %} + {% include 'piwik.html' %} + + From 59bef3d139f178fe02078e8df96bced92a2c2abb Mon Sep 17 00:00:00 2001 From: Edwin Steele Date: Wed, 10 Oct 2018 17:14:58 +1100 Subject: [PATCH 2/3] Hoist footer so colorbox can use it too --- sigal/themes/colorbox/templates/base.html | 8 +------- sigal/themes/{galleria => default}/templates/footer.html | 0 2 files changed, 1 insertion(+), 7 deletions(-) rename sigal/themes/{galleria => default}/templates/footer.html (100%) diff --git a/sigal/themes/colorbox/templates/base.html b/sigal/themes/colorbox/templates/base.html index 34f19fe..9225115 100644 --- a/sigal/themes/colorbox/templates/base.html +++ b/sigal/themes/colorbox/templates/base.html @@ -36,13 +36,7 @@ {% endif %} -
-

{% if album.author %}© {{ album.author }} - {% endif %} - Generated by sigal - {% if 'sigal.plugins.feeds' in settings.plugins %} - {% if settings.rss_feed %}
RSS Feed{% endif %} - {% if settings.atom_feed %}
Atom Feed{% endif %}{% endif %}

-
+ {% include 'footer.html' %}
diff --git a/sigal/themes/galleria/templates/footer.html b/sigal/themes/default/templates/footer.html similarity index 100% rename from sigal/themes/galleria/templates/footer.html rename to sigal/themes/default/templates/footer.html From 3607d60de06feb683fc2a703ca2323c4890ada60 Mon Sep 17 00:00:00 2001 From: Edwin Steele Date: Wed, 10 Oct 2018 17:24:24 +1100 Subject: [PATCH 3/3] Prefetch js and css resources needed on album pages --- sigal/themes/galleria/templates/album_list.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sigal/themes/galleria/templates/album_list.html b/sigal/themes/galleria/templates/album_list.html index bc3ab66..22cdbd5 100644 --- a/sigal/themes/galleria/templates/album_list.html +++ b/sigal/themes/galleria/templates/album_list.html @@ -1,5 +1,18 @@ {% extends "base.html" %} +{% block extra_head %} + {# These are used on album pages - prefetch now #} + + + + + {% if settings.show_map %} + + + + {% endif %} +{% endblock %} + {% block content %}