From 9478e9827b2b1fd0b274c235a9c548b5d4534801 Mon Sep 17 00:00:00 2001 From: Etienne Pallier Date: Wed, 5 Jul 2017 13:29:28 +0200 Subject: [PATCH] refactorisation du code de pagination dans Template/Element/pagination.ctp --- README-LABINVENT.md | 6 +++--- src/Template/Categories/index.ctp | 14 ++++---------- src/Template/Documents/index.ctp | 10 ++-------- src/Template/Element/pagination.ctp | 17 +++++++++++++++++ src/Template/Element/pagination_with_first_and_last.ctp | 19 +++++++++++++++++++ src/Template/Emprunts/index.ctp | 7 +------ src/Template/Fichemetrologiques/index.ctp | 8 +------- src/Template/Formules/index.ctp | 8 +------- src/Template/Fournisseurs/index.ctp | 10 ++-------- src/Template/GroupesMetiers/index.ctp | 10 ++-------- src/Template/GroupesThematiques/index.ctp | 10 ++-------- src/Template/Layout/default.ctp | 2 +- src/Template/Materiels/index.ctp | 17 +---------------- src/Template/Organismes/index.ctp | 10 ++-------- src/Template/Sites/index.ctp | 10 ++-------- src/Template/SousCategories/index.ctp | 10 +--------- src/Template/Suivis/index.ctp | 7 +------ src/Template/SurCategories/index.ctp | 10 ++-------- src/Template/TypeDocuments/index.ctp | 10 ++-------- src/Template/TypeSuivis/index.ctp | 10 ++-------- src/Template/Unites/index.ctp | 10 ++-------- src/Template/Users/index.ctp | 10 ++-------- 22 files changed, 72 insertions(+), 153 deletions(-) create mode 100644 src/Template/Element/pagination.ctp create mode 100644 src/Template/Element/pagination_with_first_and_last.ctp diff --git a/README-LABINVENT.md b/README-LABINVENT.md index 54a3544..839671f 100755 --- a/README-LABINVENT.md +++ b/README-LABINVENT.md @@ -54,9 +54,9 @@ Logiciel testé et validé sur les configurations suivantes : VERSION ACTUELLE Date: 05/07/2017 -Version: 2.7.0.1 - -> Passage de Cakephp3.2 à 3.4, Phpunit 5 à 6, et compatibilité avec Php5.6 et 7 - (petit bugfix) +Version: 2.7.1 + - Petite amélioration script install + - bugfix pagination de toutes les listes index (maintenant, elles sont comme materiels/index) Version majeure en cours (2.7): https://projects.irap.omp.eu/versions/162 diff --git a/src/Template/Categories/index.ctp b/src/Template/Categories/index.ctp index af377fb..55a5f9f 100755 --- a/src/Template/Categories/index.ctp +++ b/src/Template/Categories/index.ctp @@ -32,16 +32,10 @@ - -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->first('<< ' . __(''), ['class' => 'prev']) ?> - Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> - Paginator->last(__('') . ' >>', ['class' => 'next']) ?> -
+ + element('pagination_with_first_and_last'); ?> + +
diff --git a/src/Template/Documents/index.ctp b/src/Template/Documents/index.ctp index c81226d..5381188 100755 --- a/src/Template/Documents/index.ctp +++ b/src/Template/Documents/index.ctp @@ -56,14 +56,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> +
diff --git a/src/Template/Element/pagination.ctp b/src/Template/Element/pagination.ctp new file mode 100644 index 0000000..1123e8f --- /dev/null +++ b/src/Template/Element/pagination.ctp @@ -0,0 +1,17 @@ + +
+
    +

    + + Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']); + echo $this->Paginator->prev('< ' . __(''), ['class' => 'prev disabled']); + echo $this->Paginator->numbers(['separator' => '']); + echo $this->Paginator->next(__('') . ' >', ['class' => 'next disabled']); + ?> +

    +
+
diff --git a/src/Template/Element/pagination_with_first_and_last.ctp b/src/Template/Element/pagination_with_first_and_last.ctp new file mode 100644 index 0000000..6446a73 --- /dev/null +++ b/src/Template/Element/pagination_with_first_and_last.ctp @@ -0,0 +1,19 @@ + +
+
    +

    + + Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']); + echo $this->Paginator->first('<< ' . __(''), ['class' => 'prev']); + echo $this->Paginator->prev('< ' . __(''), ['class' => 'prev disabled']); + echo $this->Paginator->numbers(['separator' => '']); + echo $this->Paginator->next(__('') . ' >', ['class' => 'next disabled']); + echo $this->Paginator->last(__('') . ' >>', ['class' => 'next']); + ?> +

    +
+
diff --git a/src/Template/Emprunts/index.ctp b/src/Template/Emprunts/index.ctp index 7eb28b0..b29f196 100755 --- a/src/Template/Emprunts/index.ctp +++ b/src/Template/Emprunts/index.ctp @@ -43,13 +43,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

+ element('pagination'); ?> -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
diff --git a/src/Template/Fichemetrologiques/index.ctp b/src/Template/Fichemetrologiques/index.ctp index f5f3e3f..3e23cb0 100644 --- a/src/Template/Fichemetrologiques/index.ctp +++ b/src/Template/Fichemetrologiques/index.ctp @@ -24,13 +24,7 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
+ element('pagination'); ?>
diff --git a/src/Template/Formules/index.ctp b/src/Template/Formules/index.ctp index b538626..9b185bf 100644 --- a/src/Template/Formules/index.ctp +++ b/src/Template/Formules/index.ctp @@ -34,13 +34,7 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
+ element('pagination'); ?> diff --git a/src/Template/Fournisseurs/index.ctp b/src/Template/Fournisseurs/index.ctp index b722e96..8a388a5 100644 --- a/src/Template/Fournisseurs/index.ctp +++ b/src/Template/Fournisseurs/index.ctp @@ -34,14 +34,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> +
diff --git a/src/Template/GroupesMetiers/index.ctp b/src/Template/GroupesMetiers/index.ctp index 0d4e2a5..c86d91b 100755 --- a/src/Template/GroupesMetiers/index.ctp +++ b/src/Template/GroupesMetiers/index.ctp @@ -37,14 +37,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> +
diff --git a/src/Template/GroupesThematiques/index.ctp b/src/Template/GroupesThematiques/index.ctp index b003714..8a9b9fd 100755 --- a/src/Template/GroupesThematiques/index.ctp +++ b/src/Template/GroupesThematiques/index.ctp @@ -33,14 +33,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> +
diff --git a/src/Template/Layout/default.ctp b/src/Template/Layout/default.ctp index cd7b434..1b3fd01 100755 --- a/src/Template/Layout/default.ctp +++ b/src/Template/Layout/default.ctp @@ -103,7 +103,7 @@ $cakeDescription = 'Labinvent 2'; - VERSION 2.7.0.1 (05/07/2017) + VERSION 2.7.1 (05/07/2017)
-
    -

    - - Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?> - Paginator->first('<< ' . __(''), ['class' => 'prev']) ?> - Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> - Paginator->last(__('') . ' >>', ['class' => 'next']) ?> -

    -
- + element('pagination_with_first_and_last'); ?> Form->end()?> -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> +
diff --git a/src/Template/Sites/index.ctp b/src/Template/Sites/index.ctp index bfdddaa..406d5c5 100755 --- a/src/Template/Sites/index.ctp +++ b/src/Template/Sites/index.ctp @@ -37,14 +37,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> +
diff --git a/src/Template/SousCategories/index.ctp b/src/Template/SousCategories/index.ctp index be78d5f..4e88037 100755 --- a/src/Template/SousCategories/index.ctp +++ b/src/Template/SousCategories/index.ctp @@ -32,16 +32,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

+ element('pagination'); ?> -
- Paginator->first('<< ' . __(''), ['class' => 'prev']) ?> - Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> - Paginator->last(__('') . ' >>', ['class' => 'next']) ?> -
-
diff --git a/src/Template/Suivis/index.ctp b/src/Template/Suivis/index.ctp index d728f8e..1f1a60a 100755 --- a/src/Template/Suivis/index.ctp +++ b/src/Template/Suivis/index.ctp @@ -51,13 +51,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

+ element('pagination'); ?> -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
diff --git a/src/Template/SurCategories/index.ctp b/src/Template/SurCategories/index.ctp index 3dfd2ca..731a3d8 100755 --- a/src/Template/SurCategories/index.ctp +++ b/src/Template/SurCategories/index.ctp @@ -28,14 +28,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> + diff --git a/src/Template/TypeDocuments/index.ctp b/src/Template/TypeDocuments/index.ctp index 8680d5f..48f2aaa 100755 --- a/src/Template/TypeDocuments/index.ctp +++ b/src/Template/TypeDocuments/index.ctp @@ -38,14 +38,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> + diff --git a/src/Template/TypeSuivis/index.ctp b/src/Template/TypeSuivis/index.ctp index 8759873..fbe0149 100755 --- a/src/Template/TypeSuivis/index.ctp +++ b/src/Template/TypeSuivis/index.ctp @@ -29,14 +29,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> + diff --git a/src/Template/Unites/index.ctp b/src/Template/Unites/index.ctp index 40792d8..4730685 100644 --- a/src/Template/Unites/index.ctp +++ b/src/Template/Unites/index.ctp @@ -37,14 +37,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> +
diff --git a/src/Template/Users/index.ctp b/src/Template/Users/index.ctp index 435558e..79e99a2 100755 --- a/src/Template/Users/index.ctp +++ b/src/Template/Users/index.ctp @@ -33,14 +33,8 @@ -

Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?>

- -
- Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?> - Paginator->numbers(['separator' => '']) ?> - Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?> -
- + element('pagination'); ?> +
-- libgit2 0.21.2