From c7b7c060a6f0c6866e05199e828053e6690e9413 Mon Sep 17 00:00:00 2001
From: Frederic Guillot <fred@kanboard.net>
Date: Sat, 18 Feb 2017 14:01:54 -0500
Subject: Improve category section

---
 app/Controller/CategoryController.php  | 48 +++++++++++++--------
 app/Locale/bs_BA/translations.php      |  4 +-
 app/Locale/cs_CZ/translations.php      |  4 +-
 app/Locale/da_DK/translations.php      |  4 +-
 app/Locale/de_DE/translations.php      |  4 +-
 app/Locale/el_GR/translations.php      |  4 +-
 app/Locale/es_ES/translations.php      |  4 +-
 app/Locale/fi_FI/translations.php      |  4 +-
 app/Locale/fr_FR/translations.php      |  4 +-
 app/Locale/hu_HU/translations.php      |  4 +-
 app/Locale/id_ID/translations.php      |  4 +-
 app/Locale/it_IT/translations.php      |  4 +-
 app/Locale/ja_JP/translations.php      |  4 +-
 app/Locale/ko_KR/translations.php      |  4 +-
 app/Locale/my_MY/translations.php      |  4 +-
 app/Locale/nb_NO/translations.php      |  4 +-
 app/Locale/nl_NL/translations.php      |  4 +-
 app/Locale/pl_PL/translations.php      |  4 +-
 app/Locale/pt_BR/translations.php      |  4 +-
 app/Locale/pt_PT/translations.php      |  4 +-
 app/Locale/ru_RU/translations.php      |  4 +-
 app/Locale/sr_Latn_RS/translations.php |  4 +-
 app/Locale/sv_SE/translations.php      |  4 +-
 app/Locale/th_TH/translations.php      |  4 +-
 app/Locale/tr_TR/translations.php      |  4 +-
 app/Locale/zh_CN/translations.php      |  4 +-
 app/Template/category/create.php       | 12 ++++++
 app/Template/category/index.php        | 77 ++++++++++++++++------------------
 28 files changed, 129 insertions(+), 108 deletions(-)
 create mode 100644 app/Template/category/create.php

(limited to 'app')

diff --git a/app/Controller/CategoryController.php b/app/Controller/CategoryController.php
index dd6e1c35..69bbad5a 100644
--- a/app/Controller/CategoryController.php
+++ b/app/Controller/CategoryController.php
@@ -34,20 +34,33 @@ class CategoryController extends BaseController
      * List of categories for a given project
      *
      * @access public
-     * @param  array $values
-     * @param  array $errors
      * @throws PageNotFoundException
      */
-    public function index(array $values = array(), array $errors = array())
+    public function index()
     {
         $project = $this->getProject();
 
         $this->response->html($this->helper->layout->project('category/index', array(
-            'categories' => $this->categoryModel->getList($project['id'], false),
-            'values' => $values + array('project_id' => $project['id']),
-            'errors' => $errors,
+            'categories' => $this->categoryModel->getAll($project['id']),
+            'project'    => $project,
+            'title'      => t('Categories'),
+        )));
+    }
+
+    /**
+     * Show form to create new category
+     *
+     * @param array $values
+     * @param array $errors
+     */
+    public function create(array $values = array(), array $errors = array())
+    {
+        $project = $this->getProject();
+
+        $this->response->html($this->template->render('category/create', array(
+            'values'  => $values + array('project_id' => $project['id']),
+            'errors'  => $errors,
             'project' => $project,
-            'title' => t('Categories')
         )));
     }
 
@@ -66,13 +79,14 @@ class CategoryController extends BaseController
         if ($valid) {
             if ($this->categoryModel->create($values) !== false) {
                 $this->flash->success(t('Your category have been created successfully.'));
-                return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
+                $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true);
+                return;
             } else {
-                $this->flash->failure(t('Unable to create your category.'));
+                $errors = array('name' => array(t('Another category with the same name exists in this project')));
             }
         }
 
-        return $this->index($values, $errors);
+        $this->create($values, $errors);
     }
 
     /**
@@ -88,11 +102,10 @@ class CategoryController extends BaseController
         $project = $this->getProject();
         $category = $this->getCategory();
 
-        $this->response->html($this->helper->layout->project('category/edit', array(
-            'values' => empty($values) ? $category : $values,
-            'errors' => $errors,
+        $this->response->html($this->template->render('category/edit', array(
+            'values'  => empty($values) ? $category : $values,
+            'errors'  => $errors,
             'project' => $project,
-            'title' => t('Categories')
         )));
     }
 
@@ -110,10 +123,10 @@ class CategoryController extends BaseController
 
         if ($valid) {
             if ($this->categoryModel->update($values)) {
-                $this->flash->success(t('Your category have been updated successfully.'));
+                $this->flash->success(t('This category has been updated successfully.'));
                 return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
             } else {
-                $this->flash->failure(t('Unable to update your category.'));
+                $this->flash->failure(t('Unable to update this category.'));
             }
         }
 
@@ -131,9 +144,8 @@ class CategoryController extends BaseController
         $category = $this->getCategory();
 
         $this->response->html($this->helper->layout->project('category/remove', array(
-            'project' => $project,
+            'project'  => $project,
             'category' => $category,
-            'title' => t('Remove a category')
         )));
     }
 
diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php
index 931588c4..7ca6e5df 100644
--- a/app/Locale/bs_BA/translations.php
+++ b/app/Locale/bs_BA/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategorije',
     'Your category have been created successfully.' => 'Uspješno kreirana kategorija.',
     'Unable to create your category.' => 'Nije moguće kreirati kategoriju.',
-    'Your category have been updated successfully.' => 'Kategorija je uspješno ažurirana',
-    'Unable to update your category.' => 'Nemoguće izmijeniti kategoriju',
+    'This category has been updated successfully.' => 'Kategorija je uspješno ažurirana',
+    'Unable to update this category.' => 'Nemoguće izmijeniti kategoriju',
     'Remove a category' => 'Ukloni kategoriju',
     'Category removed successfully.' => 'Kategorija uspešno uklonjena.',
     'Unable to remove this category.' => 'Nije moguće ukloniti kategoriju.',
diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php
index 239fae33..2b594585 100644
--- a/app/Locale/cs_CZ/translations.php
+++ b/app/Locale/cs_CZ/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategorie',
     'Your category have been created successfully.' => 'Kategorie byla úspěšně vytvořena.',
     'Unable to create your category.' => 'Kategorii nelze vytvořit.',
-    'Your category have been updated successfully.' => 'Kategorie byla úspěšně aktualizována.',
-    'Unable to update your category.' => 'Kategorii nelze aktualizovat.',
+    'This category has been updated successfully.' => 'Kategorie byla úspěšně aktualizována.',
+    'Unable to update this category.' => 'Kategorii nelze aktualizovat.',
     'Remove a category' => 'Odstranit kategorii',
     'Category removed successfully.' => 'Kategorie byla odstraněna.',
     'Unable to remove this category.' => 'Kategorie nemhla být odstraněna.',
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index 8c4643a7..478d71fe 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategorier',
     'Your category have been created successfully.' => 'Kategorien er oprettet.',
     'Unable to create your category.' => 'Kategorien kunne ikke oprettes.',
-    'Your category have been updated successfully.' => 'Kategorien er opdateret.',
-    'Unable to update your category.' => 'Kategorien kunne ikke opdateres.',
+    'This category has been updated successfully.' => 'Kategorien er opdateret.',
+    'Unable to update this category.' => 'Kategorien kunne ikke opdateres.',
     'Remove a category' => 'Fjern en kategori',
     'Category removed successfully.' => 'Kategorien er fjernet.',
     'Unable to remove this category.' => 'Kategorien kunne ikke fjernes.',
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 13e24442..02880efb 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategorien',
     'Your category have been created successfully.' => 'Kategorie erfolgreich erstellt.',
     'Unable to create your category.' => 'Erstellung der Kategorie nicht möglich.',
-    'Your category have been updated successfully.' => 'Kategorie erfolgreich aktualisiert.',
-    'Unable to update your category.' => 'Änderung der Kategorie nicht möglich.',
+    'This category has been updated successfully.' => 'Kategorie erfolgreich aktualisiert.',
+    'Unable to update this category.' => 'Änderung der Kategorie nicht möglich.',
     'Remove a category' => 'Kategorie löschen',
     'Category removed successfully.' => 'Kategorie erfolgreich gelöscht.',
     'Unable to remove this category.' => 'Löschen der Kategorie nicht möglich.',
diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php
index ad038068..3897b67b 100644
--- a/app/Locale/el_GR/translations.php
+++ b/app/Locale/el_GR/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Κατηγορίες',
     'Your category have been created successfully.' => 'Η κατηγορία δημιουργήθηκε.',
     'Unable to create your category.' => 'Δεν είναι δυνατή η δημιουργία της κατηγορίας.',
-    'Your category have been updated successfully.' => 'Η ενημέρωση της κατηγορίας καταχωρήθηκε με επιτυχία.',
-    'Unable to update your category.' => 'Δεν είναι δυνατή η ενημέρωση της κατηγορίας.',
+    'This category has been updated successfully.' => 'Η ενημέρωση της κατηγορίας καταχωρήθηκε με επιτυχία.',
+    'Unable to update this category.' => 'Δεν είναι δυνατή η ενημέρωση της κατηγορίας.',
     'Remove a category' => 'Διαγραφή κατηγορίας',
     'Category removed successfully.' => 'Η κατηγορία διεγράφει επιτυχώς.',
     'Unable to remove this category.' => 'Δεν είναι δυνατή η διαγραφή της κατηγορίας.',
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index 713beaa0..4f2da41d 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Categorías',
     'Your category have been created successfully.' => 'Se ha creado su categoría correctamente.',
     'Unable to create your category.' => 'No se puede crear su categoría.',
-    'Your category have been updated successfully.' => 'Se ha actualizado su categoría correctamente.',
-    'Unable to update your category.' => 'No se puede actualizar su categoría.',
+    'This category has been updated successfully.' => 'Se ha actualizado su categoría correctamente.',
+    'Unable to update this category.' => 'No se puede actualizar su categoría.',
     'Remove a category' => 'Eliminar una categoría',
     'Category removed successfully.' => 'Categoría eliminada correctamente.',
     'Unable to remove this category.' => 'No se puede eliminar esta categoría.',
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index 70280181..c6276e27 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategoriat',
     'Your category have been created successfully.' => 'Kategoria luotiin onnistuneesti.',
     'Unable to create your category.' => 'Kategorian luonti epäonnistui.',
-    'Your category have been updated successfully.' => 'Kategoriaa muokattiin onnistuneesti.',
-    'Unable to update your category.' => 'Kategorian muokkaaminen epäonnistui.',
+    'This category has been updated successfully.' => 'Kategoriaa muokattiin onnistuneesti.',
+    'Unable to update this category.' => 'Kategorian muokkaaminen epäonnistui.',
     'Remove a category' => 'Poista kategoria',
     'Category removed successfully.' => 'Kategoria poistettu onnistuneesti.',
     'Unable to remove this category.' => 'Kategorian poisto epäonnistui.',
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 58f64459..4b17b674 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Catégories',
     'Your category have been created successfully.' => 'Votre catégorie a été créée avec succès.',
     'Unable to create your category.' => 'Impossible de créer votre catégorie.',
-    'Your category have been updated successfully.' => 'Votre catégorie a été mise à jour avec succès.',
-    'Unable to update your category.' => 'Impossible de mettre à jour votre catégorie.',
+    'This category has been updated successfully.' => 'Cette catégorie a été mise à jour avec succès.',
+    'Unable to update this category.' => 'Impossible de mettre à jour cette catégorie.',
     'Remove a category' => 'Supprimer une catégorie',
     'Category removed successfully.' => 'Catégorie supprimée avec succès.',
     'Unable to remove this category.' => 'Impossible de supprimer cette catégorie.',
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index ff0386b5..4211ba3b 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategóriák',
     'Your category have been created successfully.' => 'Kategória sikeresen létrehozva.',
     'Unable to create your category.' => 'A kategória létrehozása nem lehetséges.',
-    'Your category have been updated successfully.' => 'Kategória sikeresen frissítve.',
-    'Unable to update your category.' => 'Kategória frissítése nem lehetséges.',
+    'This category has been updated successfully.' => 'Kategória sikeresen frissítve.',
+    'Unable to update this category.' => 'Kategória frissítése nem lehetséges.',
     'Remove a category' => 'Kategória törlése',
     'Category removed successfully.' => 'Kategória törlése megtörtént.',
     'Unable to remove this category.' => 'A kategória törlése nem lehetséges.',
diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php
index 9ec4efbb..4f4580cf 100644
--- a/app/Locale/id_ID/translations.php
+++ b/app/Locale/id_ID/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategori',
     'Your category have been created successfully.' => 'Kategori Anda berhasil dibuat.',
     'Unable to create your category.' => 'Tidak dapat membuat kategori Anda.',
-    'Your category have been updated successfully.' => 'Kategori Anda berhasil diperbarui.',
-    'Unable to update your category.' => 'Tidak dapat memperbarui kategori Anda.',
+    'This category has been updated successfully.' => 'Kategori Anda berhasil diperbarui.',
+    'Unable to update this category.' => 'Tidak dapat memperbarui kategori Anda.',
     'Remove a category' => 'Hapus kategori',
     'Category removed successfully.' => 'Kategori berhasil dihapus.',
     'Unable to remove this category.' => 'Tidak dapat menghapus kategori ini.',
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index b57e57a4..de901550 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Categorie',
     'Your category have been created successfully.' => 'La tua categoria è stata creata con successo.',
     'Unable to create your category.' => 'Impossibile creare la tua categoria.',
-    'Your category have been updated successfully.' => 'La tua categoria è stata aggiornata con successo.',
-    'Unable to update your category.' => 'Impossibile aggiornare la tua categoria.',
+    'This category has been updated successfully.' => 'La tua categoria è stata aggiornata con successo.',
+    'Unable to update this category.' => 'Impossibile aggiornare la tua categoria.',
     'Remove a category' => 'Cancella una categoria',
     'Category removed successfully.' => 'Categoria cancellata con successo.',
     'Unable to remove this category.' => 'Impossibile cancellare questa categoria.',
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 67a69c14..147159a2 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'カテゴリ',
     'Your category have been created successfully.' => 'カテゴリを作成しました。',
     'Unable to create your category.' => 'カテゴリの作成に失敗しました。',
-    'Your category have been updated successfully.' => 'カテゴリを更新しました。',
-    'Unable to update your category.' => 'カテゴリの更新に失敗しました。',
+    'This category has been updated successfully.' => 'カテゴリを更新しました。',
+    'Unable to update this category.' => 'カテゴリの更新に失敗しました。',
     'Remove a category' => 'カテゴリの削除',
     'Category removed successfully.' => 'カテゴリを削除しました。',
     'Unable to remove this category.' => 'カテゴリを削除できませんでした。',
diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php
index acacf7de..b42e728f 100644
--- a/app/Locale/ko_KR/translations.php
+++ b/app/Locale/ko_KR/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => '카테고리',
     'Your category have been created successfully.' => '카테고리를 작성했습니다.',
     'Unable to create your category.' => '카테고리의 작성에 실패했습니다.',
-    'Your category have been updated successfully.' => '카테고리를 갱신했습니다.',
-    'Unable to update your category.' => '카테고리의 갱신에 실패했습니다.',
+    'This category has been updated successfully.' => '카테고리를 갱신했습니다.',
+    'Unable to update this category.' => '카테고리의 갱신에 실패했습니다.',
     'Remove a category' => '카테고리의 삭제',
     'Category removed successfully.' => '카테고리를 삭제했습니다.',
     'Unable to remove this category.' => '카테고리를 삭제할 수 없었습니다.',
diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php
index 6c25e536..727506bd 100644
--- a/app/Locale/my_MY/translations.php
+++ b/app/Locale/my_MY/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategori',
     'Your category have been created successfully.' => 'Kategori anda berhasil dibuat.',
     'Unable to create your category.' => 'Tidak dapat membuat kategori anda.',
-    'Your category have been updated successfully.' => 'Kategori anda berhasil diperbaharui.',
-    'Unable to update your category.' => 'Tidak dapat memperbaharui kategori anda.',
+    'This category has been updated successfully.' => 'Kategori anda berhasil diperbaharui.',
+    'Unable to update this category.' => 'Tidak dapat memperbaharui kategori anda.',
     'Remove a category' => 'Hapus kategori',
     'Category removed successfully.' => 'Kategori berhasil dihapus.',
     'Unable to remove this category.' => 'Tidak dapat menghapus kategori ini.',
diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php
index 0d3603ef..2e290048 100644
--- a/app/Locale/nb_NO/translations.php
+++ b/app/Locale/nb_NO/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategorier',
     'Your category have been created successfully.' => 'Kategorien er opprettet.',
     'Unable to create your category.' => 'Kategorien kunne ikke opprettes.',
-    'Your category have been updated successfully.' => 'Kategorien er oppdatert.',
-    'Unable to update your category.' => 'Kategorien kunne ikke oppdateres.',
+    'This category has been updated successfully.' => 'Kategorien er oppdatert.',
+    'Unable to update this category.' => 'Kategorien kunne ikke oppdateres.',
     'Remove a category' => 'Fjern en kategori',
     'Category removed successfully.' => 'Kategorien er fjernet.',
     'Unable to remove this category.' => 'Kategorien kunne ikke fjernes.',
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index 0d14518d..001964b6 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Categorieën',
     'Your category have been created successfully.' => 'Categorie succesvol aangemaakt.',
     'Unable to create your category.' => 'Categorie aanmaken niet gelukt.',
-    'Your category have been updated successfully.' => 'Categorie succesvol aangepast.',
-    'Unable to update your category.' => 'Aanpassen van categorie niet gelukt.',
+    'This category has been updated successfully.' => 'Categorie succesvol aangepast.',
+    'Unable to update this category.' => 'Aanpassen van categorie niet gelukt.',
     'Remove a category' => 'Categorie verwijderen',
     'Category removed successfully.' => 'Categorie succesvol verwijderd.',
     'Unable to remove this category.' => 'Categorie verwijderen niet gelukt.',
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index d7c1d1e8..7f8887d7 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategorie',
     'Your category have been created successfully.' => 'Pomyślnie utworzono kategorię.',
     'Unable to create your category.' => 'Nie można tworzyć kategorii.',
-    'Your category have been updated successfully.' => 'Pomyślnie zaktualizowano kategorię',
-    'Unable to update your category.' => 'Nie można zaktualizować kategorii',
+    'This category has been updated successfully.' => 'Pomyślnie zaktualizowano kategorię',
+    'Unable to update this category.' => 'Nie można zaktualizować kategorii',
     'Remove a category' => 'Usuń kategorię',
     'Category removed successfully.' => 'Pomyślnie usunięto kategorię.',
     'Unable to remove this category.' => 'Nie można usunąć tej kategorii.',
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 554396e1..eef50b17 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Categorias',
     'Your category have been created successfully.' => 'Sua categoria foi criada com sucesso.',
     'Unable to create your category.' => 'Não foi possível criar a sua categoria.',
-    'Your category have been updated successfully.' => 'A sua categoria foi atualizada com sucesso.',
-    'Unable to update your category.' => 'Não foi possível atualizar a sua categoria.',
+    'This category has been updated successfully.' => 'A sua categoria foi atualizada com sucesso.',
+    'Unable to update this category.' => 'Não foi possível atualizar a sua categoria.',
     'Remove a category' => 'Remover uma categoria',
     'Category removed successfully.' => 'Categoria removida com sucesso.',
     'Unable to remove this category.' => 'Não foi possível remover esta categoria.',
diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php
index b8fdd4d7..44e0cf6a 100644
--- a/app/Locale/pt_PT/translations.php
+++ b/app/Locale/pt_PT/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Categorias',
     'Your category have been created successfully.' => 'A sua categoria foi criada com sucesso.',
     'Unable to create your category.' => 'Não foi possível criar a sua categoria.',
-    'Your category have been updated successfully.' => 'A sua categoria foi actualizada com sucesso.',
-    'Unable to update your category.' => 'Não foi possível actualizar a sua categoria.',
+    'This category has been updated successfully.' => 'A sua categoria foi actualizada com sucesso.',
+    'Unable to update this category.' => 'Não foi possível actualizar a sua categoria.',
     'Remove a category' => 'Remover uma categoria',
     'Category removed successfully.' => 'Categoria removida com sucesso.',
     'Unable to remove this category.' => 'Não foi possível remover esta categoria.',
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 5ee12b9b..6b4f7fb5 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Категории',
     'Your category have been created successfully.' => 'Категория создана.',
     'Unable to create your category.' => 'Не удалось создать категорию.',
-    'Your category have been updated successfully.' => 'Категория обновлена.',
-    'Unable to update your category.' => 'Не удалось обновить категорию.',
+    'This category has been updated successfully.' => 'Категория обновлена.',
+    'Unable to update this category.' => 'Не удалось обновить категорию.',
     'Remove a category' => 'Удалить категорию',
     'Category removed successfully.' => 'Категория удалена.',
     'Unable to remove this category.' => 'Не удалось удалить категорию.',
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index a24e7db2..cfd6286d 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategorije',
     'Your category have been created successfully.' => 'Uspešno kreirana kategorija.',
     'Unable to create your category.' => 'Nije moguće kreirati kategoriju.',
-    'Your category have been updated successfully.' => 'Kategorija je uspešno izmenjena',
-    'Unable to update your category.' => 'Nemoguće izmeniti kategoriju',
+    'This category has been updated successfully.' => 'Kategorija je uspešno izmenjena',
+    'Unable to update this category.' => 'Nemoguće izmeniti kategoriju',
     'Remove a category' => 'Obriši kategoriju',
     'Category removed successfully.' => 'Kategorija uspešno uklonjena.',
     'Unable to remove this category.' => 'Nije moguće ukloniti kategoriju.',
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index 51dee948..59948bb5 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Ange kategorier',
     'Your category have been created successfully.' => 'Din kategori har skapats',
     'Unable to create your category.' => 'Kunde inte skapa din kategori',
-    'Your category have been updated successfully.' => 'Din kategori har uppdaterats',
-    'Unable to update your category.' => 'Kunde inte uppdatera din kategori',
+    'This category has been updated successfully.' => 'Din kategori har uppdaterats',
+    'Unable to update this category.' => 'Kunde inte uppdatera din kategori',
     'Remove a category' => 'Ta bort en kategori',
     'Category removed successfully.' => 'Kategorin har tagits bort',
     'Unable to remove this category.' => 'Kunde inte ta bort denna kategori',
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 4234211d..33579591 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'หมวดหมู่',
     'Your category have been created successfully.' => 'สร้างหมวดหมู่เรียบร้อยแล้ว',
     'Unable to create your category.' => 'ไม่สามารถสร้างหมวดหมู่ได้',
-    'Your category have been updated successfully.' => 'ปรับปรุงหมวดเรียบร้อยแล้ว',
-    'Unable to update your category.' => 'ไม่สามารถปรับปรุงหมวดหมู่ได้',
+    'This category has been updated successfully.' => 'ปรับปรุงหมวดเรียบร้อยแล้ว',
+    'Unable to update this category.' => 'ไม่สามารถปรับปรุงหมวดหมู่ได้',
     'Remove a category' => 'ลบหมวดหมู่',
     'Category removed successfully.' => 'ลบหมวดเรียบร้อยแล้ว',
     'Unable to remove this category.' => 'ไม่สามารถลบหมวดหมู่ได้',
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index 6f4dd2e6..98331ae4 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => 'Kategoriler',
     'Your category have been created successfully.' => 'Kategori başarıyla oluşturuldu.',
     'Unable to create your category.' => 'Kategori oluşturulamadı.',
-    'Your category have been updated successfully.' => 'Kategori başarıyla güncellendi.',
-    'Unable to update your category.' => 'Kategori güncellenemedi.',
+    'This category has been updated successfully.' => 'Kategori başarıyla güncellendi.',
+    'Unable to update this category.' => 'Kategori güncellenemedi.',
     'Remove a category' => 'Bir kategoriyi sil',
     'Category removed successfully.' => 'Kategori başarıyla silindi.',
     'Unable to remove this category.' => 'Bu kategori silinemedi.',
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index 3800f239..358bce93 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -235,8 +235,8 @@ return array(
     'Categories' => '分类',
     'Your category have been created successfully.' => '成功为您创建分类。',
     'Unable to create your category.' => '无法为您创建分类。',
-    'Your category have been updated successfully.' => '成功为您更新分类。',
-    'Unable to update your category.' => '无法为您更新分类。',
+    'This category has been updated successfully.' => '成功为您更新分类。',
+    'Unable to update this category.' => '无法为您更新分类。',
     'Remove a category' => '移除一个分类',
     'Category removed successfully.' => '分类成功移除。',
     'Unable to remove this category.' => '无法移除该分类。',
diff --git a/app/Template/category/create.php b/app/Template/category/create.php
new file mode 100644
index 00000000..b12ff7fa
--- /dev/null
+++ b/app/Template/category/create.php
@@ -0,0 +1,12 @@
+<div class="page-header">
+    <h2><?= t('Add a new category') ?></h2>
+</div>
+<form method="post" action="<?= $this->url->href('CategoryController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off">
+    <?= $this->form->csrf() ?>
+    <?= $this->form->hidden('project_id', $values) ?>
+
+    <?= $this->form->label(t('Category Name'), 'name') ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?>
+
+    <?= $this->modal->submitButtons() ?>
+</form>
diff --git a/app/Template/category/index.php b/app/Template/category/index.php
index e93138fd..f7657be2 100644
--- a/app/Template/category/index.php
+++ b/app/Template/category/index.php
@@ -1,45 +1,42 @@
-<?php if (! empty($categories)): ?>
 <div class="page-header">
     <h2><?= t('Categories') ?></h2>
+    <ul>
+        <li>
+            <?= $this->modal->medium('plus', t('Add a new category'), 'CategoryController', 'create', array('project_id' => $project['id'])) ?>
+        </li>
+    </ul>
 </div>
-<table class="table-striped">
-    <tr>
-        <th><?= t('Category Name') ?></th>
-        <th class="column-8"><?= t('Actions') ?></th>
-    </tr>
-    <?php foreach ($categories as $category_id => $category_name): ?>
-    <tr>
-        <td><?= $this->text->e($category_name) ?></td>
-        <td>
-            <div class="dropdown">
-            <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
-            <ul>
-                <li>
-                    <?= $this->modal->medium('edit', t('Edit'), 'CategoryController', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id)) ?>
-                </li>
-                <li>
-                    <?= $this->modal->confirm('trash-o', t('Remove'), 'CategoryController', 'confirm', array('project_id' => $project['id'], 'category_id' => $category_id)) ?>
-                </li>
-            </ul>
-            </div>
-        </td>
-    </tr>
-    <?php endforeach ?>
-</table>
-<?php endif ?>
-
-<div class="page-header">
-    <h2><?= t('Add a new category') ?></h2>
-</div>
-<form method="post" action="<?= $this->url->href('CategoryController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off">
-
-    <?= $this->form->csrf() ?>
-    <?= $this->form->hidden('project_id', $values) ?>
+<?php if (empty($categories)): ?>
+    <p class="alert"><?= t('There is no category in this project.') ?></p>
+<?php else: ?>
+    <table class="table-striped">
+        <tr>
+            <th><?= t('Category Name') ?></th>
+        </tr>
+        <?php foreach ($categories as $category): ?>
+        <tr>
+            <td>
+                <div class="dropdown">
+                    <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog"></i><i class="fa fa-caret-down"></i></a>
+                    <ul>
+                        <li>
+                            <?= $this->modal->medium('edit', t('Edit'), 'CategoryController', 'edit', array('project_id' => $project['id'], 'category_id' => $category['id'])) ?>
+                        </li>
+                        <li>
+                            <?= $this->modal->confirm('trash-o', t('Remove'), 'CategoryController', 'confirm', array('project_id' => $project['id'], 'category_id' => $category['id'])) ?>
+                        </li>
+                    </ul>
+                </div>
 
-    <?= $this->form->label(t('Category Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?>
+                <?= $this->text->e($category['name']) ?>
 
-    <div class="form-actions">
-        <button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
-    </div>
-</form>
+                <?php if (! empty($category['description'])): ?>
+                    <span class="tooltip" title="<?= $this->text->markdownAttribute($category['description']) ?>">
+                        <i class="fa fa-info-circle"></i>
+                    </span>
+                <?php endif ?>
+            </td>
+        </tr>
+        <?php endforeach ?>
+    </table>
+<?php endif ?>
-- 
cgit v1.2.3