From: Jérémy Benoist Date: Thu, 10 Aug 2017 08:13:09 +0000 (+0200) Subject: Merge pull request #3319 from Quent-in/2.3 X-Git-Tag: 2.3.0~31^2~23 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=4d2758dfa0f12ff07da6cf907de7737f19219fea;hp=0d7d472c91b284906406698a7e12498d30c026bd;p=github%2Fwallabag%2Fwallabag.git Merge pull request #3319 from Quent-in/2.3 Translation : OC small changes --- diff --git a/Makefile b/Makefile index b3335261..ffbe102a 100755 --- a/Makefile +++ b/Makefile @@ -23,8 +23,8 @@ dev: ## Install the latest dev version run: ## Run the wallabag built-in server @php bin/console server:run --env=$(ENV) -build: ## Run grunt - @grunt +build: ## Run webpack + @npm run build:$(ENV) test: ## Launch wallabag testsuite @ant prepare && bin/simple-phpunit -v diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index f2ca58c6..be2dff98 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -84,28 +84,11 @@ class TagController extends Controller */ public function showTagAction() { - $repository = $this->get('wallabag_core.entry_repository'); $tags = $this->get('wallabag_core.tag_repository') - ->findAllTags($this->getUser()->getId()); - - $flatTags = []; - - foreach ($tags as $tag) { - $nbEntries = $repository->countAllEntriesByUserIdAndTagId( - $this->getUser()->getId(), - $tag->getId() - ); - - $flatTags[] = [ - 'id' => $tag->getId(), - 'label' => $tag->getLabel(), - 'slug' => $tag->getSlug(), - 'nbEntries' => $nbEntries, - ]; - } + ->findAllFlatTagsWithNbEntries($this->getUser()->getId()); return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [ - 'tags' => $flatTags, + 'tags' => $tags, ]); } diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 7f35bb9a..d70d6ca6 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -329,26 +329,6 @@ class EntryRepository extends EntityRepository return (int) $qb->getQuery()->getSingleScalarResult(); } - /** - * Count all entries for a tag and a user. - * - * @param int $userId - * @param int $tagId - * - * @return int - */ - public function countAllEntriesByUserIdAndTagId($userId, $tagId) - { - $qb = $this->createQueryBuilder('e') - ->select('count(e.id)') - ->leftJoin('e.tags', 't') - ->where('e.user=:userId')->setParameter('userId', $userId) - ->andWhere('t.id=:tagId')->setParameter('tagId', $tagId) - ; - - return (int) $qb->getQuery()->getSingleScalarResult(); - } - /** * Remove all entries for a user id. * Used when a user want to reset all informations. diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index 213283e5..5c45211f 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php @@ -62,6 +62,27 @@ class TagRepository extends EntityRepository return $tags; } + /** + * Find all tags (flat) per user with nb entries. + * + * @param int $userId + * + * @return array + */ + public function findAllFlatTagsWithNbEntries($userId) + { + return $this->createQueryBuilder('t') + ->select('t.id, t.label, t.slug, count(e.id) as nbEntries') + ->distinct(true) + ->leftJoin('t.entries', 'e') + ->where('e.user = :userId') + ->groupBy('t.id') + ->orderBy('t.slug') + ->setParameter('userId', $userId) + ->getQuery() + ->getArrayResult(); + } + /** * Used only in test case to get a tag for our entry. * diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index ab1b3d63..c8e6cf6c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -32,7 +32,7 @@ menu: save_link: 'Zapisz link' back_to_unread: 'Powrót do nieprzeczytanych artykułów' users_management: 'Zarządzanie użytkownikami' - # site_credentials: 'Site credentials' + site_credentials: 'Poświadczenia strony' top: add_new_entry: 'Dodaj nowy wpis' search: 'Szukaj' @@ -94,7 +94,7 @@ config: unread: 'Nieprzeczytane' starred: 'Oznaczone gwiazdką' archive: 'Archiwum' - # all: 'All' + all: 'Wszystkie' rss_limit: 'Link do RSS' form_user: two_factor_description: "Włączenie autoryzacji dwuetapowej oznacza, że będziesz otrzymywał maile z kodem przy każdym nowym, niezaufanym połączeniu" @@ -526,20 +526,20 @@ user: placeholder: Filtruj po nazwie użytkownika lub adresie e-mail site_credential: - # page_title: Site credentials management - # new_site_credential: Create a credential - # edit_site_credential: Edit an existing credential - # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc." + page_title: Zarządzanie poświadczeniami strony + new_site_credential: Stwórz nowe poświadczenie + edit_site_credential: Edytuj istniejące poświadczenie + description: "Tutaj możesz zarządzać wszystkim poświadczeniami wymaganymi przez strony (stwórz, edytuj i usuń ), takie jak paywall, autentykacja, itp." list: actions: Akcje edit_action: Edytuj yes: Tak no: Nie - # create_new_one: Create a new credential + create_new_one: Stwórz nowe poświadczenie form: - # username_label: 'Username' - # host_label: 'Host' - # password_label: 'Password' + username_label: 'Nazwa użytkownika' + host_label: 'Host' + password_label: 'Hasło' save: Zapisz delete: Usuń delete_confirm: Jesteś pewien? @@ -599,6 +599,6 @@ flashes: deleted: 'Użytkownik "%username%" usunięty' site_credential: notice: - # added: 'Site credential for "%host%" added' - # updated: 'Site credential for "%host%" updated' - # deleted: 'Site credential for "%host%" deleted' + added: 'Poświadczenie dla "%host%" dodane' + updated: 'Poświadczenie dla "%host%" zaktualizowane' + deleted: 'Poświadczenie dla "%host%" usuniętę'