From 24152cdb5e48edc5128082b285736b06ebda3c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 15 Feb 2016 22:12:50 +0100 Subject: Fix #1597: first draft to create new client for the API --- .../CoreBundle/Controller/DeveloperController.php | 38 ++++++++++++++++++++++ .../themes/material/Developer/client.html.twig | 9 +++++ .../themes/material/Developer/index.html.twig | 9 +++++ .../views/themes/material/layout.html.twig | 1 + 4 files changed, 57 insertions(+) create mode 100644 src/Wallabag/CoreBundle/Controller/DeveloperController.php create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php new file mode 100644 index 00000000..3cb86881 --- /dev/null +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -0,0 +1,38 @@ +render('WallabagCoreBundle:Developer:index.html.twig'); + } + + /** + * @param Request $request + * + * @Route("/developer/client/create", name="create_client") + */ + public function createClientAction(Request $request) + { + $clientManager = $this->container->get('fos_oauth_server.client_manager.default'); + $client = $clientManager->createClient(); + $client->setRedirectUris(array('http://www.example.com')); + $client->setAllowedGrantTypes(array('token', 'authorization_code')); + $clientManager->updateClient($client); + + return $this->render('WallabagCoreBundle:Developer:client.html.twig', array( + 'client_id' => $client->getPublicId(), + )); + } +} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig new file mode 100644 index 00000000..edebc7ee --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig @@ -0,0 +1,9 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}New client{% endtrans %}{% endblock %} + +{% block content %} + + Client ID: {{ client_id }} + +{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig new file mode 100644 index 00000000..9e06005f --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig @@ -0,0 +1,9 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}Developer{% endtrans %}{% endblock %} + +{% block content %} + + Create a new client + +{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index d7bfa7ae..46aab5dc 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig @@ -116,6 +116,7 @@

{% trans %}powered by{% endtrans %} wallabag

{% trans %}About{% endtrans %} + {% trans %}Developer{% endtrans %}
-- cgit v1.2.3 From b6321bed7b8b8ba34e23a3d0c048f7d05ab309bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 16 Feb 2016 07:55:18 +0100 Subject: Added developer documentation --- .../CoreBundle/Controller/DeveloperController.php | 17 ++++++ .../themes/material/Developer/client.html.twig | 19 +++++- .../themes/material/Developer/howto_app.html.twig | 68 ++++++++++++++++++++++ .../themes/material/Developer/index.html.twig | 26 ++++++++- .../themes/material/Static/quickstart.html.twig | 4 ++ 5 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index 3cb86881..edbcec4b 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -12,6 +12,8 @@ class DeveloperController extends Controller * @param Request $request * * @Route("/developer", name="developer") + * + * @return \Symfony\Component\HttpFoundation\Response */ public function indexAction(Request $request) { @@ -22,6 +24,8 @@ class DeveloperController extends Controller * @param Request $request * * @Route("/developer/client/create", name="create_client") + * + * @return \Symfony\Component\HttpFoundation\Response */ public function createClientAction(Request $request) { @@ -33,6 +37,19 @@ class DeveloperController extends Controller return $this->render('WallabagCoreBundle:Developer:client.html.twig', array( 'client_id' => $client->getPublicId(), + 'client_secret' => $client->getSecret(), )); } + + /** + * @param Request $request + * + * @Route("/developer/howto/first-app", name="howto-firstapp") + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function howtoFirstAppAction(Request $request) + { + return $this->render('WallabagCoreBundle:Developer:howto_app.html.twig'); + } } diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig index edebc7ee..5ab35700 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig @@ -1,9 +1,24 @@ {% extends "WallabagCoreBundle::layout.html.twig" %} -{% block title %}{% trans %}New client{% endtrans %}{% endblock %} +{% block title %}{% trans %}New application{% endtrans %}{% endblock %} {% block content %} +
+ +
{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig new file mode 100644 index 00000000..2db15b16 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig @@ -0,0 +1,68 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}How to create my first application{% endtrans %}{% endblock %} + +{% block content %} +
+
+
+ +
+

The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.

+

You need a token to communicate between your 3rd application and wallabag API.

+

To create this token, you need to create a new client.

+

Now, create your token (replace client_id, client_secret, username and password with the good values):

+

+ +

+http POST http://v2.wallabag.org/oauth/v2/token \
+    grant_type=password \
+    client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \
+    client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \
+    username=yourUsername \
+    password=yourPassw0rd
+                        
+ +

+

The API will return a response like this:

+

+ +

+HTTP/1.1 200 OK
+Cache-Control: no-store, private
+Connection: close
+Content-Type: application/json
+Date: Tue, 06 Oct 2015 18:24:03 GMT
+Host: localhost:8000
+Pragma: no-cache
+X-Debug-Token: be00a1
+X-Debug-Token-Link: /profiler/be00a1
+X-Powered-By: PHP/5.5.9-1ubuntu4.13
+{
+    "access_token": "ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw",
+    "expires_in": 3600,
+    "refresh_token": "ODBjODU1NWUwNmUzZTBkNDQ5YWVlZTVlMjQ2Y2I0OWM2NTM1ZGM2M2Y3MDhjMTViM2U2MzYxYzRkMDk5ODRlZg",
+    "scope": null,
+    "token_type": "bearer"
+}
+                        
+ +

+

The access_token is useful to do a call to the API endpoint. For example:

+

+ +

+http GET http://v2.wallabag.org/api/entries.json \
+    "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"
+                        
+ +

+

This call will return all the entries for your user.

+

If you want to see all the API endpoints, you can have a look to our API documentation.

+

Back to Developer main page

+
+ +
+
+
+{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig index 9e06005f..36d5c2bd 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig @@ -3,7 +3,31 @@ {% block title %}{% trans %}Developer{% endtrans %}{% endblock %} {% block content %} +
+
+
+ +
+

Welcome to the wallabag API

+ +

Documentation

+ + + +

My applications

+ + +
+ +
+
+
- Create a new client {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig index aff8dd2b..6c786951 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig @@ -28,6 +28,10 @@
  • {% trans %}Migrate from Pocket{% endtrans %}
  • {% trans %}Migrate from wallabag v1{% endtrans %}
  • +

    {% trans %}Developers{% endtrans %}

    +

    {% trans %}Full documentation{% endtrans %}

    -

    My applications

    +

    My clients

    -- cgit v1.2.3 From abc329453be6381bcf4d1b0dfd9f698312ed3b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 16 Feb 2016 13:49:25 +0100 Subject: Enhance documentation and create a form to create a new client --- .../CoreBundle/Controller/DeveloperController.php | 38 ++++-- src/Wallabag/CoreBundle/Form/Type/ClientType.php | 44 +++++++ .../Resources/public/themes/_global/css/prism.css | 131 +++++++++++++++++++++ .../Resources/public/themes/_global/js/prism.js | 9 ++ .../themes/material/Developer/client.html.twig | 21 ++-- .../material/Developer/client_parameters.html.twig | 25 ++++ .../themes/material/Developer/howto_app.html.twig | 32 ++--- .../themes/material/Developer/index.html.twig | 12 +- 8 files changed, 267 insertions(+), 45 deletions(-) create mode 100644 src/Wallabag/CoreBundle/Form/Type/ClientType.php create mode 100644 src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css create mode 100644 src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index edbcec4b..3b9da318 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -5,17 +5,17 @@ namespace Wallabag\CoreBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Wallabag\ApiBundle\Entity\Client; +use Wallabag\CoreBundle\Form\Type\ClientType; class DeveloperController extends Controller { /** - * @param Request $request - * * @Route("/developer", name="developer") * * @return \Symfony\Component\HttpFoundation\Response */ - public function indexAction(Request $request) + public function indexAction() { return $this->render('WallabagCoreBundle:Developer:index.html.twig'); } @@ -29,26 +29,38 @@ class DeveloperController extends Controller */ public function createClientAction(Request $request) { - $clientManager = $this->container->get('fos_oauth_server.client_manager.default'); - $client = $clientManager->createClient(); - $client->setRedirectUris(array('http://www.example.com')); - $client->setAllowedGrantTypes(array('token', 'authorization_code')); - $clientManager->updateClient($client); + $em = $this->getDoctrine()->getManager(); + $client = new Client(); + $clientForm = $this->createForm(ClientType::class, $client); + $clientForm->handleRequest($request); + + if ($clientForm->isValid()) { + $client->setAllowedGrantTypes(array('token', 'authorization_code')); + $em->persist($client); + $em->flush(); + + $this->get('session')->getFlashBag()->add( + 'notice', + 'New client created.' + ); + + return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', array( + 'client_id' => $client->getPublicId(), + 'client_secret' => $client->getSecret(), + )); + } return $this->render('WallabagCoreBundle:Developer:client.html.twig', array( - 'client_id' => $client->getPublicId(), - 'client_secret' => $client->getSecret(), + 'form' => $clientForm->createView(), )); } /** - * @param Request $request - * * @Route("/developer/howto/first-app", name="howto-firstapp") * * @return \Symfony\Component\HttpFoundation\Response */ - public function howtoFirstAppAction(Request $request) + public function howtoFirstAppAction() { return $this->render('WallabagCoreBundle:Developer:howto_app.html.twig'); } diff --git a/src/Wallabag/CoreBundle/Form/Type/ClientType.php b/src/Wallabag/CoreBundle/Form/Type/ClientType.php new file mode 100644 index 00000000..79feae65 --- /dev/null +++ b/src/Wallabag/CoreBundle/Form/Type/ClientType.php @@ -0,0 +1,44 @@ +add('redirect_uris', UrlType::class, array('required' => true)) + ->add('save', SubmitType::class) + ; + + $builder->get('redirect_uris') + ->addModelTransformer(new CallbackTransformer( + function ($originalUri) { + return $originalUri; + }, + function ($submittedUri) { + return array($submittedUri); + } + )) + ; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Wallabag\ApiBundle\Entity\Client', + )); + } + + public function getBlockPrefix() + { + return 'client'; + } +} diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css b/src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css new file mode 100644 index 00000000..65075559 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css @@ -0,0 +1,131 @@ +/* http://prismjs.com/download.html?themes=prism-dark&languages=markup+css+clike+javascript+bash+php+yaml */ +/** + * prism.js Dark theme for JavaScript, CSS and HTML + * Based on the slides of the talk “/Reg(exp){2}lained/” + * @author Lea Verou + */ + +code[class*="language-"], +pre[class*="language-"] { + color: white; + background: none; + text-shadow: 0 -.1em .2em black; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +pre[class*="language-"], +:not(pre) > code[class*="language-"] { + background: hsl(30, 20%, 25%); +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; + border: .3em solid hsl(30, 20%, 40%); + border-radius: .5em; + box-shadow: 1px 1px .5em black inset; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .15em .2em .05em; + border-radius: .3em; + border: .13em solid hsl(30, 20%, 40%); + box-shadow: 1px 1px .3em -.1em black inset; + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: hsl(30, 20%, 50%); +} + +.token.punctuation { + opacity: .7; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol { + color: hsl(350, 40%, 70%); +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: hsl(75, 70%, 60%); +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string, +.token.variable { + color: hsl(40, 90%, 60%); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: hsl(350, 40%, 70%); +} + +.token.regex, +.token.important { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + +.token.deleted { + color: red; +} + diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js b/src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js new file mode 100644 index 00000000..0235e52d --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js @@ -0,0 +1,9 @@ +/* http://prismjs.com/download.html?themes=prism-dark&languages=markup+css+clike+javascript+bash+php+yaml */ +var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){g&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,b=y+v,k=d.slice(0,y+1),w=d.slice(b+1),_=[p,1];k&&_.push(k);var P=new a(i,c?n.tokenize(m,c):m,h);_.push(P),w&&_.push(w),Array.prototype.splice.apply(r,_)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(t)}}},a=n.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o="";for(var s in l.attributes)o+=(o?" ":"")+s+'="'+(l.attributes[s]||"")+'"';return"<"+l.tag+' class="'+l.classes.join(" ")+'" '+o+">"+l.content+""},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,l=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",n.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); +Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup; +Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); +Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}; +Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript; +!function(e){var t={variable:[{pattern:/\$?\(\([\w\W]+?\)\)/,inside:{variable:[{pattern:/(^\$\(\([\w\W]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/,operator:/--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\([^)]+\)|`[^`]+`/,inside:{variable:/^\$\(|^`|\)$|`$/}},/\$(?:[a-z0-9_#\?\*!@]+|\{[^}]+\})/i]};e.languages.bash={shebang:{pattern:/^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,alias:"important"},comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<\s*)(?:"|')?(\w+?)(?:"|')?\s*\r?\n(?:[\s\S])*?\r?\n\2/g,lookbehind:!0,inside:t},{pattern:/(["'])(?:\\\\|\\?[^\\])*?\1/g,inside:t}],variable:t.variable,"function":{pattern:/(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,lookbehind:!0},keyword:{pattern:/(^|\s|;|\||&)(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\s|;|\||&)/,lookbehind:!0},"boolean":{pattern:/(^|\s|;|\||&)(?:true|false)(?=$|\s|;|\||&)/,lookbehind:!0},operator:/&&?|\|\|?|==?|!=?|<<>|<=?|>=?|=~/,punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];]/};var a=t.variable[1].inside;a["function"]=e.languages.bash["function"],a.keyword=e.languages.bash.keyword,a.boolean=e.languages.bash.boolean,a.operator=e.languages.bash.operator,a.punctuation=e.languages.bash.punctuation}(Prism); +Prism.languages.php=Prism.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0}}),Prism.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),Prism.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(e){"php"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(a){return e.tokenStack.push(a),"{{{PHP"+e.tokenStack.length+"}}}"}))}),Prism.hooks.add("before-insert",function(e){"php"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),Prism.hooks.add("after-highlight",function(e){if("php"===e.language){for(var a,n=0;a=e.tokenStack[n];n++)e.highlightedCode=e.highlightedCode.replace("{{{PHP"+(n+1)+"}}}",Prism.highlight(a,e.grammar,"php").replace(/\$/g,"$$$$"));e.element.innerHTML=e.highlightedCode}}),Prism.hooks.add("wrap",function(e){"php"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'$1'))}),Prism.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:Prism.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/})); +Prism.languages.yaml={scalar:{pattern:/([\-:]\s*(![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\3[^\r\n]+)*)/,lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:/(\s*[:\-,[{\r\n?][ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#]+?(?=\s*:\s)/,lookbehind:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(\d{4}-\d\d?-\d\d?([tT]|[ \t]+)\d\d?:\d{2}:\d{2}(\.\d*)?[ \t]*(Z|[-+]\d\d?(:\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(:\d{2}(\.\d*)?)?)(?=[ \t]*($|,|]|}))/m,lookbehind:!0,alias:"number"},"boolean":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(true|false)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},"null":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(null|~)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},string:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=[ \t]*($|,|]|}))/m,lookbehind:!0},number:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im,lookbehind:!0},tag:/![^\s]+/,important:/[&*][\w]+/,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./}; diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig index 08d1cb15..061f4631 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig @@ -8,13 +8,20 @@
    -

    My client parameters

    -

    Here are your client parameters.

    -
      -
    • Client ID: {{ client_id }}
    • -
    • Client secret: {{ client_secret }}
    • -
    - Back to Developer main page +

    {% trans %}You will create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}

    + {{ form_start(form) }} + {{ form_errors(form) }} +
    + {{ form_label(form.redirect_uris) }} + {{ form_errors(form.redirect_uris) }} + {{ form_widget(form.redirect_uris) }} +
    + + + {% trans %}Back{% endtrans %} +
    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig new file mode 100644 index 00000000..8e3966b9 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig @@ -0,0 +1,25 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}Client parameters{% endtrans %}{% endblock %} + +{% block content %} +
    +
    +
    +
    +

    {% trans %}Here are your client parameters.{% endtrans %}

    +

    {% trans %}Make sure to copy these parameters now. You won’t be able to see them again!{% endtrans %}

    +
      +
    • {% trans %}Client ID:{% endtrans %}
      {{ client_id }}
    • +
    • {% trans %}Client secret:{% endtrans %}
      {{ client_secret }}
    • +
    + + {% trans %}Back{% endtrans %} + {% trans %}Read the howto "Create my first application"{% endtrans %} +
    +
    + +
    +
    + +{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig index 2db15b16..497bb308 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig @@ -2,6 +2,11 @@ {% block title %}{% trans %}How to create my first application{% endtrans %}{% endblock %} +{% block css %} + {{ parent() }} + +{% endblock %} + {% block content %}
    @@ -13,22 +18,16 @@

    To create this token, you need to create a new client.

    Now, create your token (replace client_id, client_secret, username and password with the good values):

    - -

    -http POST http://v2.wallabag.org/oauth/v2/token \
    +                    
    http POST http://v2.wallabag.org/oauth/v2/token \
         grant_type=password \
         client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \
         client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \
         username=yourUsername \
    -    password=yourPassw0rd
    -                        
    - + password=yourPassw0rd

    The API will return a response like this:

    - -

    -HTTP/1.1 200 OK
    +                    
    HTTP/1.1 200 OK
     Cache-Control: no-store, private
     Connection: close
     Content-Type: application/json
    @@ -44,25 +43,20 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13
         "refresh_token": "ODBjODU1NWUwNmUzZTBkNDQ5YWVlZTVlMjQ2Y2I0OWM2NTM1ZGM2M2Y3MDhjMTViM2U2MzYxYzRkMDk5ODRlZg",
         "scope": null,
         "token_type": "bearer"
    -}
    -                        
    - +}

    The access_token is useful to do a call to the API endpoint. For example:

    - -

    -http GET http://v2.wallabag.org/api/entries.json \
    -    "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"
    -                        
    - +
    http GET http://v2.wallabag.org/api/entries.json \
    +    "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"

    This call will return all the entries for your user.

    If you want to see all the API endpoints, you can have a look to our API documentation.

    -

    Back to Developer main page

    +

    {% trans %}Back{% endtrans %}

    + {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig index 3507b654..b983883f 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig @@ -8,18 +8,18 @@
    -

    Welcome to the wallabag API

    +

    {% trans %}Welcome to the wallabag API{% endtrans %}

    -

    Documentation

    +

    {% trans %}Documentation{% endtrans %}

    -

    My clients

    +

    {% trans %}Clients{% endtrans %}

    -- cgit v1.2.3 From 8a4690b6a56afd836c4d6ea7f640934fafa6c9cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 16 Feb 2016 20:18:59 +0100 Subject: add tests --- .../views/themes/baggy/Developer/client.html.twig | 31 +++++++++++ .../baggy/Developer/client_parameters.html.twig | 25 +++++++++ .../themes/baggy/Developer/howto_app.html.twig | 62 ++++++++++++++++++++++ .../views/themes/baggy/Developer/index.html.twig | 32 +++++++++++ .../Tests/Controller/DeveloperControllerTest.php | 29 ++++++++++ 5 files changed, 179 insertions(+) create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig create mode 100644 src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig new file mode 100644 index 00000000..061f4631 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig @@ -0,0 +1,31 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}New client{% endtrans %}{% endblock %} + +{% block content %} +
    +
    +
    + +
    +

    {% trans %}You will create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}

    + {{ form_start(form) }} + {{ form_errors(form) }} +
    + {{ form_label(form.redirect_uris) }} + {{ form_errors(form.redirect_uris) }} + {{ form_widget(form.redirect_uris) }} +
    + + + {% trans %}Back{% endtrans %} + +
    + +
    +
    +
    + +{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig new file mode 100644 index 00000000..8e3966b9 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig @@ -0,0 +1,25 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}Client parameters{% endtrans %}{% endblock %} + +{% block content %} +
    +
    +
    +
    +

    {% trans %}Here are your client parameters.{% endtrans %}

    +

    {% trans %}Make sure to copy these parameters now. You won’t be able to see them again!{% endtrans %}

    +
      +
    • {% trans %}Client ID:{% endtrans %}
      {{ client_id }}
    • +
    • {% trans %}Client secret:{% endtrans %}
      {{ client_secret }}
    • +
    + + {% trans %}Back{% endtrans %} + {% trans %}Read the howto "Create my first application"{% endtrans %} +
    +
    + +
    +
    +
    +{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig new file mode 100644 index 00000000..497bb308 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig @@ -0,0 +1,62 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}How to create my first application{% endtrans %}{% endblock %} + +{% block css %} + {{ parent() }} + +{% endblock %} + +{% block content %} +
    +
    +
    + +
    +

    The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.

    +

    You need a token to communicate between your 3rd application and wallabag API.

    +

    To create this token, you need to create a new client.

    +

    Now, create your token (replace client_id, client_secret, username and password with the good values):

    +

    +

    http POST http://v2.wallabag.org/oauth/v2/token \
    +    grant_type=password \
    +    client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \
    +    client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \
    +    username=yourUsername \
    +    password=yourPassw0rd
    +

    +

    The API will return a response like this:

    +

    +

    HTTP/1.1 200 OK
    +Cache-Control: no-store, private
    +Connection: close
    +Content-Type: application/json
    +Date: Tue, 06 Oct 2015 18:24:03 GMT
    +Host: localhost:8000
    +Pragma: no-cache
    +X-Debug-Token: be00a1
    +X-Debug-Token-Link: /profiler/be00a1
    +X-Powered-By: PHP/5.5.9-1ubuntu4.13
    +{
    +    "access_token": "ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw",
    +    "expires_in": 3600,
    +    "refresh_token": "ODBjODU1NWUwNmUzZTBkNDQ5YWVlZTVlMjQ2Y2I0OWM2NTM1ZGM2M2Y3MDhjMTViM2U2MzYxYzRkMDk5ODRlZg",
    +    "scope": null,
    +    "token_type": "bearer"
    +}
    +

    +

    The access_token is useful to do a call to the API endpoint. For example:

    +

    +

    http GET http://v2.wallabag.org/api/entries.json \
    +    "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"
    +

    +

    This call will return all the entries for your user.

    +

    If you want to see all the API endpoints, you can have a look to our API documentation.

    +

    {% trans %}Back{% endtrans %}

    +
    + +
    +
    +
    + +{% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig new file mode 100644 index 00000000..b983883f --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig @@ -0,0 +1,32 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{% trans %}Developer{% endtrans %}{% endblock %} + +{% block content %} +
    +
    +
    + +
    +

    {% trans %}Welcome to the wallabag API{% endtrans %}

    + +

    {% trans %}Documentation{% endtrans %}

    + + + +

    {% trans %}Clients{% endtrans %}

    + + +
    + +
    +
    +
    + + +{% endblock %} diff --git a/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php new file mode 100644 index 00000000..e5028f47 --- /dev/null +++ b/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php @@ -0,0 +1,29 @@ +logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/developer/client/create'); + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $form = $crawler->filter('button[type=submit]')->form(); + + $crawler = $client->submit($form); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertContains('Make sure to copy these parameters now.', $client->getResponse()->getContent()); + } +} -- cgit v1.2.3 From 5bc2da5628afe24525ce68cb840ea6c1d4bf951d Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 25 Feb 2016 16:06:13 +0100 Subject: Add password for auth --- src/Wallabag/CoreBundle/Controller/DeveloperController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index 3b9da318..4688aeef 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -35,7 +35,7 @@ class DeveloperController extends Controller $clientForm->handleRequest($request); if ($clientForm->isValid()) { - $client->setAllowedGrantTypes(array('token', 'authorization_code')); + $client->setAllowedGrantTypes(array('token', 'authorization_code','password')); $em->persist($client); $em->flush(); -- cgit v1.2.3 From 5bf8f3f164aa95f844a3f4faaa19987a2ea39a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 29 Feb 2016 21:28:37 +0100 Subject: Remove comments --- .../CoreBundle/Tests/Controller/DeveloperControllerTest.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php index e5028f47..204796ca 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php @@ -1,10 +1,5 @@ Date: Sat, 5 Mar 2016 20:04:19 +0100 Subject: Cleanup form - Avoid too much hidden data in the form (instead of manually define the submit button and hide the default, use the default one !) - Fix HTML syntax in client_parameters - Add developer link in baggy menu - Fix space between link in material footer --- src/Wallabag/CoreBundle/Controller/DeveloperController.php | 2 +- src/Wallabag/CoreBundle/Form/Type/ClientType.php | 2 +- .../Resources/views/themes/baggy/Developer/client.html.twig | 10 +++++----- .../views/themes/baggy/Developer/client_parameters.html.twig | 2 -- .../Resources/views/themes/baggy/Developer/howto_app.html.twig | 2 +- .../Resources/views/themes/baggy/Developer/index.html.twig | 1 - .../CoreBundle/Resources/views/themes/baggy/layout.html.twig | 1 + .../Resources/views/themes/material/Developer/client.html.twig | 10 +++++----- .../themes/material/Developer/client_parameters.html.twig | 2 -- .../views/themes/material/Developer/howto_app.html.twig | 2 +- .../Resources/views/themes/material/Developer/index.html.twig | 1 - .../Resources/views/themes/material/layout.html.twig | 1 + 12 files changed, 16 insertions(+), 20 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index 4688aeef..30cc8beb 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -35,7 +35,7 @@ class DeveloperController extends Controller $clientForm->handleRequest($request); if ($clientForm->isValid()) { - $client->setAllowedGrantTypes(array('token', 'authorization_code','password')); + $client->setAllowedGrantTypes(array('token', 'authorization_code', 'password')); $em->persist($client); $em->flush(); diff --git a/src/Wallabag/CoreBundle/Form/Type/ClientType.php b/src/Wallabag/CoreBundle/Form/Type/ClientType.php index 79feae65..cb6b5e65 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ClientType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ClientType.php @@ -15,7 +15,7 @@ class ClientType extends AbstractType { $builder ->add('redirect_uris', UrlType::class, array('required' => true)) - ->add('save', SubmitType::class) + ->add('save', SubmitType::class, array('label' => 'Create new client')) ; $builder->get('redirect_uris') diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig index 061f4631..5cbe1c39 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig @@ -8,20 +8,20 @@
    -

    {% trans %}You will create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}

    +

    {% trans %}You are about to create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}

    {{ form_start(form) }} {{ form_errors(form) }} +
    {{ form_label(form.redirect_uris) }} {{ form_errors(form.redirect_uris) }} {{ form_widget(form.redirect_uris) }}
    - {% trans %}Back{% endtrans %} - + {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }} + + {{ form_rest(form) }}
    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig index 8e3966b9..a2a28d50 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig @@ -17,8 +17,6 @@ {% trans %}Back{% endtrans %} {% trans %}Read the howto "Create my first application"{% endtrans %} - - diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig index 497bb308..88788776 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig @@ -58,5 +58,5 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13 - + {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig index b983883f..87dd4a5f 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig @@ -28,5 +28,4 @@ - {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig index 84604762..7f098066 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig @@ -56,6 +56,7 @@ {% endif %}
  • {% trans %}import{% endtrans %}
  • {% trans %}howto{% endtrans %}
  • +
  • {% trans %}Developer{% endtrans %}
  • {% trans %}about{% endtrans %}
  • {% trans %}logout{% endtrans %}
  • diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig index 061f4631..5cbe1c39 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig @@ -8,20 +8,20 @@
    -

    {% trans %}You will create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}

    +

    {% trans %}You are about to create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}

    {{ form_start(form) }} {{ form_errors(form) }} +
    {{ form_label(form.redirect_uris) }} {{ form_errors(form.redirect_uris) }} {{ form_widget(form.redirect_uris) }}
    - {% trans %}Back{% endtrans %} - + {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }} + + {{ form_rest(form) }}
    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig index 8e3966b9..a2a28d50 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig @@ -17,8 +17,6 @@ {% trans %}Back{% endtrans %} {% trans %}Read the howto "Create my first application"{% endtrans %} - - diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig index 497bb308..88788776 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig @@ -58,5 +58,5 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13 - + {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig index b983883f..87dd4a5f 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig @@ -28,5 +28,4 @@ - {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index 46aab5dc..82bd9a1d 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig @@ -117,6 +117,7 @@

    {% trans %}powered by{% endtrans %} wallabag

    {% trans %}About{% endtrans %} {% trans %}Developer{% endtrans %} +  -  -- cgit v1.2.3 From 9bf15f02695823652a0e783c915b039836f51626 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 5 Mar 2016 21:44:39 +0100 Subject: Add listing clients Rename route to be more consistive (ie: prefixed with developer_) --- .../CoreBundle/Controller/DeveloperController.php | 33 ++++++++++++-- .../baggy/Developer/client_parameters.html.twig | 3 +- .../themes/baggy/Developer/howto_app.html.twig | 2 +- .../views/themes/baggy/Developer/index.html.twig | 41 ++++++++++++++++- .../material/Developer/client_parameters.html.twig | 3 +- .../themes/material/Developer/howto_app.html.twig | 2 +- .../themes/material/Developer/index.html.twig | 41 ++++++++++++++++- .../Tests/Controller/DeveloperControllerTest.php | 53 ++++++++++++++++++++-- 8 files changed, 162 insertions(+), 16 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index 30cc8beb..e7720355 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -17,13 +17,17 @@ class DeveloperController extends Controller */ public function indexAction() { - return $this->render('WallabagCoreBundle:Developer:index.html.twig'); + $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll(); + + return $this->render('WallabagCoreBundle:Developer:index.html.twig', array( + 'clients' => $clients, + )); } /** * @param Request $request * - * @Route("/developer/client/create", name="create_client") + * @Route("/developer/client/create", name="developer_create_client") * * @return \Symfony\Component\HttpFoundation\Response */ @@ -56,7 +60,30 @@ class DeveloperController extends Controller } /** - * @Route("/developer/howto/first-app", name="howto-firstapp") + * Remove a client. + * + * @param Request $request + * + * @Route("/developer/client/delete/{id}", requirements={"id" = "\d+"}, name="developer_delete_client") + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function deleteClientAction(Request $request, Client $client) + { + $em = $this->getDoctrine()->getManager(); + $em->remove($client); + $em->flush(); + + $this->get('session')->getFlashBag()->add( + 'notice', + 'Client deleted' + ); + + return $this->redirect($this->generateUrl('developer')); + } + + /** + * @Route("/developer/howto/first-app", name="developer_howto_firstapp") * * @return \Symfony\Component\HttpFoundation\Response */ diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig index a2a28d50..c2f7e95c 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig @@ -8,14 +8,13 @@ diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig index 88788776..1aece1d9 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig @@ -15,7 +15,7 @@

    The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.

    You need a token to communicate between your 3rd application and wallabag API.

    -

    To create this token, you need to create a new client.

    +

    To create this token, you need to create a new client.

    Now, create your token (replace client_id, client_secret, username and password with the good values):

    http POST http://v2.wallabag.org/oauth/v2/token \
    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig
    index 87dd4a5f..604bfec9 100644
    --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig
    +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig
    @@ -13,15 +13,52 @@
                     

    {% trans %}Documentation{% endtrans %}

    {% trans %}Clients{% endtrans %}

    +

    {% trans %}Existing clients{% endtrans %}

    + {% if clients %} +
      + {% for client in clients %} +
    • +
      #{{ client.id }}
      +
      + + + + + + + + + + + + + + + + + +
      {% trans %}Client ID:{% endtrans %}{{ client.id }}_{{ client.randomId }}
      {% trans %}Client secret:{% endtrans %}{{ client.secret }}
      {% trans %}Redirect URIs:{% endtrans %}{{ client.redirectUris|json_encode() }}
      {% trans %}Grant type allowed:{% endtrans %}{{ client.allowedGrantTypes|json_encode() }}
      +

      + {% trans %}You have the ability to remove this client. This action is IRREVERSIBLE !{% endtrans %}
      + {% trans %}If you remove it, every app configured with that client won't be able to auth on your wallabag.{% endtrans %}
      + {% trans %}Remove this client{% endtrans %} +

      +
      +
    • + {% endfor %} +
    + {% else %} + {% trans %}No client yet.{% endtrans %} + {% endif %}
    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig index a2a28d50..c2f7e95c 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig @@ -8,14 +8,13 @@

    {% trans %}Here are your client parameters.{% endtrans %}

    -

    {% trans %}Make sure to copy these parameters now. You won’t be able to see them again!{% endtrans %}

    • {% trans %}Client ID:{% endtrans %}
      {{ client_id }}
    • {% trans %}Client secret:{% endtrans %}
      {{ client_secret }}
    {% trans %}Back{% endtrans %} - {% trans %}Read the howto "Create my first application"{% endtrans %} + {% trans %}Read the howto "Create my first application"{% endtrans %}
    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig index 88788776..1aece1d9 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig @@ -15,7 +15,7 @@

    The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.

    You need a token to communicate between your 3rd application and wallabag API.

    -

    To create this token, you need to create a new client.

    +

    To create this token, you need to create a new client.

    Now, create your token (replace client_id, client_secret, username and password with the good values):

    http POST http://v2.wallabag.org/oauth/v2/token \
    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig
    index 87dd4a5f..604bfec9 100644
    --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig
    +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig
    @@ -13,15 +13,52 @@
                     

    {% trans %}Documentation{% endtrans %}

    {% trans %}Clients{% endtrans %}

    +

    {% trans %}Existing clients{% endtrans %}

    + {% if clients %} +
      + {% for client in clients %} +
    • +
      #{{ client.id }}
      +
      + + + + + + + + + + + + + + + + + +
      {% trans %}Client ID:{% endtrans %}{{ client.id }}_{{ client.randomId }}
      {% trans %}Client secret:{% endtrans %}{{ client.secret }}
      {% trans %}Redirect URIs:{% endtrans %}{{ client.redirectUris|json_encode() }}
      {% trans %}Grant type allowed:{% endtrans %}{{ client.allowedGrantTypes|json_encode() }}
      +

      + {% trans %}You have the ability to remove this client. This action is IRREVERSIBLE !{% endtrans %}
      + {% trans %}If you remove it, every app configured with that client won't be able to auth on your wallabag.{% endtrans %}
      + {% trans %}Remove this client{% endtrans %} +

      +
      +
    • + {% endfor %} +
    + {% else %} + {% trans %}No client yet.{% endtrans %} + {% endif %}
    diff --git a/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php index 204796ca..fc220b85 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/DeveloperControllerTest.php @@ -6,19 +6,66 @@ use Wallabag\CoreBundle\Tests\WallabagCoreTestCase; class DeveloperControllerTest extends WallabagCoreTestCase { - public function testNewClient() + public function testCreateClient() { $this->logInAs('admin'); $client = $this->getClient(); + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); $crawler = $client->request('GET', '/developer/client/create'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $form = $crawler->filter('button[type=submit]')->form(); - $crawler = $client->submit($form); + $client->submit($form); $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertContains('Make sure to copy these parameters now.', $client->getResponse()->getContent()); + + $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); + $this->assertGreaterThan(count($nbClients), count($newNbClients)); + } + + public function testListingClient() + { + $this->logInAs('admin'); + $client = $this->getClient(); + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); + + $crawler = $client->request('GET', '/developer'); + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertEquals(count($nbClients), $crawler->filter('ul[class=collapsible] li')->count()); + } + + public function testDeveloperHowto() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/developer/howto/first-app'); + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + } + + public function testRemoveClient() + { + $this->logInAs('admin'); + $client = $this->getClient(); + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); + + $crawler = $client->request('GET', '/developer'); + + $link = $crawler + ->filter('div[class=collapsible-body] p a') + ->eq(0) + ->link() + ; + + $client->click($link); + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); + $this->assertGreaterThan(count($newNbClients), count($nbClients)); } } -- cgit v1.2.3 From 1256f6fe34ed4e5f7a1d9eec2ac8092da44de191 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 5 Mar 2016 22:29:58 +0100 Subject: Add translations --- .../CoreBundle/Controller/DeveloperController.php | 10 +++++++-- src/Wallabag/CoreBundle/Form/Type/ClientType.php | 4 ++-- .../Resources/translations/messages.fr.yml | 25 ++++++++++++++++++++++ .../views/themes/baggy/Developer/client.html.twig | 2 +- .../baggy/Developer/client_parameters.html.twig | 4 ++-- .../views/themes/baggy/Developer/index.html.twig | 8 +++---- .../themes/material/Developer/client.html.twig | 2 +- .../material/Developer/client_parameters.html.twig | 4 ++-- .../themes/material/Developer/index.html.twig | 8 +++---- 9 files changed, 49 insertions(+), 18 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index e7720355..71065534 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -11,6 +11,8 @@ use Wallabag\CoreBundle\Form\Type\ClientType; class DeveloperController extends Controller { /** + * List all clients and link to create a new one. + * * @Route("/developer", name="developer") * * @return \Symfony\Component\HttpFoundation\Response @@ -25,6 +27,8 @@ class DeveloperController extends Controller } /** + * Create a client (an app). + * * @param Request $request * * @Route("/developer/client/create", name="developer_create_client") @@ -62,13 +66,13 @@ class DeveloperController extends Controller /** * Remove a client. * - * @param Request $request + * @param Client $client * * @Route("/developer/client/delete/{id}", requirements={"id" = "\d+"}, name="developer_delete_client") * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - public function deleteClientAction(Request $request, Client $client) + public function deleteClientAction(Client $client) { $em = $this->getDoctrine()->getManager(); $em->remove($client); @@ -83,6 +87,8 @@ class DeveloperController extends Controller } /** + * Display developer how to use an existing app. + * * @Route("/developer/howto/first-app", name="developer_howto_firstapp") * * @return \Symfony\Component\HttpFoundation\Response diff --git a/src/Wallabag/CoreBundle/Form/Type/ClientType.php b/src/Wallabag/CoreBundle/Form/Type/ClientType.php index cb6b5e65..dd934715 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ClientType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ClientType.php @@ -14,8 +14,8 @@ class ClientType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('redirect_uris', UrlType::class, array('required' => true)) - ->add('save', SubmitType::class, array('label' => 'Create new client')) + ->add('redirect_uris', UrlType::class, array('required' => true, 'label' => 'Redirect URIs')) + ->add('save', SubmitType::class, array('label' => 'Create a new client')) ; $builder->get('redirect_uris') diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index e4935b9e..6fbdcb9b 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -240,3 +240,28 @@ If you need some help, we are here for you.: "Parce que vous avez peut-être bes On GitHub: "Sur GitHub" By email: "Par email" On Gitter: "Sur Gitter" + +# developer +Developer: Développeur +Welcome to the wallabag API: "Bienvenue sur l'API de wallabag" +How to create my first application: "Comment créer votre première application" +View full API documentation: "Voir la documentation complète de l'API" +Clients: "Clients" +Create a new client: "Créer une nouveau client" +Existing clients: "Les clients existants" +Client ID: "ID Client" +Client secret: "Clé secrète" +Redirect URIs: "URLs de redirection" +Grant type allowed: "Type de privilège accordé" +You have the ability to remove this client. This action is IRREVERSIBLE !: "Vous avez la possibilité de supprimer un client. Cette action est IRREVERSIBLE !" +If you remove it, every app configured with that client won't be able to auth on your wallabag.: "Si vous supprimez un client, toutes les applications qui l'utilisaient ne fonctionneront plus avec votre compte wallabag." +Remove this client: "Supprimer ce client" +New client: "Nouveau client" +You are about to create a new client. Please fill the field below for the redirect URI of your application.: "Vous allez créer un nouveau client. Merci de remplir l'url de redirection vers votre application." +Back: "Retour" +Client parameters: "Les parameters de votre client" +New client created.: "Nouveau client créé." +Here are your client parameters.: "Voilà les paramètres de votre client" +Read the howto "Create my first application": "Lire \"comment créer ma première application\"" +Client deleted: "Client supprimé" +No client yet.: "Aucun client pour le moment" diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig index 5cbe1c39..c9ce6d08 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client.html.twig @@ -8,7 +8,7 @@
    -

    {% trans %}You are about to create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}

    +

    {% trans %}You are about to create a new client. Please fill the field below for the redirect URI of your application.{% endtrans %}

    {{ form_start(form) }} {{ form_errors(form) }} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig index c2f7e95c..a214dfd0 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig @@ -9,8 +9,8 @@

    {% trans %}Here are your client parameters.{% endtrans %}

      -
    • {% trans %}Client ID:{% endtrans %}
      {{ client_id }}
    • -
    • {% trans %}Client secret:{% endtrans %}
      {{ client_secret }}
    • +
    • {% trans %}Client ID{% endtrans %}:
      {{ client_id }}
    • +
    • {% trans %}Client secret{% endtrans %}:
      {{ client_secret }}
    {% trans %}Back{% endtrans %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig index 604bfec9..2e7dbcab 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig @@ -31,19 +31,19 @@
    - + - + - + - +
    {% trans %}Client ID:{% endtrans %}{% trans %}Client ID{% endtrans %} {{ client.id }}_{{ client.randomId }}
    {% trans %}Client secret:{% endtrans %}{% trans %}Client secret{% endtrans %} {{ client.secret }}
    {% trans %}Redirect URIs:{% endtrans %}{% trans %}Redirect URIs{% endtrans %} {{ client.redirectUris|json_encode() }}
    {% trans %}Grant type allowed:{% endtrans %}{% trans %}Grant type allowed{% endtrans %} {{ client.allowedGrantTypes|json_encode() }}
    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig index 5cbe1c39..c9ce6d08 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig @@ -8,7 +8,7 @@
    -

    {% trans %}You are about to create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}

    +

    {% trans %}You are about to create a new client. Please fill the field below for the redirect URI of your application.{% endtrans %}

    {{ form_start(form) }} {{ form_errors(form) }} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig index c2f7e95c..a214dfd0 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig @@ -9,8 +9,8 @@

    {% trans %}Here are your client parameters.{% endtrans %}

      -
    • {% trans %}Client ID:{% endtrans %}
      {{ client_id }}
    • -
    • {% trans %}Client secret:{% endtrans %}
      {{ client_secret }}
    • +
    • {% trans %}Client ID{% endtrans %}:
      {{ client_id }}
    • +
    • {% trans %}Client secret{% endtrans %}:
      {{ client_secret }}
    {% trans %}Back{% endtrans %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig index 604bfec9..2e7dbcab 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig @@ -31,19 +31,19 @@
    - + - + - + - +
    {% trans %}Client ID:{% endtrans %}{% trans %}Client ID{% endtrans %} {{ client.id }}_{{ client.randomId }}
    {% trans %}Client secret:{% endtrans %}{% trans %}Client secret{% endtrans %} {{ client.secret }}
    {% trans %}Redirect URIs:{% endtrans %}{% trans %}Redirect URIs{% endtrans %} {{ client.redirectUris|json_encode() }}
    {% trans %}Grant type allowed:{% endtrans %}{% trans %}Grant type allowed{% endtrans %} {{ client.allowedGrantTypes|json_encode() }}
    -- cgit v1.2.3 From 2766668b59249e00e8c9077063bae17fe9cb5ec6 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 7 Mar 2016 08:58:08 +0100 Subject: Use external js & css --- .../Resources/public/themes/_global/css/prism.css | 131 --------------------- .../Resources/public/themes/_global/js/prism.js | 9 -- .../themes/baggy/Developer/howto_app.html.twig | 5 +- .../themes/material/Developer/howto_app.html.twig | 5 +- 4 files changed, 6 insertions(+), 144 deletions(-) delete mode 100644 src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css delete mode 100644 src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css b/src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css deleted file mode 100644 index 65075559..00000000 --- a/src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css +++ /dev/null @@ -1,131 +0,0 @@ -/* http://prismjs.com/download.html?themes=prism-dark&languages=markup+css+clike+javascript+bash+php+yaml */ -/** - * prism.js Dark theme for JavaScript, CSS and HTML - * Based on the slides of the talk “/Reg(exp){2}lained/” - * @author Lea Verou - */ - -code[class*="language-"], -pre[class*="language-"] { - color: white; - background: none; - text-shadow: 0 -.1em .2em black; - font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -@media print { - code[class*="language-"], - pre[class*="language-"] { - text-shadow: none; - } -} - -pre[class*="language-"], -:not(pre) > code[class*="language-"] { - background: hsl(30, 20%, 25%); -} - -/* Code blocks */ -pre[class*="language-"] { - padding: 1em; - margin: .5em 0; - overflow: auto; - border: .3em solid hsl(30, 20%, 40%); - border-radius: .5em; - box-shadow: 1px 1px .5em black inset; -} - -/* Inline code */ -:not(pre) > code[class*="language-"] { - padding: .15em .2em .05em; - border-radius: .3em; - border: .13em solid hsl(30, 20%, 40%); - box-shadow: 1px 1px .3em -.1em black inset; - white-space: normal; -} - -.token.comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: hsl(30, 20%, 50%); -} - -.token.punctuation { - opacity: .7; -} - -.namespace { - opacity: .7; -} - -.token.property, -.token.tag, -.token.boolean, -.token.number, -.token.constant, -.token.symbol { - color: hsl(350, 40%, 70%); -} - -.token.selector, -.token.attr-name, -.token.string, -.token.char, -.token.builtin, -.token.inserted { - color: hsl(75, 70%, 60%); -} - -.token.operator, -.token.entity, -.token.url, -.language-css .token.string, -.style .token.string, -.token.variable { - color: hsl(40, 90%, 60%); -} - -.token.atrule, -.token.attr-value, -.token.keyword { - color: hsl(350, 40%, 70%); -} - -.token.regex, -.token.important { - color: #e90; -} - -.token.important, -.token.bold { - font-weight: bold; -} -.token.italic { - font-style: italic; -} - -.token.entity { - cursor: help; -} - -.token.deleted { - color: red; -} - diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js b/src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js deleted file mode 100644 index 0235e52d..00000000 --- a/src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js +++ /dev/null @@ -1,9 +0,0 @@ -/* http://prismjs.com/download.html?themes=prism-dark&languages=markup+css+clike+javascript+bash+php+yaml */ -var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){g&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,b=y+v,k=d.slice(0,y+1),w=d.slice(b+1),_=[p,1];k&&_.push(k);var P=new a(i,c?n.tokenize(m,c):m,h);_.push(P),w&&_.push(w),Array.prototype.splice.apply(r,_)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(t)}}},a=n.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o="";for(var s in l.attributes)o+=(o?" ":"")+s+'="'+(l.attributes[s]||"")+'"';return"<"+l.tag+' class="'+l.classes.join(" ")+'" '+o+">"+l.content+""},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,l=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",n.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); -Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup; -Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); -Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}; -Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript; -!function(e){var t={variable:[{pattern:/\$?\(\([\w\W]+?\)\)/,inside:{variable:[{pattern:/(^\$\(\([\w\W]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/,operator:/--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\([^)]+\)|`[^`]+`/,inside:{variable:/^\$\(|^`|\)$|`$/}},/\$(?:[a-z0-9_#\?\*!@]+|\{[^}]+\})/i]};e.languages.bash={shebang:{pattern:/^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,alias:"important"},comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<\s*)(?:"|')?(\w+?)(?:"|')?\s*\r?\n(?:[\s\S])*?\r?\n\2/g,lookbehind:!0,inside:t},{pattern:/(["'])(?:\\\\|\\?[^\\])*?\1/g,inside:t}],variable:t.variable,"function":{pattern:/(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,lookbehind:!0},keyword:{pattern:/(^|\s|;|\||&)(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\s|;|\||&)/,lookbehind:!0},"boolean":{pattern:/(^|\s|;|\||&)(?:true|false)(?=$|\s|;|\||&)/,lookbehind:!0},operator:/&&?|\|\|?|==?|!=?|<<>|<=?|>=?|=~/,punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];]/};var a=t.variable[1].inside;a["function"]=e.languages.bash["function"],a.keyword=e.languages.bash.keyword,a.boolean=e.languages.bash.boolean,a.operator=e.languages.bash.operator,a.punctuation=e.languages.bash.punctuation}(Prism); -Prism.languages.php=Prism.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0}}),Prism.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),Prism.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(e){"php"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(a){return e.tokenStack.push(a),"{{{PHP"+e.tokenStack.length+"}}}"}))}),Prism.hooks.add("before-insert",function(e){"php"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),Prism.hooks.add("after-highlight",function(e){if("php"===e.language){for(var a,n=0;a=e.tokenStack[n];n++)e.highlightedCode=e.highlightedCode.replace("{{{PHP"+(n+1)+"}}}",Prism.highlight(a,e.grammar,"php").replace(/\$/g,"$$$$"));e.element.innerHTML=e.highlightedCode}}),Prism.hooks.add("wrap",function(e){"php"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'$1'))}),Prism.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:Prism.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/})); -Prism.languages.yaml={scalar:{pattern:/([\-:]\s*(![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\3[^\r\n]+)*)/,lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:/(\s*[:\-,[{\r\n?][ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#]+?(?=\s*:\s)/,lookbehind:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(\d{4}-\d\d?-\d\d?([tT]|[ \t]+)\d\d?:\d{2}:\d{2}(\.\d*)?[ \t]*(Z|[-+]\d\d?(:\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(:\d{2}(\.\d*)?)?)(?=[ \t]*($|,|]|}))/m,lookbehind:!0,alias:"number"},"boolean":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(true|false)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},"null":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(null|~)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},string:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=[ \t]*($|,|]|}))/m,lookbehind:!0},number:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im,lookbehind:!0},tag:/![^\s]+/,important:/[&*][\w]+/,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./}; diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig index 1aece1d9..84e49ede 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig @@ -4,7 +4,7 @@ {% block css %} {{ parent() }} - + {% endblock %} {% block content %} @@ -58,5 +58,6 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13
    - + + {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig index 1aece1d9..84e49ede 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig @@ -4,7 +4,7 @@ {% block css %} {{ parent() }} - + {% endblock %} {% block content %} @@ -58,5 +58,6 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13
    - + + {% endblock %} -- cgit v1.2.3 From f17281417c481c85761552b7dad48a9a0d49248c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 7 Mar 2016 09:20:20 +0100 Subject: Translate "how to" page --- .../CoreBundle/Resources/translations/messages.fr.yml | 8 ++++++++ .../views/themes/baggy/Developer/howto_app.html.twig | 16 ++++++++-------- .../views/themes/material/Developer/howto_app.html.twig | 16 ++++++++-------- 3 files changed, 24 insertions(+), 16 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 6fbdcb9b..c4035859 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -265,3 +265,11 @@ Here are your client parameters.: "Voilà les paramètres de votre client" Read the howto "Create my first application": "Lire \"comment créer ma première application\"" Client deleted: "Client supprimé" No client yet.: "Aucun client pour le moment" +"The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.": "Les commandes suivantes utilisent la librarie HTTPie. Assurez-vous qu'elle soit installée avant de l'utiliser." +You need a token to communicate between your 3rd application and wallabag API.: "Vous avez besoin d'un token pour échanger entre votre appication et l'API de wallabag." +"To create this token, you need to create a new client.": "Pour créer un token, vous devez créer un nouveau client." +Now, create your token (replace client_id, client_secret, username and password with the good values):: "Maintenant créer votre token (remplacer client_id, client_secret, username et password avec les bonnes valeurs):" +The API will return a response like this:: "L'API vous retournera une réponse comme ça:" +The access_token is useful to do a call to the API endpoint. For example:: "L'access_token doit être utilisé pour faire un appel à l'API. Par exemple:" +This call will return all the entries for your user.: "Cet appel va retourner tous les articles de l'utilisateur." +"If you want to see all the API endpoints, you can have a look to our API documentation.": "Si vous voulez toutes les méthodes de l'API, jettez un oeil à la documentation de l'API." diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig index 84e49ede..382e6311 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/howto_app.html.twig @@ -13,10 +13,10 @@
    -

    The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.

    -

    You need a token to communicate between your 3rd application and wallabag API.

    -

    To create this token, you need to create a new client.

    -

    Now, create your token (replace client_id, client_secret, username and password with the good values):

    +

    {% trans %}The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.{% endtrans %}

    +

    {% trans %}You need a token to communicate between your 3rd application and wallabag API.{% endtrans %}

    +

    {% trans with {'%link%': path('developer_create_client')} %}To create this token, you need to create a new client.{% endtrans %}

    +

    {% trans %}Now, create your token (replace client_id, client_secret, username and password with the good values):{% endtrans %}

    http POST http://v2.wallabag.org/oauth/v2/token \
         grant_type=password \
    @@ -25,7 +25,7 @@
         username=yourUsername \
         password=yourPassw0rd

    -

    The API will return a response like this:

    +

    {% trans %}The API will return a response like this:{% endtrans %}

    HTTP/1.1 200 OK
     Cache-Control: no-store, private
    @@ -45,13 +45,13 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13
         "token_type": "bearer"
     }

    -

    The access_token is useful to do a call to the API endpoint. For example:

    +

    {% trans %}The access_token is useful to do a call to the API endpoint. For example:{% endtrans %}

    http GET http://v2.wallabag.org/api/entries.json \
         "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"

    -

    This call will return all the entries for your user.

    -

    If you want to see all the API endpoints, you can have a look to our API documentation.

    +

    {% trans %}This call will return all the entries for your user.{% endtrans %}

    +

    {% trans with {'%link%': path('nelmio_api_doc_index')} %}If you want to see all the API endpoints, you can have a look to our API documentation.{% endtrans %}

    {% trans %}Back{% endtrans %}

    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig index 84e49ede..382e6311 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig @@ -13,10 +13,10 @@
    -

    The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.

    -

    You need a token to communicate between your 3rd application and wallabag API.

    -

    To create this token, you need to create a new client.

    -

    Now, create your token (replace client_id, client_secret, username and password with the good values):

    +

    {% trans %}The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.{% endtrans %}

    +

    {% trans %}You need a token to communicate between your 3rd application and wallabag API.{% endtrans %}

    +

    {% trans with {'%link%': path('developer_create_client')} %}To create this token, you need to create a new client.{% endtrans %}

    +

    {% trans %}Now, create your token (replace client_id, client_secret, username and password with the good values):{% endtrans %}

    http POST http://v2.wallabag.org/oauth/v2/token \
         grant_type=password \
    @@ -25,7 +25,7 @@
         username=yourUsername \
         password=yourPassw0rd

    -

    The API will return a response like this:

    +

    {% trans %}The API will return a response like this:{% endtrans %}

    HTTP/1.1 200 OK
     Cache-Control: no-store, private
    @@ -45,13 +45,13 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13
         "token_type": "bearer"
     }

    -

    The access_token is useful to do a call to the API endpoint. For example:

    +

    {% trans %}The access_token is useful to do a call to the API endpoint. For example:{% endtrans %}

    http GET http://v2.wallabag.org/api/entries.json \
         "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"

    -

    This call will return all the entries for your user.

    -

    If you want to see all the API endpoints, you can have a look to our API documentation.

    +

    {% trans %}This call will return all the entries for your user.{% endtrans %}

    +

    {% trans with {'%link%': path('nelmio_api_doc_index')} %}If you want to see all the API endpoints, you can have a look to our API documentation.{% endtrans %}

    {% trans %}Back{% endtrans %}

    -- cgit v1.2.3 From d11eb2e461a3ea2b74e5a1c686c9fa9bbcb9e103 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 7 Mar 2016 11:05:14 +0100 Subject: Fix translations mistake In Material template, move the developer link in the left menu (like in baggy) --- src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | 10 +++++----- .../Resources/views/themes/material/layout.html.twig | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index c4035859..1de8d20f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -259,17 +259,17 @@ Remove this client: "Supprimer ce client" New client: "Nouveau client" You are about to create a new client. Please fill the field below for the redirect URI of your application.: "Vous allez créer un nouveau client. Merci de remplir l'url de redirection vers votre application." Back: "Retour" -Client parameters: "Les parameters de votre client" +Client parameters: "Les paramètres de votre client" New client created.: "Nouveau client créé." Here are your client parameters.: "Voilà les paramètres de votre client" Read the howto "Create my first application": "Lire \"comment créer ma première application\"" Client deleted: "Client supprimé" No client yet.: "Aucun client pour le moment" "The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.": "Les commandes suivantes utilisent la librarie HTTPie. Assurez-vous qu'elle soit installée avant de l'utiliser." -You need a token to communicate between your 3rd application and wallabag API.: "Vous avez besoin d'un token pour échanger entre votre appication et l'API de wallabag." +You need a token to communicate between your 3rd application and wallabag API.: "Vous avez besoin d'un token pour échanger entre votre application et l'API de wallabag." "To create this token, you need to create a new client.": "Pour créer un token, vous devez créer un nouveau client." -Now, create your token (replace client_id, client_secret, username and password with the good values):: "Maintenant créer votre token (remplacer client_id, client_secret, username et password avec les bonnes valeurs):" +Now, create your token (replace client_id, client_secret, username and password with the good values):: "Maintenant créez votre token (remplacer client_id, client_secret, username et password avec les bonnes valeurs):" The API will return a response like this:: "L'API vous retournera une réponse comme ça:" -The access_token is useful to do a call to the API endpoint. For example:: "L'access_token doit être utilisé pour faire un appel à l'API. Par exemple:" +The access_token is useful to do a call to the API endpoint. For example:: "L'access_token doit être utilisé pour faire un appel à l'API. Par exemple :" This call will return all the entries for your user.: "Cet appel va retourner tous les articles de l'utilisateur." -"If you want to see all the API endpoints, you can have a look to our API documentation.": "Si vous voulez toutes les méthodes de l'API, jettez un oeil à la documentation de l'API." +"If you want to see all the API endpoints, you can have a look to our API documentation.": "Si vous voulez toutes les méthodes de l'API, jetez un oeil à la documentation de l'API." diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index 82bd9a1d..f5d03084 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig @@ -50,6 +50,7 @@ {% endif %}
  • {% trans %}import{% endtrans %}
  • {% trans %}howto{% endtrans %}
  • +
  • {% trans %}Developer{% endtrans %}
  • {% trans %}logout{% endtrans %}
  • -- cgit v1.2.3