diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-05-21 18:09:38 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-08-22 20:18:27 +0200 |
commit | 9c545fe028013b30417c1a932cd6b9027bff752d (patch) | |
tree | 3de7e843c34d058355a3b3a4c090b61bca9c2078 /src | |
parent | db4d63fc1ae513335b751beb8f89e1eed61871c2 (diff) | |
download | wallabag-9c545fe028013b30417c1a932cd6b9027bff752d.tar.gz wallabag-9c545fe028013b30417c1a932cd6b9027bff752d.tar.zst wallabag-9c545fe028013b30417c1a932cd6b9027bff752d.zip |
Added name on client
- Fix typos in field name
- Added migration for name field in API client table
Manually cherry-picked from PR
https://github.com/wallabag/wallabag/pull/2171
Diffstat (limited to 'src')
11 files changed, 75 insertions, 23 deletions
diff --git a/src/Wallabag/ApiBundle/Entity/Client.php b/src/Wallabag/ApiBundle/Entity/Client.php index c04ed0f6..3e2f491c 100644 --- a/src/Wallabag/ApiBundle/Entity/Client.php +++ b/src/Wallabag/ApiBundle/Entity/Client.php | |||
@@ -18,8 +18,39 @@ class Client extends BaseClient | |||
18 | */ | 18 | */ |
19 | protected $id; | 19 | protected $id; |
20 | 20 | ||
21 | /** | ||
22 | * @var string | ||
23 | * | ||
24 | * @ORM\Column(name="name", type="text", nullable=true) | ||
25 | */ | ||
26 | protected $name; | ||
27 | |||
21 | public function __construct() | 28 | public function __construct() |
22 | { | 29 | { |
23 | parent::__construct(); | 30 | parent::__construct(); |
24 | } | 31 | } |
32 | |||
33 | /** | ||
34 | * Get name. | ||
35 | * | ||
36 | * @return string | ||
37 | */ | ||
38 | public function getName() | ||
39 | { | ||
40 | return $this->name; | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Set name. | ||
45 | * | ||
46 | * @param string $name | ||
47 | * | ||
48 | * @return Client | ||
49 | */ | ||
50 | public function setName($name) | ||
51 | { | ||
52 | $this->name = $name; | ||
53 | |||
54 | return $this; | ||
55 | } | ||
25 | } | 56 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index d85ba5ee..1ea220e5 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php | |||
@@ -49,12 +49,13 @@ class DeveloperController extends Controller | |||
49 | 49 | ||
50 | $this->get('session')->getFlashBag()->add( | 50 | $this->get('session')->getFlashBag()->add( |
51 | 'notice', | 51 | 'notice', |
52 | 'flashes.developer.notice.client_created' | 52 | $this->get('translator')->trans('flashes.developer.notice.client_created', array('%name%' => $client->getName())) |
53 | ); | 53 | ); |
54 | 54 | ||
55 | return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', [ | 55 | return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', [ |
56 | 'client_id' => $client->getPublicId(), | 56 | 'client_id' => $client->getPublicId(), |
57 | 'client_secret' => $client->getSecret(), | 57 | 'client_secret' => $client->getSecret(), |
58 | 'client_name' => $client->getName(), | ||
58 | ]); | 59 | ]); |
59 | } | 60 | } |
60 | 61 | ||
@@ -80,7 +81,7 @@ class DeveloperController extends Controller | |||
80 | 81 | ||
81 | $this->get('session')->getFlashBag()->add( | 82 | $this->get('session')->getFlashBag()->add( |
82 | 'notice', | 83 | 'notice', |
83 | 'flashes.developer.notice.client_deleted' | 84 | $this->get('translator')->trans('flashes.developer.notice.client_deleted', array('%name%' => $client->getName())) |
84 | ); | 85 | ); |
85 | 86 | ||
86 | return $this->redirect($this->generateUrl('developer')); | 87 | return $this->redirect($this->generateUrl('developer')); |
diff --git a/src/Wallabag/CoreBundle/Form/Type/ClientType.php b/src/Wallabag/CoreBundle/Form/Type/ClientType.php index 8b351e60..d1fa94e6 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ClientType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ClientType.php | |||
@@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType; | |||
6 | use Symfony\Component\Form\CallbackTransformer; | 6 | use Symfony\Component\Form\CallbackTransformer; |
7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | 7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
8 | use Symfony\Component\Form\Extension\Core\Type\UrlType; | 8 | use Symfony\Component\Form\Extension\Core\Type\UrlType; |
9 | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
9 | use Symfony\Component\Form\FormBuilderInterface; | 10 | use Symfony\Component\Form\FormBuilderInterface; |
10 | use Symfony\Component\OptionsResolver\OptionsResolver; | 11 | use Symfony\Component\OptionsResolver\OptionsResolver; |
11 | 12 | ||
@@ -14,7 +15,8 @@ class ClientType extends AbstractType | |||
14 | public function buildForm(FormBuilderInterface $builder, array $options) | 15 | public function buildForm(FormBuilderInterface $builder, array $options) |
15 | { | 16 | { |
16 | $builder | 17 | $builder |
17 | ->add('redirect_uris', UrlType::class, ['required' => true, 'label' => 'developer.client.form.redirect_uris_label']) | 18 | ->add('name', TextType::class, ['label' => 'developer.client.form.name_label']) |
19 | ->add('redirect_uris', UrlType::class, ['required' => false, 'label' => 'developer.client.form.redirect_uris_label']) | ||
18 | ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label']) | 20 | ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label']) |
19 | ; | 21 | ; |
20 | 22 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 826bd470..2c087421 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -352,19 +352,21 @@ developer: | |||
352 | field_grant_types: 'Grant type allowed' | 352 | field_grant_types: 'Grant type allowed' |
353 | no_client: 'No client yet.' | 353 | no_client: 'No client yet.' |
354 | remove: | 354 | remove: |
355 | warn_message_1: 'You have the ability to remove this client. This action is IRREVERSIBLE !' | 355 | warn_message_1: 'You have the ability to remove the client %name%. This action is IRREVERSIBLE !' |
356 | warn_message_2: "If you remove it, every app configured with that client won't be able to auth on your wallabag." | 356 | warn_message_2: "If you remove it, every app configured with that client won't be able to auth on your wallabag." |
357 | action: 'Remove this client' | 357 | action: 'Remove the client %name%' |
358 | client: | 358 | client: |
359 | page_title: 'Developer > New client' | 359 | page_title: 'Developer > New client' |
360 | page_description: 'You are about to create a new client. Please fill the field below for the redirect URI of your application.' | 360 | page_description: 'You are about to create a new client. Please fill the field below for the redirect URI of your application.' |
361 | form: | 361 | form: |
362 | redirect_uris_label: 'Redirect URIs' | 362 | name_label: 'Name of the client' |
363 | redirect_uris_label: 'Redirect URIs (optional)' | ||
363 | save_label: 'Create a new client' | 364 | save_label: 'Create a new client' |
364 | action_back: 'Back' | 365 | action_back: 'Back' |
365 | client_parameter: | 366 | client_parameter: |
366 | page_title: 'Developer > Client parameters' | 367 | page_title: 'Developer > Client parameters' |
367 | page_description: 'Here are your client parameters.' | 368 | page_description: 'Here are your client parameters.' |
369 | field_name: 'Client name' | ||
368 | field_id: 'Client ID' | 370 | field_id: 'Client ID' |
369 | field_secret: 'Client secret' | 371 | field_secret: 'Client secret' |
370 | back: 'Back' | 372 | back: 'Back' |
@@ -417,5 +419,5 @@ flashes: | |||
417 | summary: 'Import summary: %imported% imported, %skipped% already saved.' | 419 | summary: 'Import summary: %imported% imported, %skipped% already saved.' |
418 | developer: | 420 | developer: |
419 | notice: | 421 | notice: |
420 | client_created: 'New client created.' | 422 | client_created: 'New client %name% created.' |
421 | client_deleted: 'Client deleted' | 423 | client_deleted: 'Client %name% deleted' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 7c1464e1..542f61c2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -343,7 +343,7 @@ developer: | |||
343 | list_methods: "Lister toutes les méthodes de l'API" | 343 | list_methods: "Lister toutes les méthodes de l'API" |
344 | clients: | 344 | clients: |
345 | title: 'Clients' | 345 | title: 'Clients' |
346 | create_new: 'Créer une nouveau client' | 346 | create_new: 'Créer un nouveau client' |
347 | existing_clients: | 347 | existing_clients: |
348 | title: 'Les clients existants' | 348 | title: 'Les clients existants' |
349 | field_id: 'ID Client' | 349 | field_id: 'ID Client' |
@@ -352,19 +352,21 @@ developer: | |||
352 | field_grant_types: 'Type de privilège accordé' | 352 | field_grant_types: 'Type de privilège accordé' |
353 | no_client: 'Aucun client pour le moment' | 353 | no_client: 'Aucun client pour le moment' |
354 | remove: | 354 | remove: |
355 | warn_message_1: 'Vous avez la possibilité de supprimer un client. Cette action est IRREVERSIBLE !' | 355 | warn_message_1: 'Vous avez la possibilité de supprimer le client %name%. Cette action est IRREVERSIBLE !' |
356 | warn_message_2: "Si vous supprimez un client, toutes les applications qui l'utilisaient ne fonctionneront plus avec votre compte wallabag." | 356 | warn_message_2: "Si vous supprimez le client %name%, toutes les applications qui l'utilisaient ne fonctionneront plus avec votre compte wallabag." |
357 | action: 'Supprimer ce client' | 357 | action: 'Supprimer le client %name%' |
358 | client: | 358 | client: |
359 | page_title: 'Développeur > Nouveau client' | 359 | page_title: 'Développeur > Nouveau client' |
360 | page_description: "Vous allez créer un nouveau client. Merci de remplir l'url de redirection vers votre application." | 360 | page_description: "Vous allez créer un nouveau client. Merci de remplir l'url de redirection vers votre application." |
361 | form: | 361 | form: |
362 | redirect_uris_label: 'URLs de redirection' | 362 | name_label: "Nom du client" |
363 | redirect_uris_label: 'URLs de redirection (optionnel)' | ||
363 | save_label: 'Créer un nouveau client' | 364 | save_label: 'Créer un nouveau client' |
364 | action_back: 'Retour' | 365 | action_back: 'Retour' |
365 | client_parameter: | 366 | client_parameter: |
366 | page_title: 'Développeur > Les paramètres de votre client' | 367 | page_title: 'Développeur > Les paramètres de votre client' |
367 | page_description: 'Voilà les paramètres de votre client' | 368 | page_description: 'Voilà les paramètres de votre client' |
369 | field_name: 'Nom du client' | ||
368 | field_id: 'ID Client' | 370 | field_id: 'ID Client' |
369 | field_secret: 'Clé secrète' | 371 | field_secret: 'Clé secrète' |
370 | back: 'Retour' | 372 | back: 'Retour' |
@@ -417,5 +419,5 @@ flashes: | |||
417 | summary: "Rapport d'import: %imported% importés, %skipped% déjà présent." | 419 | summary: "Rapport d'import: %imported% importés, %skipped% déjà présent." |
418 | developer: | 420 | developer: |
419 | notice: | 421 | notice: |
420 | client_created: 'Nouveau client créé' | 422 | client_created: 'Nouveau client %name% créé' |
421 | client_deleted: 'Client supprimé' | 423 | client_deleted: 'Client %name% supprimé' |
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 78a9dc04..8a5da71a 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 | |||
@@ -13,6 +13,12 @@ | |||
13 | {{ form_errors(form) }} | 13 | {{ form_errors(form) }} |
14 | 14 | ||
15 | <div class="input-field col s12"> | 15 | <div class="input-field col s12"> |
16 | {{ form_label(form.name) }} | ||
17 | {{ form_errors(form.name) }} | ||
18 | {{ form_widget(form.name) }} | ||
19 | </div> | ||
20 | |||
21 | <div class="input-field col s12"> | ||
16 | {{ form_label(form.redirect_uris) }} | 22 | {{ form_label(form.redirect_uris) }} |
17 | {{ form_errors(form.redirect_uris) }} | 23 | {{ form_errors(form.redirect_uris) }} |
18 | {{ form_widget(form.redirect_uris) }} | 24 | {{ form_widget(form.redirect_uris) }} |
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 b615fa3b..b498cceb 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,6 +9,7 @@ | |||
9 | <div class="row"> | 9 | <div class="row"> |
10 | <p>{{ 'developer.client_parameter.page_description'|trans }}</p> | 10 | <p>{{ 'developer.client_parameter.page_description'|trans }}</p> |
11 | <ul> | 11 | <ul> |
12 | <li>{{ 'developer.client_parameter.field_name'|trans }}: <strong><pre>{{ client_name }}</pre></strong></li> | ||
12 | <li>{{ 'developer.client_parameter.field_id'|trans }}: <strong><pre>{{ client_id }}</pre></strong></li> | 13 | <li>{{ 'developer.client_parameter.field_id'|trans }}: <strong><pre>{{ client_id }}</pre></strong></li> |
13 | <li>{{ 'developer.client_parameter.field_secret'|trans }}: <strong><pre>{{ client_secret }}</pre></strong></li> | 14 | <li>{{ 'developer.client_parameter.field_secret'|trans }}: <strong><pre>{{ client_secret }}</pre></strong></li> |
14 | </ul> | 15 | </ul> |
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 001c5cbb..3430c0d4 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,7 +28,7 @@ | |||
28 | <ul class="collapsible" data-collapsible="expandable"> | 28 | <ul class="collapsible" data-collapsible="expandable"> |
29 | {% for client in clients %} | 29 | {% for client in clients %} |
30 | <li> | 30 | <li> |
31 | <div class="collapsible-header">#{{ client.id }}</div> | 31 | <div class="collapsible-header">{{ client.name }} - #{{ client.id }}</div> |
32 | <div class="collapsible-body"> | 32 | <div class="collapsible-body"> |
33 | <table class="striped"> | 33 | <table class="striped"> |
34 | <tr> | 34 | <tr> |
@@ -49,9 +49,9 @@ | |||
49 | </tr> | 49 | </tr> |
50 | </table> | 50 | </table> |
51 | <p> | 51 | <p> |
52 | {{ 'developer.remove.warn_message_1'|trans }}<br/> | 52 | {{ 'developer.remove.warn_message_1'|trans({'%name%': client.name }) }}<br/> |
53 | {{ 'developer.remove.warn_message_2'|trans }}<br/> | 53 | {{ 'developer.remove.warn_message_2'|trans({'%name%': client.name }) }}<br/> |
54 | <a class="waves-effect waves-light red btn" href="{{ path('developer_delete_client', {'id': client.id}) }}">{{ 'developer.remove.action'|trans }}</a> | 54 | <a class="waves-effect waves-light red btn" href="{{ path('developer_delete_client', {'id': client.id}) }}">{{ 'developer.remove.action'|trans({'%name%': client.name }) }}</a> |
55 | </p> | 55 | </p> |
56 | </div> | 56 | </div> |
57 | </li> | 57 | </li> |
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 78a9dc04..8a5da71a 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 | |||
@@ -13,6 +13,12 @@ | |||
13 | {{ form_errors(form) }} | 13 | {{ form_errors(form) }} |
14 | 14 | ||
15 | <div class="input-field col s12"> | 15 | <div class="input-field col s12"> |
16 | {{ form_label(form.name) }} | ||
17 | {{ form_errors(form.name) }} | ||
18 | {{ form_widget(form.name) }} | ||
19 | </div> | ||
20 | |||
21 | <div class="input-field col s12"> | ||
16 | {{ form_label(form.redirect_uris) }} | 22 | {{ form_label(form.redirect_uris) }} |
17 | {{ form_errors(form.redirect_uris) }} | 23 | {{ form_errors(form.redirect_uris) }} |
18 | {{ form_widget(form.redirect_uris) }} | 24 | {{ form_widget(form.redirect_uris) }} |
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 b615fa3b..b498cceb 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,6 +9,7 @@ | |||
9 | <div class="row"> | 9 | <div class="row"> |
10 | <p>{{ 'developer.client_parameter.page_description'|trans }}</p> | 10 | <p>{{ 'developer.client_parameter.page_description'|trans }}</p> |
11 | <ul> | 11 | <ul> |
12 | <li>{{ 'developer.client_parameter.field_name'|trans }}: <strong><pre>{{ client_name }}</pre></strong></li> | ||
12 | <li>{{ 'developer.client_parameter.field_id'|trans }}: <strong><pre>{{ client_id }}</pre></strong></li> | 13 | <li>{{ 'developer.client_parameter.field_id'|trans }}: <strong><pre>{{ client_id }}</pre></strong></li> |
13 | <li>{{ 'developer.client_parameter.field_secret'|trans }}: <strong><pre>{{ client_secret }}</pre></strong></li> | 14 | <li>{{ 'developer.client_parameter.field_secret'|trans }}: <strong><pre>{{ client_secret }}</pre></strong></li> |
14 | </ul> | 15 | </ul> |
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 001c5cbb..3430c0d4 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,7 +28,7 @@ | |||
28 | <ul class="collapsible" data-collapsible="expandable"> | 28 | <ul class="collapsible" data-collapsible="expandable"> |
29 | {% for client in clients %} | 29 | {% for client in clients %} |
30 | <li> | 30 | <li> |
31 | <div class="collapsible-header">#{{ client.id }}</div> | 31 | <div class="collapsible-header">{{ client.name }} - #{{ client.id }}</div> |
32 | <div class="collapsible-body"> | 32 | <div class="collapsible-body"> |
33 | <table class="striped"> | 33 | <table class="striped"> |
34 | <tr> | 34 | <tr> |
@@ -49,9 +49,9 @@ | |||
49 | </tr> | 49 | </tr> |
50 | </table> | 50 | </table> |
51 | <p> | 51 | <p> |
52 | {{ 'developer.remove.warn_message_1'|trans }}<br/> | 52 | {{ 'developer.remove.warn_message_1'|trans({'%name%': client.name }) }}<br/> |
53 | {{ 'developer.remove.warn_message_2'|trans }}<br/> | 53 | {{ 'developer.remove.warn_message_2'|trans({'%name%': client.name }) }}<br/> |
54 | <a class="waves-effect waves-light red btn" href="{{ path('developer_delete_client', {'id': client.id}) }}">{{ 'developer.remove.action'|trans }}</a> | 54 | <a class="waves-effect waves-light red btn" href="{{ path('developer_delete_client', {'id': client.id}) }}">{{ 'developer.remove.action'|trans({'%name%': client.name }) }}</a> |
55 | </p> | 55 | </p> |
56 | </div> | 56 | </div> |
57 | </li> | 57 | </li> |