routing for API, trying to respect #414

This commit is contained in:
Nicolas Lœuillet 2015-01-29 16:56:58 +01:00
parent 589dce52c6
commit f8bf895254
17 changed files with 174 additions and 469 deletions

View file

@ -20,8 +20,7 @@ class AppKernel extends Kernel
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new Wallabag\CoreBundle\WallabagCoreBundle(),
new Wallabag\ApiBundle\WallabagApiBundle(),
new Wallabag\CoreBundle\WallabagCoreBundle()
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {

View file

@ -10,7 +10,12 @@ doc-api:
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
prefix: /api/doc
wallabag_api:
resource: "@WallabagApiBundle/Controller/"
type: annotation
prefix: /api
#wallabag_api:
# resource: "@WallabagApiBundle/Controller/"
# type: annotation
# prefix: /api
rest :
type : rest
resource : "routing_rest.yml"
prefix : /api

View file

@ -0,0 +1,3 @@
Rest_Wallabag:
type : rest
resource: "@WallabagCoreBundle/Resources/config/routing_rest.yml"

View file

@ -1,63 +0,0 @@
<?php
namespace Wallabag\ApiBundle\Controller;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Wallabag\CoreBundle\Entity\Entries;
use FOS\RestBundle\Controller\Annotations\Get;
use FOS\RestBundle\Controller\Annotations\Delete;
use FOS\RestBundle\Controller\Annotations\Patch;
use Wallabag\CoreBundle\Entity\Users;
class EntryController extends Controller
{
/**
* Fetches an entry for a given user
*
* @Get("/u/{user}/entry/{entry}")
* @ApiDoc(
* requirements={
* {"name"="user", "dataType"="string", "requirement"="\w+", "description"="The user ID"},
* {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
* }
* )
* @return Entries
*/
public function getAction(Users $user, Entries $entry)
{
return $entry;
}
/**
* Deletes an entry for a given user
*
* @Delete("/u/{user}/entry/{entry}")
* @ApiDoc(
* requirements={
* {"name"="user", "dataType"="string", "requirement"="\w+", "description"="The user ID"},
* {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
* }
* )
*/
public function deleteAction(Users $user, Entries $entry)
{
}
/**
* Changes several properties of an entry. I.E tags, archived, starred and deleted status
*
* @Patch("/u/{user}/entry/{entry}")
* @ApiDoc(
* requirements={
* {"name"="user", "dataType"="string", "requirement"="\w+", "description"="The user ID"},
* {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
* }
* )
*/
public function patchAction(Users $user, Entries $entry)
{
}
}

View file

@ -1,9 +0,0 @@
<?php
namespace Wallabag\ApiBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class WallabagApiBundle extends Bundle
{
}

View file

@ -17,12 +17,4 @@ class StaticController extends Controller
array()
);
}
/**
* @Route("/", name="homepage")
*/
public function apiAction()
{
return $this->redirect($this->generateUrl('nelmio_api_doc_index'));
}
}

View file

@ -0,0 +1,157 @@
<?php
namespace Wallabag\CoreBundle\Controller;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use FOS\RestBundle\Controller\Annotations\View;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Wallabag\CoreBundle\Entity\Entries;
use Wallabag\CoreBundle\Entity\Tags;
use Wallabag\CoreBundle\Entity\Users;
class WallabagRestController
{
/**
* Fetches all entries
*
* @ApiDoc(
* )
* @return Entries
*/
public function getEntriesAction()
{
}
/**
* Fetches an entry
*
* @ApiDoc(
* requirements={
* {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
* }
* )
* @return Entries
*/
public function getEntryAction(Entries $entry)
{
return $entry;
}
/**
* Deletes an entry
*
* @ApiDoc(
* requirements={
* {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
* }
* )
*/
public function deleteEntriesAction(Entries $entry)
{
}
/**
* Changes several properties of an entry. I.E tags, archived, starred and deleted status
*
* @ApiDoc(
* requirements={
* {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
* }
* )
*/
public function patchEntriesAction(Entries $entry)
{
}
/**
* Saves a new entry
*
* @ApiDoc(
* )
*/
public function postEntriesAction()
{
}
/**
* Gets tags for an entry
*
* @ApiDoc(
* requirements={
* {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
* }
* )
*/
public function getEntriesTagsAction(Entries $entry) {
}
/**
* Saves new tag for an entry
*
* @ApiDoc(
* requirements={
* {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
* }
* )
*/
public function postEntriesTagsAction(Entries $entry) {
}
/**
* Remove tag for an entry
*
* @ApiDoc(
* requirements={
* {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"},
* {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
* }
* )
*/
public function deleteEntriesTagsAction(Entries $entry, Tags $tag)
{
}
/**
* Gets tags for a user
*
* @ApiDoc(
* )
*/
public function getTagsAction() {
}
/**
* Gets one tag
*
* @ApiDoc(
* {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"}
* )
*/
public function getTagAction(Tags $tag) {
}
/**
* Delete tag
*
* @ApiDoc(
* requirements={
* {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"}
* }
* )
*/
public function deleteTagAction(Tags $tag)
{
}
}

View file

@ -0,0 +1,4 @@
entries:
type: rest
resource: "WallabagCoreBundle:WallabagRest"
name_prefix: api_

View file

@ -1,39 +0,0 @@
<link rel="apple-touch-icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-152.png" sizes="152x152">
<link rel="icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-152.png" sizes="152x152">
<link rel="apple-touch-icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-144.png" sizes="144x144">
<link rel="icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-144.png" sizes="144x144">
<link rel="apple-touch-icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-120.png" sizes="120x120">
<link rel="icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-120.png" sizes="120x120">
<link rel="apple-touch-icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-114.png" sizes="114x114">
<link rel="icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-114.png" sizes="114x114">
<link rel="apple-touch-icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-76.png" sizes="76x76">
<link rel="icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-76.png" sizes="76x76">
<link rel="apple-touch-icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-72.png" sizes="72x72">
<link rel="icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-72.png" sizes="72x72">
<link rel="apple-touch-icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-57.png" sizes="57x57">
<link rel="icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon-57.png" sizes="57x57">
<link rel="apple-touch-icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon.png">
<link rel="icon" type="image/png" href="{{ poche_url }}themes/_global/img/appicon/apple-touch-icon.png">
<link rel="shortcut icon" type="image/x-icon" href="{{ poche_url }}themes/_global/img/appicon/favicon.ico" sizes="16x16">
<link rel="stylesheet" href="{{ poche_url }}themes/{{theme}}/css/ratatouille.css" media="all">
<link rel="stylesheet" href="{{ poche_url }}themes/{{theme}}/css/font.css" media="all">
<link rel="stylesheet" href="{{ poche_url }}themes/{{theme}}/css/main.css" media="all">
<link rel="stylesheet" href="{{ poche_url }}themes/{{theme}}/css/messages.css" media="all">
<link rel="stylesheet" href="{{ poche_url }}themes/{{theme}}/css/print.css" media="print">
<script src="{{ poche_url }}themes/_global/js/jquery-2.0.3.min.js"></script>
<script src="{{ poche_url }}themes/_global/js/autoClose.js"></script>
<script src="{{ poche_url }}themes/{{theme}}/js/jquery.cookie.js"></script>
<script src="{{ poche_url }}themes/{{theme}}/js/init.js"></script>
<script src="{{ poche_url }}themes/_global/js/saveLink.js"></script>
<script src="{{ poche_url }}themes/_global/js/popupForm.js"></script>
<script src="{{ poche_url }}themes/{{theme}}/js/closeMessage.js"></script>

View file

@ -1,17 +0,0 @@
<button id="menu" class="icon icon-menu desktopHide"><span>Menu</span></button>
<ul id="links" class="links">
<li><a href="./" {% if view == 'home' %}class="current"{% endif %}>{% trans "unread" %}</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 style="position: relative;"><a href="javascript: void(null);" id="bagit">{% trans "save a link" %}</a>
{% include '_pocheit-form.twig' %}
</li>
<li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans "search" %}</a>
{% include '_search-form.twig' %}
</li>
<li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
<li><a href="./?view=about" {% if view == 'about' %}class="current"{% endif %}>{% trans "about" %}</a></li>
<li><a class="icon icon-power" href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
</ul>

View file

@ -1,10 +0,0 @@
<div id="bagit-form" class="messages info popup-form">
<form method="get" action="index.php" target="_blank" id="bagit-form-form">
<h2>{% trans "Save a link" %}</h2>
<a href="javascript: void(null);" id="bagit-form-close" class="close-button--popup close-button">&times;</a>
<input type="hidden" name="autoclose" value="1" />
<input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" />
<span id="add-link-result"></span>
<input type="submit" value="{% trans "save link!" %}" />
</form>
</div>

View file

@ -1,9 +0,0 @@
<div id="search-form" class="messages info popup-form">
<form method="get" action="index.php">
<h2>{%trans "Search" %}</h2>
<a href="javascript: void(null);" id="search-form-close" class="close-button--popup close-button">&times;</a>
<input type="hidden" name="view" value="search"></input>
<input required placeholder="{% trans "Enter your search here" %}" type="text" name="search" id="searchfield"><br>
<input id="submit-search" type="submit" value="{% trans "Search" %}"></input>
</form>
</div>

View file

@ -1,7 +0,0 @@
<header class="w600p center mbm">
<h1 class="logo">
{% if view == 'home' %}{% block logo %}<img width="100" height="100" src="{{ poche_url }}themes/{{theme}}/img/logo-w.png" alt="wallabag logo" />{% endblock %}
{% else %}<a href="./" title="{% trans "return home" %}" >{{ block('logo') }}</a>
{% endif %}
</h1>
</header>

View file

@ -1,84 +0,0 @@
{% extends "layout.twig" %}
{% block title %}{% trans "About" %}{% endblock %}
{% block menu %}
{% include '_menu.twig' %}
{% endblock %}
{% block content %}
<h2>{% trans "About wallabag" %}</h2>
<dl>
<dt>{% trans "Project website" %}</dt>
<dd><a href="https://www.wallabag.org">https://www.wallabag.org</a></dd>
<dt>{% trans "Main developer" %}</dt>
<dd><a href="mailto:nicolas@loeuillet.org">Nicolas Lœuillet</a> — <a href="http://cdetc.fr">{% trans "website" %}</a></dd>
<dt>{% trans "Contributors:" %}</dt>
<dd><a href="https://github.com/wallabag/wallabag/graphs/contributors">{% trans "on Github" %}</a></dd>
<dt>{% trans "Bug reports" %}</dt>
<dd><a href="https://support.wallabag.org">{% trans "On our support website" %}</a> {% trans "or" %} <a href="https://github.com/wallabag/wallabag/issues">{% trans "on Github" %}</a></dd>
<dt>{% trans "License" %}</dt>
<dd><a href="http://en.wikipedia.org/wiki/MIT_License">MIT</a></dd>
<dt>{% trans "Version" %}</dt>
<dd>{{ constant('WALLABAG') }}</dd>
</dl>
<p>{% trans "wallabag is a read-it-later application: you can save a web page by keeping only content. Elements like ads or menus are deleted." %}</p>
<h2>{% trans "Getting help" %}</h2>
<dl>
<dt>{% trans "Documentation" %}</dt>
<dd><a href="docs/">Offline documentation</a> and <a href="https://doc.wallabag.org/">online documentation</a> (up to date)</dd>
<dt>{% trans "Support" %}</dt>
<dd><a href="http://support.wallabag.org/">http://support.wallabag.org/</a></dd>
</dl>
<h2>{% trans "Helping wallabag" %}</h2>
<p>{% trans "wallabag is free and opensource. You can help us:" %}</p>
<dl>
<dt><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb">{% trans "via Paypal" %}</a></dt>
<dt><a href="https://flattr.com/thing/1265480">{% trans "via Flattr" %}</a></dt>
</dl>
<h2>{% trans "Credits" %}</h2>
<dl>
<dt>PHP Readability</dt>
<dd><a href="https://bitbucket.org/fivefilters/php-readability">https://bitbucket.org/fivefilters/php-readability</a></dd>
<dt>Full Text RSS</dt>
<dd><a href="http://code.fivefilters.org/full-text-rss/src">http://code.fivefilters.org/full-text-rss/src</a></dd>
<dt>logo by Maylis Agniel</dt>
<dd><a href="https://github.com/wallabag/logo">https://github.com/wallabag/logo</a></dd>
<dt>icons</dt>
<dd><a href="http://icomoon.io">http://icomoon.io</a></dd>
<dt>PHP Simple HTML DOM Parser</dt>
<dd><a href="http://simplehtmldom.sourceforge.net/">http://simplehtmldom.sourceforge.net/</a></dd>
<dt>Session</dt>
<dd><a href="https://github.com/tontof/kriss_feed/blob/master/src/class/Session.php">https://github.com/tontof/kriss_feed/blob/master/src/class/Session.php</a></dd>
<dt>Twig</dt>
<dd><a href="http://twig.sensiolabs.org">http://twig.sensiolabs.org</a></dd>
<dt>Flash messages</dt>
<dd><a href="https://github.com/plasticbrain/PHP-Flash-Messages">https://github.com/plasticbrain/PHP-Flash-Messages</a></dd>
<dt>Pagination</dt>
<dd><a href="https://github.com/daveismyname/pagination">https://github.com/daveismyname/pagination</a></dd>
<dt>PHPePub</dt>
<dd><a href="https://github.com/Grandt/PHPePub/">https://github.com/Grandt/PHPePub/</a></dd>
</dl>
{% endblock %}

View file

@ -1,81 +0,0 @@
{% extends "layout.twig" %}
{% block title %}
{% if view == 'fav' %}
{% trans "favorites" %}
{% elseif view == 'archive' %}
{% trans "archive" %}
{% else %}
{% trans "unread" %}
{% endif %}
{% endblock %}
{% block menu %}
{% include '_menu.twig' %}
{% endblock %}
{% block content %}
{% if tag %}
<h3>{% trans "Tag" %}: <b>{{ tag.value }}</b></h3>
{% endif %}
{% if entries is empty %}
<div class="messages warning"><p>{% trans "No articles found." %}</p></div>
{% else %}
<div>
{% include '_display-mode.twig' %}
{% include '_sorting.twig' %}
</div>
{% block pager %}
{% if nb_results > 1 %}
<div class="results">
<div class="nb-results">{{ nb_results }} {% trans "results" %}{% if search_term is defined %} {% trans %}found for « {{ search_term }} »{% endtrans %}{% endif %}</div>
{{ page_links | raw }}
</div>
{% elseif nb_results == 1 %}
{% if search_term is defined %}
<div class="results">
<div class="nb-results">{% trans "Only one result found for " %} « {{ search_term }} »</div>
</div>
{% endif %}
{% endif %}
{% endblock %}
<div id="list-entries" class="list-entries">
{% for entry in entries %}
<div id="entry-{{ entry.id|e }}" class="entrie">
<h2><a href="index.php?view=view&amp;id={{ entry.id|e }}">{{ entry.title|raw }}</a></h2>
{% if entry.content| getReadingTime > 0 %}
<div class="estimatedTime"><span class="tool reading-time">{% trans "estimated reading time :" %} {{ entry.content| getReadingTime }} min</span></div>
{% else %}
<div class="estimatedTime"><span class="tool reading-time">{% trans "estimated reading time :" %} <small class="inferieur">&lt;</small> 1 min</span></div>
{% endif %}
<ul class="tools links">
<li><a title="{% trans "Toggle mark as read" %}" class="tool icon-check icon {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="./?action=toggle_archive&amp;id={{ entry.id|e }}"><span>{% trans "Toggle mark as read" %}</span></a></li>
<li><a title="{% trans "toggle favorite" %}" class="tool icon-star icon {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="./?action=toggle_fav&amp;id={{ entry.id|e }}"><span>{% trans "toggle favorite" %}</span></a></li>
<li><a title="{% trans "delete" %}" class="tool delete icon-trash icon" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "delete" %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.url | e | getDomain }}</span></a></li>
</ul>
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
</div>
{% endfor %}
</div>
{{ block('pager') }}
{% if view == 'home' %}{% if nb_results > 1 %}<p><a title="{% trans "Mark all the entries as read" %}" href="./?action=archive_all">{% trans "Mark all the entries as read" %}</a></p>{% endif %}{% endif %}
{% if searchterm is defined %}<a title="{% trans "Tag these results as" %} {{ searchterm }}" href="./?action=add_tag&search={{ searchterm }}">{% trans "Tag these results as" %} {{ searchterm }}</a>{% endif %}<br />
{% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}<br />
{% if tag %}<a title="{% trans "Mark all articles from this tag as read" %}" href="./?action=toggle_archive&amp;tag_id={{ tag.id }}">{% trans "Mark all articles from this tag as read" %}</a><br />{% endif %}
{% if tag %}
{% if constant('EPUB') == 1 %}<a title="{% trans "Download the articles from this tag in an epub file" %}" href="./?epub&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download as ePub3" %}</a>{% endif %}
{% if constant('MOBI') == 1 %}<a title="{% trans "Download the articles from this tag in a mobi file" %}" href="./?mobi&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download as Mobi" %}</a>{% endif %}
{% if constant('PDF') == 1 %}<a title="{% trans "Download the articles from this tag in a pdf file" %}" href="./?pdf&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download as PDF" %}</a>{% endif %}
{% elseif searchterm is defined %}
{% if constant('EPUB') == 1 %}<a title="{% trans "Download the articles from this search in an epub" %}" href="./?epub&amp;method=search&amp;value={{ searchterm }}">{% trans "Download as ePub3" %}</a>{% endif %}
{% if constant('MOBI') == 1 %}<a title="{% trans "Download the articles from this search in a mobi file" %}" href="./?mobi&amp;method=search&amp;value={{ searchterm }}">{% trans "Download as Mobi" %}</a>{% endif %}
{% if constant('PDF') == 1 %}<a title="{% trans "Download the articles from this search in a pdf file" %}" href="./?pdf&amp;method=search&amp;value={{ searchterm }}">{% trans "Download as PDF" %}</a>{% endif %}
{% else %}
{% if constant('EPUB') == 1 %}<a title="{% trans "Download the articles from this category in an epub" %}" href="./?epub&amp;method=category&amp;value={{ view }}">{% trans "Download as ePub3" %}</a>{% endif %}
{% if constant('MOBI') == 1 %}<a title="{% trans "Download the articles from this category in a mobi file" %}" href="./?mobi&amp;method=category&amp;value={{ view }}">{% trans "Download as Mobi" %}</a>{% endif %}
{% if constant('PDF') == 1 %}<a title="{% trans "Download the articles from this category in a pdf file" %}" href="./?pdf&amp;method=category&amp;value={{ view }}">{% trans "Download as PDF" %}</a>{% endif %}
{% endif %}
{% endif %}
{% endblock %}

View file

@ -1,34 +0,0 @@
<!DOCTYPE html>
<!--[if lte IE 6]><html class="no-js ie6 ie67 ie678" lang="{{ lang }}"><![endif]-->
<!--[if lte IE 7]><html class="no-js ie7 ie67 ie678" lang="{{ lang }}"><![endif]-->
<!--[if IE 8]><html class="no-js ie8 ie678" lang="{{ lang }}"><![endif]-->
<!--[if gt IE 8]><html class="no-js" lang="{{ lang }}"><![endif]-->
<html lang="{{ lang }}">
<head>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=10">
<![endif]-->
<title>{% block title %}{% endblock %} - wallabag</title>
{% include '_head.twig' %}
{% include '_bookmarklet.twig' %}
</head>
<body>
{% include '_top.twig' %}
<div id="main">
{% block menu %}{% endblock %}
{% block precontent %}{% endblock %}
{% block messages %}
{% include '_messages.twig' %}
{% if includeImport %}
{% include '_import.twig' %}
{% endif %}
{% endblock %}
<div id="content" class="w600p center">
{% block content %}{% endblock %}
</div>
</div>
{% include '_footer.twig' %}
</body>
</html>

View file

@ -1,102 +0,0 @@
{% extends "layout.twig" %}
{% block menu %}
{% include '_menu.twig' %}
{% endblock %}
{% block title %}{{ entry.title|raw }} ({{ entry.url | e | getDomain }}){% endblock %}
{% block content %}
{% include '_highlight.twig' %}
<div id="article_toolbar">
<ul class="links">
<li class="topPosF"><a href="#top" title="{% trans "Back to top" %}" class="tool top icon icon-arrow-up-thick"><span>{% trans "Back to top" %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.url | e | getDomain }}</span></a></li>
<li><a title="{% trans "Mark as read" %}" class="tool icon icon-check {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="javascript: void(null);" id="markAsRead"><span>{% trans "Toggle mark as read" %}</span></a></li>
<li><a title="{% trans "Favorite" %}" class="tool icon icon-star {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="javascript: void(null);" id="setFav"><span>{% trans "Toggle favorite" %}</span></a></li>
<li><a title="{% trans "Delete" %}" class="tool delete icon icon-trash" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "Delete" %}</span></a></li>
{% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans "Tweet" %}"><span>{% trans "Tweet" %}</span></a></li>{% endif %}
{% if constant('SHARE_MAIL') == 1 %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans "Email" %}"><span>{% trans "Email" %}</span></a></li>{% endif %}
{% if constant('SHARE_SHAARLI') == 1 %}<li><a href="{{ constant('SHAARLI_URL') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans "shaarli" %}"><span>{% trans "shaarli" %}</span></a></li>{% endif %}
{% if constant('SHARE_DIASPORA') == 1 %}<li><a href="{{ constant('DIASPORA_URL') }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank" class="tool diaspora icon-image icon-image--diaspora" title="{% trans "diaspora" %}"><span>{% trans "diaspora" %}</span></a></li>{% endif %}
{% if constant('FLATTR') == 1 %}{% if flattr.status == constant('FLATTRABLE') %}<li><a href="http://flattr.com/submit/auto?url={{ entry.url }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span></a></li>{% elseif flattr.status == constant('FLATTRED') %}<li><a href="{{ flattr.flattrItemURL }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span> ({{ flattr.numFlattrs }})</a></li>{% endif %}{% endif %}
{% if constant('CARROT') == 1 %}<li><a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" class="tool carrot icon-image icon-image--carrot" target="_blank" title="{% trans "carrot" %}"><span>Carrot</span></a></li>{% endif %}
{% if constant('SHOW_PRINTLINK') == 1 %}<li><a title="{% trans "Print" %}" class="tool icon icon-print" href="javascript: window.print();"><span>{% trans "Print" %}</span></a></li>{% endif %}
{% if constant('EPUB') == 1 %}<li><a href="./?epub&amp;method=id&amp;value={{ entry.id|e }}" title="Generate ePub file">EPUB</a></li>{% endif %}
{% if constant('MOBI') == 1 %}<li><a href="./?mobi&amp;method=id&amp;value={{ entry.id|e }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
{% if constant('PDF') == 1 %}<li><a href="./?pdf&amp;method=id&amp;value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %}
<li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans "Does this article appear wrong?" %}" class="tool bad-display icon icon-delete"><span>{% trans "Does this article appear wrong?" %}</span></a></li>
</ul>
</div>
<div id="article">
<header class="mbm">
<h1>{{ entry.title|raw }}</h1>
</header>
<aside class="tags">
tags: {% for tag in tags %}<a href="./?view=tag&amp;id={{ tag.id }}">{{ tag.value }}</a> {% endfor %}<a href="./?view=edit-tags&amp;id={{ entry.id|e }}" title="{% trans "Edit tags" %}">✎</a>
</aside>
<article>
{{ content | raw }}
</article>
</div>
<script src="{{ poche_url }}themes/_global/js/restoreScroll.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// toggle read property of current article
$('#markAsRead').click(function(){
$("body").css("cursor", "wait");
$.ajax( { url: './?action=toggle_archive&id={{ entry.id|e }}' }).done(
function( data ) {
if ( data == '1' ) {
if ( $('#markAsRead').hasClass("archive-off") ) {
$('#markAsRead').removeClass("archive-off");
$('#markAsRead').addClass("archive");
}
else {
$('#markAsRead').removeClass("archive");
$('#markAsRead').addClass("archive-off");
}
}
else {
alert('Error! Pls check if you are logged in.');
}
});
$("body").css("cursor", "auto");
});
// toggle favorite property of current article
$('#setFav').click(function(){
$("body").css("cursor", "wait");
$.ajax( { url: './?action=toggle_fav&id={{ entry.id|e }}' }).done(
function( data ) {
if ( data == '1' ) {
if ( $('#setFav').hasClass("fav-off") ) {
$('#setFav').removeClass("fav-off");
$('#setFav').addClass("fav");
}
else {
$('#setFav').removeClass("fav");
$('#setFav').addClass("fav-off");
}
}
else {
alert('Error! Pls check if you are logged in.');
}
});
$("body").css("cursor", "auto");
});
$(window).scroll(function(e){
var scrollTop = $(window).scrollTop();
var docHeight = $(document).height();
var scrollPercent = (scrollTop) / (docHeight);
var scrollPercentRounded = Math.round(scrollPercent*100)/100;
savePercent({{ entry.id|e }}, scrollPercentRounded);
});
retrievePercent({{ entry.id|e }});
$(window).resize(function(){
retrievePercent({{ entry.id|e }});
});
});
</script>
{% endblock %}