twig implementation

This commit is contained in:
Nicolas Lœuillet
2013-08-03 08:25:11 +02:00
parent c67e13e04b
commit 8cbb2a8802
7 changed files with 86 additions and 90 deletions

View File

@ -1,21 +1,41 @@
<body class="light-style">
<header>
<h1><a href="index.php"><img src="./img/logo.png" alt="logo poche" /></a>poche</h1>
</header>
<div id="main">
{% extends "layout.twig" %}
{% block title %}Home{% endblock %}
{% block menu %}
<ul id="links">
<li><a href="index.php" {if="$view == 'index'"}class="current"{/if}>home</a></li>
<li><a href="?view=fav" {if="$view == 'fav'"}class="current"{/if}>favorites</a></li>
<li><a href="?view=archive" {if="$view == 'archive'"}class="current"{/if}>archive</a></li>
<li><a href="?view=config" {if="$view == 'config'"}class="current"{/if}>config</a></li>
<li><a href="index.php" {% if view == 'home' %}class="current"{% endif %}>home</a></li>
<li><a href="?view=fav" {% if view == 'fav' %}class="current"{% endif %}>favorites</a></li>
<li><a href="?view=archive" {% if view == 'archive' %}class="current"{% endif %}>archive</a></li>
<li><a href="?view=config" {% if view == 'config' %}class="current"{% endif %}>config</a></li>
<li><a href="?logout" title="Logout">logout</a></li>
</ul>
{% endblock %}
{% block precontent %}
<ul id="sort">
<li><img src="img/up.png" onclick="sort_links('{$view}', 'ia');" title="by date asc" /> by date <img src="img/down.png" onclick="sort_links('{$view}', 'id');" title="by date desc" /></li>
<li><img src="img/up.png" onclick="sort_links('{$view}', 'ta');" title="by title asc" /> by title <img src="img/down.png" onclick="sort_links('{$view}', 'td');" title="by title desc" /></li>
<li><img src="img/up.png" onclick="sort_links('{{ view }}', 'ia');" title="by date asc" /> by date <img src="img/down.png" onclick="sort_links('{{ view }}', 'id');" title="by date desc" /></li>
<li><img src="img/up.png" onclick="sort_links('{{ view }}', 'ta');" title="by title asc" /> by title <img src="img/down.png" onclick="sort_links('{{ view }}', 'td');" title="by title desc" /></li>
</ul>
{% endblock %}
{include="messages"}
{% block content %}
<div id="content">
{% for entry in entries %}
<div id="entry-{{ entry.id|e }}" class="entrie mb2">
<span class="content">
<h2 class="h6-like">
<a href="index.php?&view=view&id={{ entry.id|e }}">{{ entry.title|e }}</a>
</h2>
<div class="tools">
<ul>
<li>
<a title="toggle mark as read" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" onclick="toggle_archive(this, {{ entry.id|e }})"><span></span></a></li>
<li><a title="toggle favorite" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" onclick="toggle_favorite(this, {{ entry.id|e }})"><span></span></a></li>
<li><form method="post" onsubmit="return confirm('Are you sure?')" style="display: inline;"><input type="hidden" name="token" id="token" value="{{ token }}" /><input type="hidden" id="action" name="action" value="delete" /><input type="hidden" id="view" name="view" value="{{ view }}" /><input type="hidden" id="id" name="id" value="{{ entry.id|e }}" /><input type="submit" class="delete" title="toggle delete" /></form>
</li>
</ul>
</div>
<div class="url">{{ entry.url|e }}</div>
</span>
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -9,50 +9,18 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=10">
<title>{% block title %}{% endblock %} - poche</title>
<link rel="shortcut icon" type="image/x-icon" href="./img/favicon.ico" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="./img/apple-touch-icon-144x144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="./img/apple-touch-icon-72x72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="./img/apple-touch-icon-precomposed.png">
<link rel="stylesheet" href="./css/knacss.css" media="all">
<link rel="stylesheet" href="./css/style.css" media="all">
<!-- Light Theme -->
<link rel="stylesheet" href="./css/style-light.css" media="all" title="light-style">
<!-- Dark Theme -->
<link rel="alternate stylesheet" href="./css/style-dark.css" media="all" title="dark-style">
<script>
top["bookmarklet-url@inthepoche.com"] = ''
+'<!DOCTYPE html>'
+'<html>'
+'<head>'
+'<title>poche it !</title>'
+'<link rel="icon" href="{$poche_url}img/favicon.ico" />'
+'</head>'
+'<body>'
+'<script>'
+'window.onload=function(){'
+'window.setTimeout(function(){'
+'history.back();'
+'},250);'
+'};'
+'</scr'+'ipt>'
+'</body>'
+'</html>'
;
</script>
{% include '_head.twig' %}
{% include '_bookmarklet.twig' %}
</head>
<body class="light-style">
<header>
<h1><a href="/"><img src="./img/logo.png" alt="logo poche" /></a>poche</h1>
</header>
{% include '_top.twig' %}
<div id="main">
{% block menu %}{% endblock %}
{% block precontent %}{% endblock %}
{% block messages %}{% endblock %}
{% block content %}{% endblock %}
{% block js %}{% endblock %}
</div>
<footer class="mr2 mt3 smaller">
<p>powered by <a href="http://inthepoche.com">poche</a></p>
</footer>
{% include '_footer.twig' %}
</body>
</html>

View File

@ -1,5 +1,15 @@
{% extends "layout.twig" %}
{% block title %}Login{% endblock %}
{% block messages %}
<div class="messages">
<ul>
{% for error in errors %}
<li>{{ error.value|e }}</li>
{% endfor %}
</ul>
</div>
{% endblock %}
{% block content %}
<form method="post" action="?login" name="loginform">
<fieldset class="w500p center">