aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/index.twig13
-rw-r--r--templates/macros.twig50
-rw-r--r--templates/new_note.twig5
-rw-r--r--templates/note.twig15
-rw-r--r--templates/search.twig23
-rw-r--r--templates/skeleton.twig35
6 files changed, 141 insertions, 0 deletions
diff --git a/templates/index.twig b/templates/index.twig
new file mode 100644
index 0000000..7f905ee
--- /dev/null
+++ b/templates/index.twig
@@ -0,0 +1,13 @@
+{% extends "skeleton.twig" %}
+{% import "macros.twig" as macros %}
+
+{% block body %}
+ {% if tagcloud %}
+ <section class="tagcloud-outer">
+ <h2>Tagcloud</h2>
+ {{ macros.tagcloud(tagcloud) }}
+ </section>
+ {% endif %}
+
+ {{ macros.new_note() }}
+{% endblock %}
diff --git a/templates/macros.twig b/templates/macros.twig
new file mode 100644
index 0000000..dc7e721
--- /dev/null
+++ b/templates/macros.twig
@@ -0,0 +1,50 @@
+{% macro taglink(tag) %}
+ <a href="{{ url("search") ~ "?q=" ~ ("#" ~ (tag|search_escape))|e("url") }}">{{ tag }}</a>
+{% endmacro %}
+
+{% macro tagcloud(tagcloud) %}
+ <ul class="tagcloud">{% for tag, magnitude in tagcloud %}
+ <li class="tag tc-{{ magnitude }}">{{ _self.taglink(tag) }}</li>
+ {% endfor %}</ul>
+{% endmacro %}
+
+{% macro searchbox(query="") %}
+ <form action="{{ url("search") }}" class="search-form">
+ <input
+ type="text"
+ name="q"
+ placeholder="foo bar, #tag1 #tag2, &quot;full text&quot; and (#tag1 or #tag2), ..."
+ value="{{ query }}"
+ class="search-input"
+ />
+ <button type="submit" class="search-btn">Search</button>
+ </form>
+{% endmacro %}
+
+{% macro note_form_content(note) %}
+ <div class="labelled">
+ <label for="note-content">Content</label>
+ <div class="labelled-content">
+ <textarea id="note-content" name="content">{{ note.content }}</textarea>
+ </div>
+ </div>
+ <fieldset class="tags">
+ <legend>Tags</legend>
+ {% for tag in note.tags %}
+ <input type="text" name="tag[]" value="{{ tag }}" />
+ {% endfor %}
+ {% for i in 0..10 %}
+ <input type="text" name="tag[]" />
+ {% endfor %}
+ </fieldset>
+{% endmacro %}
+
+{% macro new_note() %}
+ <section class="new-note">
+ <h2>New Note</h2>
+ <form action="{{ url("new-note") }}" method="post">
+ {{ _self.note_form_content({}) }}
+ <button type="submit">Create</button>
+ </form>
+ </section>
+{% endmacro %} \ No newline at end of file
diff --git a/templates/new_note.twig b/templates/new_note.twig
new file mode 100644
index 0000000..df9a320
--- /dev/null
+++ b/templates/new_note.twig
@@ -0,0 +1,5 @@
+{% extends "skeleton.twig" %}
+{% import "macros.twig" as macros %}
+{% block body %}
+ {{ macros.new_note() }}
+{% endblock %} \ No newline at end of file
diff --git a/templates/note.twig b/templates/note.twig
new file mode 100644
index 0000000..14989aa
--- /dev/null
+++ b/templates/note.twig
@@ -0,0 +1,15 @@
+{% extends "skeleton.twig" %}
+{% import "macros.twig" as macros %}
+{% block body %}
+ <form action="{{ url("n/%s", note.id) }}" method="post">
+ {{ macros.note_form_content(note) }}
+ <button type="submit">Save</button>
+ <button
+ type="submit"
+ name="delete"
+ value="delete"
+ class="confirm"
+ data-question="Do you really want to delete the note?"
+ >Delete</button>
+ </form>
+{% endblock %} \ No newline at end of file
diff --git a/templates/search.twig b/templates/search.twig
new file mode 100644
index 0000000..be8ce54
--- /dev/null
+++ b/templates/search.twig
@@ -0,0 +1,23 @@
+{% extends "skeleton.twig" %}
+{% import "macros.twig" as macros %}
+
+{% block body %}
+ {% if error %}
+ <div class="error">{{ error }}</div>
+ {% else %}
+ <ul class="search-result note-list">
+ {% for result in results %}
+ <li>
+ <a href="{{ url("n/%s", result.note.id) }}">[e]</a>
+ <div class="content">{{ result.renderHighlightedContent()|raw }}</div>
+ <ul class="tags">
+ {% for tag in result.note.tags %}
+ <li class="tag">{{ macros.taglink(tag) }}</li>
+ {% endfor %}
+ </ul>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+
+{% endblock %}
diff --git a/templates/skeleton.twig b/templates/skeleton.twig
new file mode 100644
index 0000000..e91223f
--- /dev/null
+++ b/templates/skeleton.twig
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+{% import "macros.twig" as macros %}
+<html lang="en">
+<head>
+{% block head %}
+ <meta charset="UTF-8">
+ <meta name="viewport"
+ content="width=device-width, initial-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+
+ <link type="text/css" rel="stylesheet" href="{{ url("assets/styles.css") }}">
+
+ <script src="{{ url("vendor/components/jquery/jquery.min.js") }}"></script>
+ <script src="{{ url("assets/interactive.js") }}"></script>
+ <title>{% block title %}micropoly{% endblock %}</title>
+{% endblock %}
+</head>
+<body>
+ {% block header %}
+ <header>
+ <nav class="mainmenu">
+ <ul>
+ <li><a href="{{ url("") }}" class="homelink">micropoly</a> </li>
+ <li><a href="{{ url("new-note") }}">Add note</a></li>
+ </ul>
+ </nav>
+ <section class="s-search">
+ {{ macros.searchbox(query) }}
+ </section>
+ </header>
+ {% endblock %}
+ {% block body %}
+ {% endblock %}
+</body>
+</html> \ No newline at end of file