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  cbb56b839854aac81f3a4578aaaa38592da88863 (commit)
      from  496bbf3446aaad230852f769ab3653892b46ee12 (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 -----------------------------------------------------------------
commit cbb56b839854aac81f3a4578aaaa38592da88863
Author: Roland Mas <[email protected]>
Date:   Thu Jun 11 18:03:11 2015 +0200

    Implement multiTableRow with Twig

diff --git a/src/www/themes/funky-twig/Theme.class.php 
b/src/www/themes/funky-twig/Theme.class.php
index d79ce3c..f726852 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -495,8 +495,31 @@ class Theme extends Layout {
                return parent::subMenu($title_arr, $links_arr, $attr_arr);
        }
        function multiTableRow($row_attrs, $cell_data, $istitle = false) {
-               // TODO
-               return parent::multiTableRow($row_attrs, $cell_data, $istitle);
+               $template = $this->twig->loadTemplate('multiTableRow.html');
+
+               if (!isset($row_attrs['class'])) {
+                       $row_attrs['class'] = '';
+               }
+               
+               if ($istitle) {
+                       $row_attrs['class'] .= ' align-center';
+               }
+               
+               $cells = array();
+               for ( $c = 0; $c < count($cell_data); $c++ ) {
+                       $cell = array('text' => $cell_data[$c][0]);
+                       $cell['attrs'] = array('class' => '');
+                       foreach (array_slice($cell_data[$c],1) as $k => $v) {
+                               $cell['attrs'][$k] = $v;
+                       }
+                       $cells[] = $cell;
+               }
+               
+               $vars = array('rowattrs' => $row_attrs,
+                                         'cells' => $cells,
+                                         'istitle' => $istitle);
+               
+               return $template->render($vars);
        }
        function feedback($msg) {
                $template = $this->twig->loadTemplate('feedback.html');
diff --git a/src/www/themes/funky-twig/templates/multiTableRow.html 
b/src/www/themes/funky-twig/templates/multiTableRow.html
index 86c582e..a425302 100644
--- a/src/www/themes/funky-twig/templates/multiTableRow.html
+++ b/src/www/themes/funky-twig/templates/multiTableRow.html
@@ -1,5 +1,5 @@
-<tr {% for k,v in rowattrs %}{{ k }}="{{ v }}"{% endfor %}>
-{% for cell in cell_data %}
-<td {% for k,v in cell['attrs'] %}{{ k }}="{{ v }}"{% endfor %}>{{ 
cell['text']|raw }}</td>
+<tr {% for k,v in rowattrs %}{{ k }}="{{ v }}{% if istitle %} align-center{% 
endif %}{% if k == 'class' %} ff{% endif %}"{% endfor %}>
+{% for cell in cells %}
+<td {% for k,v in cell['attrs'] %}{{ k }}="{{ v }}{% if k == 'class' %} ff{% 
endif %}"{% endfor %}>{% if istitle %}<strong>{% endif %}{{ cell['text']|raw 
}}{% if istitle %}<dstrong>{% endif %}</td>
 {% endfor %}
 </tr>

-----------------------------------------------------------------------

Summary of changes:
 src/www/themes/funky-twig/Theme.class.php          | 27 ++++++++++++++++++++--
 .../themes/funky-twig/templates/multiTableRow.html |  6 ++---
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/src/www/themes/funky-twig/Theme.class.php 
b/src/www/themes/funky-twig/Theme.class.php
index d79ce3c..f726852 100644
--- a/src/www/themes/funky-twig/Theme.class.php
+++ b/src/www/themes/funky-twig/Theme.class.php
@@ -495,8 +495,31 @@ class Theme extends Layout {
                return parent::subMenu($title_arr, $links_arr, $attr_arr);
        }
        function multiTableRow($row_attrs, $cell_data, $istitle = false) {
-               // TODO
-               return parent::multiTableRow($row_attrs, $cell_data, $istitle);
+               $template = $this->twig->loadTemplate('multiTableRow.html');
+
+               if (!isset($row_attrs['class'])) {
+                       $row_attrs['class'] = '';
+               }
+               
+               if ($istitle) {
+                       $row_attrs['class'] .= ' align-center';
+               }
+               
+               $cells = array();
+               for ( $c = 0; $c < count($cell_data); $c++ ) {
+                       $cell = array('text' => $cell_data[$c][0]);
+                       $cell['attrs'] = array('class' => '');
+                       foreach (array_slice($cell_data[$c],1) as $k => $v) {
+                               $cell['attrs'][$k] = $v;
+                       }
+                       $cells[] = $cell;
+               }
+               
+               $vars = array('rowattrs' => $row_attrs,
+                                         'cells' => $cells,
+                                         'istitle' => $istitle);
+               
+               return $template->render($vars);
        }
        function feedback($msg) {
                $template = $this->twig->loadTemplate('feedback.html');
diff --git a/src/www/themes/funky-twig/templates/multiTableRow.html 
b/src/www/themes/funky-twig/templates/multiTableRow.html
index 86c582e..a425302 100644
--- a/src/www/themes/funky-twig/templates/multiTableRow.html
+++ b/src/www/themes/funky-twig/templates/multiTableRow.html
@@ -1,5 +1,5 @@
-<tr {% for k,v in rowattrs %}{{ k }}="{{ v }}"{% endfor %}>
-{% for cell in cell_data %}
-<td {% for k,v in cell['attrs'] %}{{ k }}="{{ v }}"{% endfor %}>{{ 
cell['text']|raw }}</td>
+<tr {% for k,v in rowattrs %}{{ k }}="{{ v }}{% if istitle %} align-center{% 
endif %}{% if k == 'class' %} ff{% endif %}"{% endfor %}>
+{% for cell in cells %}
+<td {% for k,v in cell['attrs'] %}{{ k }}="{{ v }}{% if k == 'class' %} ff{% 
endif %}"{% endfor %}>{% if istitle %}<strong>{% endif %}{{ cell['text']|raw 
}}{% if istitle %}<dstrong>{% endif %}</td>
 {% endfor %}
 </tr>


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to