]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #3319 from Quent-in/2.3
authorJérémy Benoist <j0k3r@users.noreply.github.com>
Thu, 10 Aug 2017 08:13:09 +0000 (10:13 +0200)
committerGitHub <noreply@github.com>
Thu, 10 Aug 2017 08:13:09 +0000 (10:13 +0200)
Translation : OC small changes

Makefile
src/Wallabag/CoreBundle/Controller/TagController.php
src/Wallabag/CoreBundle/Repository/EntryRepository.php
src/Wallabag/CoreBundle/Repository/TagRepository.php
src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml

index b33352616488d2c8a2c3a13d674f73714184eaf1..ffbe102a045c05f09ca3201322592e3ff153a111 100755 (executable)
--- 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
index f2ca58c6af004ee74d1b42ccc7d6865be38a8507..be2dff98b3b62fcb69849f505fba3be6e7659929 100644 (file)
@@ -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,
         ]);
     }
 
index 7f35bb9a19b6746ea665d34fab6de9acc4d853ec..d70d6ca6056d7e96b5445658326f809504694a26 100644 (file)
@@ -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.
index 213283e5d6d8b1da418a2eba536823fc152ec83e..5c45211f6beb1e2820e9ed5ddba79f95c10a04df 100644 (file)
@@ -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.
      *
index ab1b3d6307c16b78333ad0dfbe4a3a240ea45f53..c8e6cf6c78ea578eb27f1d0b7b08dfa093a092d5 100644 (file)
@@ -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ę'