Merge pull request #3574 from shulard/feature/rename-tags

Allow to rename tags from the web interface.
This commit is contained in:
Jérémy Benoist 2018-10-15 08:32:59 +00:00 committed by GitHub
commit e673b54f70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 247 additions and 13 deletions

View file

@ -70,4 +70,23 @@ $(document).ready(() => {
retrievePercent(x.entryId, true); retrievePercent(x.entryId, true);
}); });
} }
document.querySelectorAll('[data-handler=tag-rename]').forEach((item) => {
const current = item;
current.wallabag_edit_mode = false;
current.onclick = (event) => {
const target = event.currentTarget;
if (target.wallabag_edit_mode === false) {
$(target.parentNode.querySelector('[data-handle=tag-link]')).addClass('hidden');
$(target.parentNode.querySelector('[data-handle=tag-rename-form]')).removeClass('hidden');
target.parentNode.querySelector('[data-handle=tag-rename-form] input').focus();
target.querySelector('.material-icons').innerHTML = 'done';
target.wallabag_edit_mode = true;
} else {
target.parentNode.querySelector('[data-handle=tag-rename-form]').submit();
}
};
});
}); });

View file

@ -295,6 +295,15 @@ div.pagination ul {
} }
} }
.hide { .card-tag-form {
display: inline-block;
}
.card-tag-form input[type="text"] {
min-width: 20em;
}
.hide,
.hidden {
display: none; display: none;
} }

View file

@ -180,6 +180,17 @@ a.original:not(.waves-effect) {
flex-grow: 1; flex-grow: 1;
} }
.card-tag-form {
display: flex;
min-width: 100px;
flex-grow: 1;
}
.card-tag-form input {
margin-bottom: 0;
height: 2rem;
}
.card-tag-rss { .card-tag-rss {
display: flex; display: flex;
} }

View file

@ -11,6 +11,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Form\Type\NewTagType; use Wallabag\CoreBundle\Form\Type\NewTagType;
use Wallabag\CoreBundle\Form\Type\RenameTagType;
class TagController extends Controller class TagController extends Controller
{ {
@ -87,8 +88,14 @@ class TagController extends Controller
$tags = $this->get('wallabag_core.tag_repository') $tags = $this->get('wallabag_core.tag_repository')
->findAllFlatTagsWithNbEntries($this->getUser()->getId()); ->findAllFlatTagsWithNbEntries($this->getUser()->getId());
$renameForms = [];
foreach ($tags as $tag) {
$renameForms[$tag['id']] = $this->createForm(RenameTagType::class, new Tag())->createView();
}
return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [ return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [
'tags' => $tags, 'tags' => $tags,
'renameForms' => $renameForms,
]); ]);
} }
@ -130,4 +137,48 @@ class TagController extends Controller
'tag' => $tag, 'tag' => $tag,
]); ]);
} }
/**
* Rename a given tag with a new label
* Create a new tag with the new name and drop the old one.
*
* @param Tag $tag
* @param Request $request
*
* @Route("/tag/rename/{slug}", name="tag_rename")
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function renameTagAction(Tag $tag, Request $request)
{
$form = $this->createForm(RenameTagType::class, new Tag());
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entries = $this->get('wallabag_core.entry_repository')->findAllByTagId(
$this->getUser()->getId(),
$tag->getId()
);
foreach ($entries as $entry) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
$entry,
$form->get('label')->getData()
);
$entry->removeTag($tag);
}
$em = $this->getDoctrine()->getManager();
$em->flush();
}
$this->get('session')->getFlashBag()->add(
'notice',
'flashes.tag.notice.tag_renamed'
);
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true);
return $this->redirect($redirectUrl);
}
} }

View file

@ -0,0 +1,35 @@
<?php
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class RenameTagType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('label', TextType::class, [
'required' => true,
'attr' => [
'placeholder' => 'tag.rename.placeholder',
],
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Wallabag\CoreBundle\Entity\Tag',
]);
}
public function getBlockPrefix()
{
return 'tag';
}
}

View file

@ -399,6 +399,8 @@ tag:
new: new:
# add: 'Add' # add: 'Add'
# placeholder: 'You can add several tags, separated by a comma.' # placeholder: 'You can add several tags, separated by a comma.'
rename:
# placeholder: 'You can update tag name.'
# export: # export:
# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' # footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
# tag_added: 'Tag added' # tag_added: 'Tag added'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
# failed: 'Import failed, please try again.' # failed: 'Import failed, please try again.'

View file

@ -399,6 +399,8 @@ tag:
new: new:
add: 'Hinzufügen' add: 'Hinzufügen'
placeholder: 'Du kannst verschiedene Tags, getrennt von einem Komma, hinzufügen.' placeholder: 'Du kannst verschiedene Tags, getrennt von einem Komma, hinzufügen.'
rename:
# placeholder: 'You can update tag name.'
export: export:
footer_template: '<div style="text-align:center;"><p>Generiert von wallabag mit Hilfe von %method%</p><p>Bitte öffne <a href="https://github.com/wallabag/wallabag/issues">ein Ticket</a> wenn du ein Problem mit der Darstellung von diesem E-Book auf deinem Gerät hast.</p></div>' footer_template: '<div style="text-align:center;"><p>Generiert von wallabag mit Hilfe von %method%</p><p>Bitte öffne <a href="https://github.com/wallabag/wallabag/issues">ein Ticket</a> wenn du ein Problem mit der Darstellung von diesem E-Book auf deinem Gerät hast.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'Tag hinzugefügt' tag_added: 'Tag hinzugefügt'
#tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: 'Import fehlgeschlagen, bitte erneut probieren.' failed: 'Import fehlgeschlagen, bitte erneut probieren.'

View file

@ -399,6 +399,8 @@ tag:
new: new:
add: 'Add' add: 'Add'
placeholder: 'You can add several tags, separated by a comma.' placeholder: 'You can add several tags, separated by a comma.'
rename:
placeholder: 'You can update tag name.'
export: export:
footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'Tag added' tag_added: 'Tag added'
tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: 'Import failed, please try again.' failed: 'Import failed, please try again.'

View file

@ -399,6 +399,8 @@ tag:
new: new:
add: 'Añadir' add: 'Añadir'
placeholder: 'Puedes añadir varias etiquetas, separadas por una coma.' placeholder: 'Puedes añadir varias etiquetas, separadas por una coma.'
rename:
# placeholder: 'You can update tag name.'
# export: # export:
# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' # footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'Etiqueta añadida' tag_added: 'Etiqueta añadida'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: 'Importación fallida, por favor, inténtelo de nuevo.' failed: 'Importación fallida, por favor, inténtelo de nuevo.'

View file

@ -399,6 +399,8 @@ tag:
new: new:
# add: 'Add' # add: 'Add'
# placeholder: 'You can add several tags, separated by a comma.' # placeholder: 'You can add several tags, separated by a comma.'
rename:
# placeholder: 'You can update tag name.'
# export: # export:
# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' # footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'برچسب افزوده شد' tag_added: 'برچسب افزوده شد'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: 'درون‌ریزی شکست خورد. لطفاً دوباره تلاش کنید.' failed: 'درون‌ریزی شکست خورد. لطفاً دوباره تلاش کنید.'

View file

@ -399,6 +399,8 @@ tag:
new: new:
add: "Ajouter" add: "Ajouter"
placeholder: "Vous pouvez ajouter plusieurs tags, séparés par une virgule." placeholder: "Vous pouvez ajouter plusieurs tags, séparés par une virgule."
rename:
placeholder: 'Vous pouvez changer le nom de votre tag.'
export: export:
footer_template: '<div style="text-align:center;"><p>Généré par wallabag with %method%</p><p>Merci d''ouvrir <a href="https://github.com/wallabag/wallabag/issues">un ticket</a> si vous rencontrez des soucis d''affichage avec ce document sur votre support.</p></div>' footer_template: '<div style="text-align:center;"><p>Généré par wallabag with %method%</p><p>Merci d''ouvrir <a href="https://github.com/wallabag/wallabag/issues">un ticket</a> si vous rencontrez des soucis d''affichage avec ce document sur votre support.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: "Tag ajouté" tag_added: "Tag ajouté"
tag_renamed: "Tag renommé"
import: import:
notice: notice:
failed: "Limport a échoué, veuillez ré-essayer" failed: "Limport a échoué, veuillez ré-essayer"

View file

@ -399,6 +399,8 @@ tag:
new: new:
add: 'Aggiungi' add: 'Aggiungi'
placeholder: 'Puoi aggiungere varie etichette, separate da una virgola.' placeholder: 'Puoi aggiungere varie etichette, separate da una virgola.'
rename:
# placeholder: 'You can update tag name.'
# export: # export:
# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' # footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'Etichetta aggiunta' tag_added: 'Etichetta aggiunta'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: 'Importazione fallita, riprova.' failed: 'Importazione fallita, riprova.'

View file

@ -399,6 +399,8 @@ tag:
new: new:
add: 'Ajustar' add: 'Ajustar'
placeholder: "Podètz ajustar mai qu'una etiqueta, separadas per de virgula." placeholder: "Podètz ajustar mai qu'una etiqueta, separadas per de virgula."
rename:
# placeholder: 'You can update tag name.'
export: export:
footer_template: '<div style="text-align:center;"><p>Produch per wallabag amb %method%</p><p>Mercés de dobrir <a href="https://github.com/wallabag/wallabag/issues">una sollicitacion</a> savètz de problèmas amb lafichatge daqueste E-Book sus vòstre periferic.</p></div>' footer_template: '<div style="text-align:center;"><p>Produch per wallabag amb %method%</p><p>Mercés de dobrir <a href="https://github.com/wallabag/wallabag/issues">una sollicitacion</a> savètz de problèmas amb lafichatge daqueste E-Book sus vòstre periferic.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'Etiqueta ajustada' tag_added: 'Etiqueta ajustada'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: "L'importacion a fracassat, mercés de tornar ensajar." failed: "L'importacion a fracassat, mercés de tornar ensajar."

View file

@ -399,6 +399,8 @@ tag:
new: new:
add: 'Dodaj' add: 'Dodaj'
placeholder: 'Możesz dodać kilka tagów, oddzielając je przecinkami.' placeholder: 'Możesz dodać kilka tagów, oddzielając je przecinkami.'
rename:
# placeholder: 'You can update tag name.'
export: export:
footer_template: '<div style="text-align:center;"><p>Stworzone przez wallabag z %method%</p><p>Proszę zgłoś <a href="https://github.com/wallabag/wallabag/issues">sprawę</a>, jeżeli masz problem z wyświetleniem tego e-booka na swoim urządzeniu.</p></div>' footer_template: '<div style="text-align:center;"><p>Stworzone przez wallabag z %method%</p><p>Proszę zgłoś <a href="https://github.com/wallabag/wallabag/issues">sprawę</a>, jeżeli masz problem z wyświetleniem tego e-booka na swoim urządzeniu.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'Tag dodany' tag_added: 'Tag dodany'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: 'Nieudany import, prosimy spróbować ponownie.' failed: 'Nieudany import, prosimy spróbować ponownie.'

View file

@ -399,6 +399,8 @@ tag:
new: new:
# add: 'Add' # add: 'Add'
# placeholder: 'You can add several tags, separated by a comma.' # placeholder: 'You can add several tags, separated by a comma.'
rename:
# placeholder: 'You can update tag name.'
# export: # export:
# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' # footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'Tag adicionada' tag_added: 'Tag adicionada'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: 'Importação falhou, por favor tente novamente.' failed: 'Importação falhou, por favor tente novamente.'

View file

@ -399,6 +399,8 @@ tag:
new: new:
# add: 'Add' # add: 'Add'
# placeholder: 'You can add several tags, separated by a comma.' # placeholder: 'You can add several tags, separated by a comma.'
rename:
# placeholder: 'You can update tag name.'
# export: # export:
# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' # footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
@ -585,6 +587,7 @@ flashes:
tag: tag:
notice: notice:
# tag_added: 'Tag added' # tag_added: 'Tag added'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
# failed: 'Import failed, please try again.' # failed: 'Import failed, please try again.'

View file

@ -387,6 +387,8 @@ tag:
new: new:
add: 'Добавить' add: 'Добавить'
placeholder: 'Вы можете добавить несколько тегов, разделенных запятой.' placeholder: 'Вы можете добавить несколько тегов, разделенных запятой.'
rename:
# placeholder: 'You can update tag name.'
import: import:
page_title: 'Импорт' page_title: 'Импорт'
@ -547,6 +549,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'Тег добавлен' tag_added: 'Тег добавлен'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: 'Во время импорта произошла ошибка, повторите попытку.' failed: 'Во время импорта произошла ошибка, повторите попытку.'

View file

@ -397,6 +397,8 @@ tag:
new: new:
add: 'เพิ่ม' add: 'เพิ่ม'
placeholder: 'คุณสามารถเพิ่มได้หลายแท็ก, จากการแบ่งโดย comma' placeholder: 'คุณสามารถเพิ่มได้หลายแท็ก, จากการแบ่งโดย comma'
rename:
# placeholder: 'You can update tag name.'
export: export:
footer_template: '<div style="text-align:center;"><p>ผลิตโดย wallabag กับ %method%</p><p>ให้ทำการเปิด <a href="https://github.com/wallabag/wallabag/issues">ฉบับนี้</a> ถ้าคุณมีข้อบกพร่องif you have trouble with the display of this E-Book on your device.</p></div>' footer_template: '<div style="text-align:center;"><p>ผลิตโดย wallabag กับ %method%</p><p>ให้ทำการเปิด <a href="https://github.com/wallabag/wallabag/issues">ฉบับนี้</a> ถ้าคุณมีข้อบกพร่องif you have trouble with the display of this E-Book on your device.</p></div>'
@ -583,6 +585,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'แท็กที่เพิ่ม' tag_added: 'แท็กที่เพิ่ม'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
failed: 'นำข้อมูลเข้าล้มเหลว, ลองใหม่อีกครั้ง' failed: 'นำข้อมูลเข้าล้มเหลว, ลองใหม่อีกครั้ง'

View file

@ -397,6 +397,8 @@ tag:
new: new:
# add: 'Add' # add: 'Add'
# placeholder: 'You can add several tags, separated by a comma.' # placeholder: 'You can add several tags, separated by a comma.'
rename:
# placeholder: 'You can update tag name.'
# export: # export:
# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' # footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
@ -563,6 +565,7 @@ flashes:
tag: tag:
notice: notice:
tag_added: 'Etiket eklendi' tag_added: 'Etiket eklendi'
# tag_renamed: 'Tag renamed'
import: import:
notice: notice:
# failed: 'Import failed, please try again.' # failed: 'Import failed, please try again.'

View file

@ -10,10 +10,22 @@
<ul> <ul>
{% for tag in tags %} {% for tag in tags %}
<li id="tag-{{ tag.id|e }}"> <li id="tag-{{ tag.id|e }}">
<a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{tag.label}} ({{ tag.nbEntries }})</a> <a href="{{ path('tag_entries', {'slug': tag.slug}) }}" data-handle="tag-link">{{ tag.label }}&nbsp;({{ tag.nbEntries }})</a>
{% if renameForms is defined and renameForms[tag.id] is defined %}
<form class="card-tag-form hidden" data-handle="tag-rename-form" action="{{ path('tag_rename', {'slug': tag.slug})}}" method="POST">
{{ form_widget(renameForms[tag.id].label, {'attr': {'value': tag.label}}) }}
{{ form_rest(renameForms[tag.id]) }}
</form>
<a class="card-tag-rename" data-handler="tag-rename" href="javascript:void(0);">
<i class="material-icons">mode_edit</i>
</a>
{% endif %}
{% if app.user.config.rssToken %}
<a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="right"> <a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="right">
<i class="material-icons md-24">rss_feed</i> <i class="material-icons md-24">rss_feed</i>
</a> </a>
{% endif %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View file

@ -13,7 +13,18 @@
<ul class="card-tag-labels"> <ul class="card-tag-labels">
{% for tag in tags %} {% for tag in tags %}
<li title="{{tag.label}} ({{ tag.nbEntries }})" id="tag-{{ tag.id }}"> <li title="{{tag.label}} ({{ tag.nbEntries }})" id="tag-{{ tag.id }}">
<a href="{{ path('tag_entries', {'slug': tag.slug}) }}" class="card-tag-link">{{tag.label}} ({{ tag.nbEntries }})</a> <a href="{{ path('tag_entries', {'slug': tag.slug}) }}" class="card-tag-link" data-handle="tag-link">
{{ tag.label }}&nbsp;({{ tag.nbEntries }})
</a>
{% if renameForms is defined and renameForms[tag.id] is defined %}
<form class="card-tag-form hidden" data-handle="tag-rename-form" action="{{ path('tag_rename', {'slug': tag.slug})}}" method="POST">
{{ form_widget(renameForms[tag.id].label, {'attr': {'value': tag.label}}) }}
{{ form_rest(renameForms[tag.id]) }}
</form>
<a class="card-tag-rename" data-handler="tag-rename" href="javascript:void(0);">
<i class="material-icons">mode_edit</i>
</a>
{% endif %}
{% if app.user.config.rssToken %} {% if app.user.config.rssToken %}
<a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="card-tag-rss"><i class="material-icons">rss_feed</i></a> <a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="card-tag-rss"><i class="material-icons">rss_feed</i></a>
{% endif %} {% endif %}

View file

@ -176,4 +176,49 @@ class TagControllerTest extends WallabagCoreTestCase
$em->remove($tag); $em->remove($tag);
$em->flush(); $em->flush();
} }
public function testRenameTagUsingTheFormInsideTagList()
{
$this->logInAs('admin');
$client = $this->getClient();
$tag = new Tag();
$tag->setLabel($this->tagName);
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl('http://0.0.0.0/foo');
$entry->addTag($tag);
$this->getEntityManager()->persist($entry);
$this->getEntityManager()->flush();
$this->getEntityManager()->clear();
// We make a first request to set an history and test redirection after tag deletion
$crawler = $client->request('GET', '/tag/list');
$form = $crawler->filter('#tag-' . $tag->getId() . ' form')->form();
$data = [
'tag[label]' => 'specific label',
];
$client->submit($form, $data);
$this->assertSame(302, $client->getResponse()->getStatusCode());
$freshEntry = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->find($entry->getId());
$tags = $freshEntry->getTags()->toArray();
foreach ($tags as $key => $item) {
$tags[$key] = $item->getLabel();
}
$this->assertFalse(array_search($tag->getLabel(), $tags, true), 'Previous tag is not attach to entry anymore.');
$newTag = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Tag')
->findOneByLabel('specific label');
$this->assertInstanceOf(Tag::class, $newTag, 'Tag "specific label" exists.');
$this->assertTrue($newTag->hasEntry($freshEntry), 'Tag "specific label" is assigned to the entry.');
}
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -80,8 +80,7 @@
"themes/_global/img/icons/shaarli.png": "themes/_global/img/icons/shaarli.png", "themes/_global/img/icons/shaarli.png": "themes/_global/img/icons/shaarli.png",
"themes/_global/img/icons/unmark-icon--black.png": "themes/_global/img/icons/unmark-icon--black.png", "themes/_global/img/icons/unmark-icon--black.png": "themes/_global/img/icons/unmark-icon--black.png",
"themes/_global/img/list.png": "themes/_global/img/list.png", "themes/_global/img/list.png": "themes/_global/img/list.png",
"themes/_global/img/logo-other_themes.png": "themes/_global/img/logo-other_themes.png", "themes/_global/img/logo-square.svg": "themes/_global/img/logo-square.svg",
"themes/_global/img/logo-square.png": "themes/_global/img/logo-square.png",
"themes/_global/img/logo-w.png": "themes/_global/img/logo-w.png", "themes/_global/img/logo-w.png": "themes/_global/img/logo-w.png",
"themes/_global/img/logo-wallabag.svg": "themes/_global/img/logo-wallabag.svg", "themes/_global/img/logo-wallabag.svg": "themes/_global/img/logo-wallabag.svg",
"themes/_global/img/table.png": "themes/_global/img/table.png" "themes/_global/img/table.png": "themes/_global/img/table.png"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
!function(o){function __webpack_require__(e){if(n[e])return n[e].exports;var p=n[e]={i:e,l:!1,exports:{}};return o[e].call(p.exports,p,p.exports,__webpack_require__),p.l=!0,p.exports}var n={};__webpack_require__.m=o,__webpack_require__.c=n,__webpack_require__.i=function(o){return o},__webpack_require__.d=function(o,n,e){__webpack_require__.o(o,n)||Object.defineProperty(o,n,{configurable:!1,enumerable:!0,get:e})},__webpack_require__.n=function(o){var n=o&&o.__esModule?function(){return o.default}:function(){return o};return __webpack_require__.d(n,"a",n),n},__webpack_require__.o=function(o,n){return Object.prototype.hasOwnProperty.call(o,n)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=52)}(Array(40).concat([function(o,n,e){function webpackContext(o){return e(webpackContextResolve(o))}function webpackContextResolve(o){var n=p[o];if(!(n+1))throw new Error("Cannot find module '"+o+"'.");return n}var p={"./appicon/apple-touch-icon-114.png":55,"./appicon/apple-touch-icon-120.png":56,"./appicon/apple-touch-icon-144.png":57,"./appicon/apple-touch-icon-152.png":58,"./appicon/apple-touch-icon-57.png":59,"./appicon/apple-touch-icon-72.png":60,"./appicon/apple-touch-icon-76.png":61,"./appicon/apple-touch-icon.png":62,"./appicon/favicon.ico":63,"./bg-select.png":64,"./icons/Diaspora-asterisk.svg":65,"./icons/carrot-icon--black.png":66,"./icons/carrot-icon--white.png":67,"./icons/diaspora-icon--black.png":68,"./icons/diaspora-icon--white.png":69,"./icons/scuttle.png":70,"./icons/shaarli.png":71,"./icons/unmark-icon--black.png":72,"./list.png":73,"./logo-other_themes.png":74,"./logo-square.png":75,"./logo-w.png":76,"./logo-wallabag.svg":77,"./table.png":78};webpackContext.keys=function(){return Object.keys(p)},webpackContext.resolve=webpackContextResolve,o.exports=webpackContext,webpackContext.id=40},,,,,,,function(o,n){},,,,,function(o,n,e){"use strict";e(47),function(o){o.keys().forEach(o)}(e(40))},,,function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-114.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-120.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-144.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-152.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-57.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-72.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-76.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/favicon.ico"},function(o,n,e){o.exports=e.p+"themes/_global/img/bg-select.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/icons/Diaspora-asterisk.svg"},function(o,n,e){o.exports=e.p+"themes/_global/img/icons/carrot-icon--black.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/icons/carrot-icon--white.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/icons/diaspora-icon--black.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/icons/diaspora-icon--white.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/icons/scuttle.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/icons/shaarli.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/icons/unmark-icon--black.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/list.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/logo-other_themes.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/logo-square.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/logo-w.png"},function(o,n,e){o.exports=e.p+"themes/_global/img/logo-wallabag.svg"},function(o,n,e){o.exports=e.p+"themes/_global/img/table.png"}])); !function(o){function __webpack_require__(e){if(n[e])return n[e].exports;var p=n[e]={i:e,l:!1,exports:{}};return o[e].call(p.exports,p,p.exports,__webpack_require__),p.l=!0,p.exports}var n={};__webpack_require__.m=o,__webpack_require__.c=n,__webpack_require__.i=function(o){return o},__webpack_require__.d=function(o,n,e){__webpack_require__.o(o,n)||Object.defineProperty(o,n,{configurable:!1,enumerable:!0,get:e})},__webpack_require__.n=function(o){var n=o&&o.__esModule?function(){return o.default}:function(){return o};return __webpack_require__.d(n,"a",n),n},__webpack_require__.o=function(o,n){return Object.prototype.hasOwnProperty.call(o,n)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=232)}({220:function(o,n,e){function webpackContext(o){return e(webpackContextResolve(o))}function webpackContextResolve(o){var n=p[o];if(!(n+1))throw new Error("Cannot find module '"+o+"'.");return n}var p={"./appicon/apple-touch-icon-114.png":235,"./appicon/apple-touch-icon-120.png":236,"./appicon/apple-touch-icon-144.png":237,"./appicon/apple-touch-icon-152.png":238,"./appicon/apple-touch-icon-57.png":239,"./appicon/apple-touch-icon-72.png":240,"./appicon/apple-touch-icon-76.png":241,"./appicon/apple-touch-icon.png":242,"./appicon/favicon.ico":243,"./bg-select.png":244,"./icons/Diaspora-asterisk.svg":245,"./icons/carrot-icon--black.png":246,"./icons/carrot-icon--white.png":247,"./icons/diaspora-icon--black.png":248,"./icons/diaspora-icon--white.png":249,"./icons/scuttle.png":250,"./icons/shaarli.png":251,"./icons/unmark-icon--black.png":252,"./list.png":253,"./logo-square.svg":254,"./logo-w.png":255,"./logo-wallabag.svg":256,"./table.png":257};webpackContext.keys=function(){return Object.keys(p)},webpackContext.resolve=webpackContextResolve,o.exports=webpackContext,webpackContext.id=220},227:function(o,n){},232:function(o,n,e){"use strict";e(227),function(o){o.keys().forEach(o)}(e(220))},235:function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-114.png"},236:function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-120.png"},237:function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-144.png"},238:function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-152.png"},239:function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-57.png"},240:function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-72.png"},241:function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon-76.png"},242:function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/apple-touch-icon.png"},243:function(o,n,e){o.exports=e.p+"themes/_global/img/appicon/favicon.ico"},244:function(o,n,e){o.exports=e.p+"themes/_global/img/bg-select.png"},245:function(o,n,e){o.exports=e.p+"themes/_global/img/icons/Diaspora-asterisk.svg"},246:function(o,n,e){o.exports=e.p+"themes/_global/img/icons/carrot-icon--black.png"},247:function(o,n,e){o.exports=e.p+"themes/_global/img/icons/carrot-icon--white.png"},248:function(o,n,e){o.exports=e.p+"themes/_global/img/icons/diaspora-icon--black.png"},249:function(o,n,e){o.exports=e.p+"themes/_global/img/icons/diaspora-icon--white.png"},250:function(o,n,e){o.exports=e.p+"themes/_global/img/icons/scuttle.png"},251:function(o,n,e){o.exports=e.p+"themes/_global/img/icons/shaarli.png"},252:function(o,n,e){o.exports=e.p+"themes/_global/img/icons/unmark-icon--black.png"},253:function(o,n,e){o.exports=e.p+"themes/_global/img/list.png"},254:function(o,n,e){o.exports=e.p+"themes/_global/img/logo-square.svg"},255:function(o,n,e){o.exports=e.p+"themes/_global/img/logo-w.png"},256:function(o,n,e){o.exports=e.p+"themes/_global/img/logo-wallabag.svg"},257:function(o,n,e){o.exports=e.p+"themes/_global/img/table.png"}});