This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, feature/twig-template-engine has been updated
via 301e4f175c1a1be4ccac329d96307cdf7c60ca7b (commit)
from bf5d3d6261c48f370feefdaf78190a47714d899e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=301e4f175c1a1be4ccac329d96307cdf7c60ca7b
commit 301e4f175c1a1be4ccac329d96307cdf7c60ca7b
Author: Roland Mas <[email protected]>
Date: Fri Jun 19 13:34:50 2015 +0200
Reimplement links with a Twig macro, for simpler re-use
diff --git a/src/www/themes/funky-twig/templates/Link.html
b/src/www/themes/funky-twig/templates/Link.html
index 23b2ffb..2468179 100644
--- a/src/www/themes/funky-twig/templates/Link.html
+++ b/src/www/themes/funky-twig/templates/Link.html
@@ -1 +1,3 @@
-<a href="{{ href }}"{% for k,v in extra_params %}{% if k != 'title' or
use_tooltips %} {{ k }}="{{ v }}"{% endif %}{% endfor %}>{{ text|raw }}</a>
+{% import 'macros.twig' as macros %}
+
+{{ macros.textlink(href,text,extra_params) }}
\ No newline at end of file
diff --git a/src/www/themes/funky-twig/templates/bodyHeader.html
b/src/www/themes/funky-twig/templates/bodyHeader.html
index 1a3b2a4..042ebdb 100644
--- a/src/www/themes/funky-twig/templates/bodyHeader.html
+++ b/src/www/themes/funky-twig/templates/bodyHeader.html
@@ -1,3 +1,5 @@
+{% import 'macros.twig' as macros %}
+
{% include 'ListTableTop.html' with { 'class': 'fullwidth', 'id': 'header' }
only %}
{% include 'multiTableRow.html' with { 'rowattrs': {}, 'cells':
siteheader_celldata } only %}
@@ -32,7 +34,7 @@
<input type="text" size="12" id="searchBox-words" name="words"
value="{{ search_words }}" required="required" />
<input type="submit" name="Search" value="Search" />
{% if advanced_search_url %}
- {% include 'Link.html' with { 'href': advanced_search_url, 'text':
'Advanced search' } only %}
+ {{ macros.textlink(advanced_search_url,'Advanced search') }}
{% endif %}
</div>
</form>
diff --git a/src/www/themes/funky-twig/templates/footer.html
b/src/www/themes/funky-twig/templates/footer.html
index 1ad0105..d0377c7 100644
--- a/src/www/themes/funky-twig/templates/footer.html
+++ b/src/www/themes/funky-twig/templates/footer.html
@@ -1,6 +1,8 @@
+{% import 'macros.twig' as macros %}
+
</div><!-- maindiv -->
- <div class="footer">
- {% include 'Link.html' with { 'href': 'https://fusionforge.org', 'text':
"<img src=\"#{imgurl}\" alt=\"Powered by FusionForge\" />" } only %}
+ <div class="footer">
+ {{ macros.imglink('https://fusionforge.org','Powered by
FusionForge','images/pow-fusionforge.png') }}
<div style="clear:both"></div>
</div>
</body>
diff --git a/src/www/themes/funky-twig/templates/macros.twig
b/src/www/themes/funky-twig/templates/macros.twig
new file mode 100644
index 0000000..28eb08a
--- /dev/null
+++ b/src/www/themes/funky-twig/templates/macros.twig
@@ -0,0 +1,12 @@
+{% macro textlink(href, text, extra_params) %}
+<a href="{{ href }}"{% for k,v in extra_params %}{% if k != 'title' or
use_tooltips %} {{ k }}="{{ v }}"{% endif %}{% endfor %}>{{ text|raw }}</a>
+{% endmacro %}
+
+{% macro image(base, alt) %}
+<img src="{{ image_url }}/{{ base }}" alt="{{ alt }}" title="{{ alt }}" />
+{% endmacro %}
+
+{% macro imglink(href, title, image) %}
+{% import _self as macros %}
+{{ macros.textlink(href,macros.image(image,title)) }}
+{% endmacro %}
diff --git a/src/www/themes/funky-twig/templates/printSubMenu.html
b/src/www/themes/funky-twig/templates/printSubMenu.html
index 787bada..93e89ed 100644
--- a/src/www/themes/funky-twig/templates/printSubMenu.html
+++ b/src/www/themes/funky-twig/templates/printSubMenu.html
@@ -1,4 +1,5 @@
- {% for entry in submenuentries %}
- {% include 'Link.html' with { 'text': entry.title, 'href': entry.url,
'extra_params': entry.attrs, 'use_tooltips': use_tooltips } only %}
- {% if not loop.last %}{% include 'subMenuSeparator.html' only %}{% endif
%}
- {% endfor %}
\ No newline at end of file
+{% import 'macros.twig' as macros %}
+{% for entry in submenuentries %}
+{{ macros.textlink(entry.url, entry.title, entry.attrs) }}
+{% if not loop.last %}{% include 'subMenuSeparator.html' only %}{% endif %}
+{% endfor %}
-----------------------------------------------------------------------
Summary of changes:
src/www/themes/funky-twig/templates/Link.html | 4 +++-
src/www/themes/funky-twig/templates/bodyHeader.html | 4 +++-
src/www/themes/funky-twig/templates/footer.html | 6 ++++--
src/www/themes/funky-twig/templates/macros.twig | 12 ++++++++++++
src/www/themes/funky-twig/templates/printSubMenu.html | 9 +++++----
5 files changed, 27 insertions(+), 8 deletions(-)
create mode 100644 src/www/themes/funky-twig/templates/macros.twig
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits