]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
[add] create tags page
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Fri, 6 Dec 2013 12:15:06 +0000 (13:15 +0100)
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Fri, 6 Dec 2013 12:15:06 +0000 (13:15 +0100)
inc/poche/Database.class.php
inc/poche/Poche.class.php
inc/poche/Tools.class.php
themes/default/_menu.twig
themes/default/tags.twig [new file with mode: 0644]

index 86907e528fe2da66460bb3f36af2a82e68e44351..8e9ee0b7e7be8592aec535a633ee5b0f7c6edc11 100644 (file)
@@ -250,13 +250,21 @@ class Database {
         return $this->getHandle()->lastInsertId($column);
     }
 
+    public function retrieveAllTags() {
+        $sql = "SELECT * FROM tags";
+        $query = $this->executeQuery($sql, array());
+        $tags = $query->fetchAll();
+
+        return $tags;
+    }
+
     public function retrieveTagsByEntry($entry_id) {
-        $sql        
+        $sql = 
             "SELECT * FROM tags
             LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id
             WHERE tags_entries.entry_id = ?";
-        $query      = $this->executeQuery($sql, array($entry_id));
-        $tags    = $query->fetchAll();
+        $query = $this->executeQuery($sql, array($entry_id));
+        $tags = $query->fetchAll();
 
         return $tags;
     }
index c9fb6382f728d739999a1b856674c5dbe2db020b..802ec542f462d44f7119dd6f87e8288e1994e928 100644 (file)
@@ -430,6 +430,12 @@ class Poche
                 );
                 Tools::logm('config view');
                 break;
+            case 'tags':
+                $tags = $this->store->retrieveAllTags();
+                $tpl_vars = array(
+                    'tags' => $tags,
+                );
+                break;
             case 'view':
                 $entry = $this->store->retrieveOneById($id, $this->user->getId());
                 if ($entry != NULL) {
index 750553f1202637eeb4886a569c2586604530d547..5bb65fe9a743e272c94203cca5dca21c36466602 100644 (file)
@@ -103,14 +103,15 @@ class Tools
             case 'config':
                 $tpl_file = 'config.twig';
                 break;
+            case 'tags':
+                $tpl_file = 'tags.twig';
+                break;
             case 'view':
                 $tpl_file = 'view.twig';
                 break;
-            
             case 'login':
                 $tpl_file = 'login.twig';
                 break;
-                
             case 'error':
                 $tpl_file = 'error.twig';
                 break;
index 699d6a0c93411d46d9b04b8fbfe6c1dc18ca7370..02bec1dcdbf94d99050d4cb68188e1c43d125ad0 100644 (file)
@@ -2,6 +2,7 @@
                 <li><a href="./" {% if view == 'home' %}class="current"{% endif %}>{% trans "home" %}</a></li>
                 <li><a href="./?view=fav" {% if view == 'fav' %}class="current"{% endif %}>{% trans "favorites" %}</a></li>
                 <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li>
+                <li><a href="./?view=tags" {% if view == 'tags' %}class="current"{% endif %}>{% trans "tags" %}</a></li>
                 <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
                 <li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
             </ul>
\ No newline at end of file
diff --git a/themes/default/tags.twig b/themes/default/tags.twig
new file mode 100644 (file)
index 0000000..9421fe3
--- /dev/null
@@ -0,0 +1,8 @@
+{% extends "layout.twig" %}
+{% block title %}tags{% endblock %}
+{% block menu %}
+{% include '_menu.twig' %}
+{% endblock %}
+{% block content %}
+{% for tag in tags %}<a href="#">{{ tag.value }}</a> {% endfor %}
+{% endblock %}
\ No newline at end of file