From 52a05f04891a76c0c66a69e8a75db65a9a4cd2cb Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 21 Jan 2017 14:40:24 -0500 Subject: [PATCH] Reorganize templates into subfolders --- app/controllers/about.php | 2 +- app/controllers/api.php | 2 +- app/controllers/auth.php | 4 +- app/controllers/bookmark.php | 2 +- app/controllers/config.php | 4 +- app/controllers/feed.php | 12 +++--- app/controllers/help.php | 8 +--- app/controllers/history.php | 4 +- app/controllers/item.php | 6 +-- app/controllers/opml.php | 2 +- app/controllers/profile.php | 4 +- app/controllers/search.php | 2 +- app/controllers/services.php | 2 +- app/controllers/users.php | 12 +++--- app/templates/{ => auth}/login.php | 0 .../{bookmarks.php => bookmarks/items.php} | 8 ++-- .../{ => common}/keyboard_shortcuts.php | 0 app/templates/common/menu.php | 38 ++++++++++++++++ .../{search_form.php => common/search.php} | 0 app/templates/{ => config}/about.php | 0 app/templates/{ => config}/api.php | 0 app/templates/{ => config}/help.php | 2 +- app/templates/{ => config}/help_layer.php | 2 +- app/templates/{ => config}/import.php | 0 .../{config.php => config/preferences.php} | 0 app/templates/{ => config}/services.php | 0 app/templates/database.php | 22 ---------- app/templates/{add.php => feeds/create.php} | 0 .../{edit_feed.php => feeds/edit.php} | 0 .../{feed_items.php => feeds/items.php} | 4 +- app/templates/{feeds.php => feeds/list.php} | 0 .../remove.php} | 0 .../flush.php} | 0 .../{history.php => history/items.php} | 7 +-- .../{show_item.php => item/show.php} | 0 app/templates/{ => items}/bookmark_links.php | 0 app/templates/{ => items}/item.php | 4 +- app/templates/{ => items}/paging.php | 0 app/templates/{ => items}/status_links.php | 0 app/templates/layout.php | 43 ++----------------- .../{search.php => search/items.php} | 7 +-- .../{unread_items.php => unread/items.php} | 6 +-- .../{new_user.php => users/create.php} | 0 .../{edit_user.php => users/edit.php} | 0 app/templates/{users.php => users/list.php} | 0 app/templates/{ => users}/profile.php | 0 .../remove.php} | 0 47 files changed, 93 insertions(+), 116 deletions(-) rename app/templates/{ => auth}/login.php (100%) rename app/templates/{bookmarks.php => bookmarks/items.php} (79%) rename app/templates/{ => common}/keyboard_shortcuts.php (100%) create mode 100644 app/templates/common/menu.php rename app/templates/{search_form.php => common/search.php} (100%) rename app/templates/{ => config}/about.php (100%) rename app/templates/{ => config}/api.php (100%) rename app/templates/{ => config}/help.php (97%) rename app/templates/{ => config}/help_layer.php (65%) rename app/templates/{ => config}/import.php (100%) rename app/templates/{config.php => config/preferences.php} (100%) rename app/templates/{ => config}/services.php (100%) delete mode 100644 app/templates/database.php rename app/templates/{add.php => feeds/create.php} (100%) rename app/templates/{edit_feed.php => feeds/edit.php} (100%) rename app/templates/{feed_items.php => feeds/items.php} (88%) rename app/templates/{feeds.php => feeds/list.php} (100%) rename app/templates/{confirm_remove_feed.php => feeds/remove.php} (100%) rename app/templates/{confirm_flush_items.php => history/flush.php} (100%) rename app/templates/{history.php => history/items.php} (84%) rename app/templates/{show_item.php => item/show.php} (100%) rename app/templates/{ => items}/bookmark_links.php (100%) rename app/templates/{ => items}/item.php (95%) rename app/templates/{ => items}/paging.php (100%) rename app/templates/{ => items}/status_links.php (100%) rename app/templates/{search.php => search/items.php} (69%) rename app/templates/{unread_items.php => unread/items.php} (84%) rename app/templates/{new_user.php => users/create.php} (100%) rename app/templates/{edit_user.php => users/edit.php} (100%) rename app/templates/{users.php => users/list.php} (100%) rename app/templates/{ => users}/profile.php (100%) rename app/templates/{confirm_remove_user.php => users/remove.php} (100%) diff --git a/app/controllers/about.php b/app/controllers/about.php index 07e3020..6e28118 100644 --- a/app/controllers/about.php +++ b/app/controllers/about.php @@ -12,7 +12,7 @@ use Miniflux\Helper; Router\get_action('about', function () { $user_id = SessionStorage::getInstance()->getUserId(); - Response\html(Template\layout('about', array( + Response\html(Template\layout('config/about', array( 'csrf' => Helper\generate_csrf(), 'config' => Model\Config\get_all($user_id), 'user' => Model\User\get_user_by_id_without_password($user_id), diff --git a/app/controllers/api.php b/app/controllers/api.php index 3dc68cb..2df429c 100644 --- a/app/controllers/api.php +++ b/app/controllers/api.php @@ -11,7 +11,7 @@ use Miniflux\Template; Router\get_action('api', function () { $user_id = SessionStorage::getInstance()->getUserId(); - Response\html(Template\layout('api', array( + Response\html(Template\layout('config/api', array( 'config' => Model\Config\get_all($user_id), 'user' => Model\User\get_user_by_id_without_password($user_id), 'menu' => 'config', diff --git a/app/controllers/auth.php b/app/controllers/auth.php index 9ab62c2..3ed6f93 100644 --- a/app/controllers/auth.php +++ b/app/controllers/auth.php @@ -27,7 +27,7 @@ Router\get_action('login', function () { Response\redirect('?action=unread'); } - Response\html(Template\load('login', array( + Response\html(Template\load('auth/login', array( 'errors' => array(), 'values' => array( 'csrf' => Helper\generate_csrf(), @@ -45,7 +45,7 @@ Router\post_action('login', function () { Response\redirect('?action=unread'); } - Response\html(Template\load('login', array( + Response\html(Template\load('auth/login', array( 'errors' => $errors, 'values' => $values + array('csrf' => Helper\generate_csrf()), ))); diff --git a/app/controllers/bookmark.php b/app/controllers/bookmark.php index 62f5fab..f455022 100644 --- a/app/controllers/bookmark.php +++ b/app/controllers/bookmark.php @@ -73,7 +73,7 @@ Router\get_action('bookmarks', function () { $feed_ids ); - Response\html(Template\layout('bookmarks', array( + Response\html(Template\layout('bookmarks/items', array( 'favicons' => Model\Favicon\get_items_favicons($items), 'original_marks_read' => Helper\config('original_marks_read'), 'order' => '', diff --git a/app/controllers/config.php b/app/controllers/config.php index 8fbe526..030ec9b 100644 --- a/app/controllers/config.php +++ b/app/controllers/config.php @@ -26,7 +26,7 @@ Router\get_action('generate-tokens', function () { Router\get_action('config', function () { $user_id = SessionStorage::getInstance()->getUserId(); - Response\html(Template\layout('config', array( + Response\html(Template\layout('config/preferences', array( 'errors' => array(), 'values' => Model\Config\get_all($user_id) + array('csrf' => Helper\generate_csrf()), 'languages' => Model\Config\get_languages(), @@ -61,7 +61,7 @@ Router\post_action('config', function () { Response\redirect('?action=config'); } - Response\html(Template\layout('config', array( + Response\html(Template\layout('config/preferences', array( 'errors' => $errors, 'values' => Model\Config\get_all($user_id) + array('csrf' => Helper\generate_csrf()), 'languages' => Model\Config\get_languages(), diff --git a/app/controllers/feed.php b/app/controllers/feed.php index a8b0269..5a8aec5 100644 --- a/app/controllers/feed.php +++ b/app/controllers/feed.php @@ -30,7 +30,7 @@ Router\get_action('edit-feed', function () { 'feed_group_ids' => Model\Group\get_feed_group_ids($feed_id) ); - Response\html(Template\layout('edit_feed', array( + Response\html(Template\layout('feeds/edit', array( 'values' => $values, 'errors' => array(), 'groups' => Model\Group\get_all($user_id), @@ -64,7 +64,7 @@ Router\post_action('edit-feed', function () { } } - Response\html(Template\layout('edit_feed', array( + Response\html(Template\layout('feeds/edit', array( 'values' => $values, 'errors' => $errors, 'groups' => Model\Group\get_all($user_id), @@ -78,7 +78,7 @@ Router\get_action('confirm-remove-feed', function () { $user_id = SessionStorage::getInstance()->getUserId(); $feed_id = Request\int_param('feed_id'); - Response\html(Template\layout('confirm_remove_feed', array( + Response\html(Template\layout('feeds/remove', array( 'feed' => Model\Feed\get_feed($user_id, $feed_id), 'menu' => 'feeds', 'title' => t('Confirmation') @@ -133,7 +133,7 @@ Router\get_action('feeds', function () { Response\redirect('?action=unread'); } - Response\html(Template\layout('feeds', array( + Response\html(Template\layout('feeds/list', array( 'favicons' => Model\Favicon\get_feeds_favicons($feeds), 'feeds' => $feeds, 'nothing_to_read' => $nothing_to_read, @@ -155,7 +155,7 @@ Router\get_action('add', function () { 'feed_group_ids' => array(), ); - Response\html(Template\layout('add', array( + Response\html(Template\layout('feeds/create', array( 'values' => $values + array('csrf' => Helper\generate_csrf()), 'errors' => array(), 'groups' => Model\Group\get_all($user_id), @@ -209,7 +209,7 @@ Router\action('subscribe', function () { SessionStorage::getInstance()->setFlashErrorMessage($error_message); } - Response\html(Template\layout('add', array( + Response\html(Template\layout('feeds/create', array( 'values' => $values + array('csrf' => Helper\generate_csrf()), 'groups' => Model\Group\get_all($user_id), 'menu' => 'feeds', diff --git a/app/controllers/help.php b/app/controllers/help.php index a03ede4..4f58dce 100644 --- a/app/controllers/help.php +++ b/app/controllers/help.php @@ -12,15 +12,9 @@ use Miniflux\Template; Router\get_action('help', function () { $user_id = SessionStorage::getInstance()->getUserId(); - Response\html(Template\layout('help', array( + Response\html(Template\layout('config/help', array( 'config' => Model\Config\get_all($user_id), 'menu' => 'config', 'title' => t('Help') ))); }); - -// Show help -Router\get_action('show-help', function () { - Response\html(Template\load('show_help')); -}); - diff --git a/app/controllers/history.php b/app/controllers/history.php index 690583f..c99da52 100644 --- a/app/controllers/history.php +++ b/app/controllers/history.php @@ -13,7 +13,7 @@ use Miniflux\Model; Router\get_action('history', function () { $params = items_list(Model\Item\STATUS_READ); - Response\html(Template\layout('history', $params + array( + Response\html(Template\layout('history/items', $params + array( 'title' => t('History') . ' (' . $params['nb_items'] . ')', 'menu' => 'history', ))); @@ -23,7 +23,7 @@ Router\get_action('history', function () { Router\get_action('confirm-flush-history', function () { $group_id = Request\int_param('group_id'); - Response\html(Template\layout('confirm_flush_items', array( + Response\html(Template\layout('history/flush', array( 'group_id' => $group_id, 'menu' => 'history', 'title' => t('Confirmation') diff --git a/app/controllers/item.php b/app/controllers/item.php index 49778c5..3087dad 100644 --- a/app/controllers/item.php +++ b/app/controllers/item.php @@ -20,7 +20,7 @@ Router\get_action('unread', function () { Response\redirect('?action='.$action.'¬hing_to_read=1'); } - Response\html(Template\layout('unread_items', $params + array( + Response\html(Template\layout('unread/items', $params + array( 'title' => 'Miniflux (' . $params['nb_items'] . ')', 'menu' => 'unread', ))); @@ -64,7 +64,7 @@ Router\get_action('show', function () { $item['enclosure_url'] = Handler\Proxy\rewrite_link($item['enclosure_url']); } - Response\html(Template\layout('show_item', array( + Response\html(Template\layout('item/show', array( 'item' => $item, 'feed' => $feed, 'item_nav' => isset($nav) ? $nav : null, @@ -85,7 +85,7 @@ Router\get_action('feed-items', function () { $items = Model\ItemFeed\get_all_items($user_id, $feed_id, $offset, Helper\config('items_per_page'), $order, $direction); $nb_items = Model\ItemFeed\count_items($user_id, $feed_id); - Response\html(Template\layout('feed_items', array( + Response\html(Template\layout('feeds/items', array( 'favicons' => Model\Favicon\get_favicons_by_feed_ids(array($feed['id'])), 'original_marks_read' => Helper\config('original_marks_read'), 'order' => $order, diff --git a/app/controllers/opml.php b/app/controllers/opml.php index af4081e..73d1b56 100644 --- a/app/controllers/opml.php +++ b/app/controllers/opml.php @@ -19,7 +19,7 @@ Router\get_action('export', function () { // OPML import form Router\get_action('import', function () { - Response\html(Template\layout('import', array( + Response\html(Template\layout('config/import', array( 'errors' => array(), 'menu' => 'feeds', 'title' => t('OPML Import') diff --git a/app/controllers/profile.php b/app/controllers/profile.php index e8fce4c..4ad4363 100644 --- a/app/controllers/profile.php +++ b/app/controllers/profile.php @@ -14,7 +14,7 @@ use Miniflux\Validator; Router\get_action('profile', function () { $user_id = SessionStorage::getInstance()->getUserId(); - Response\html(Template\layout('profile', array( + Response\html(Template\layout('users/profile', array( 'errors' => array(), 'values' => Model\User\get_user_by_id_without_password($user_id) + array('csrf' => Helper\generate_csrf()), 'menu' => 'config', @@ -40,7 +40,7 @@ Router\post_action('profile', function () { Response\redirect('?action=profile'); } - Response\html(Template\layout('profile', array( + Response\html(Template\layout('users/profile', array( 'errors' => $errors, 'values' => Model\User\get_user_by_id_without_password($user_id) + array('csrf' => Helper\generate_csrf()), 'menu' => 'config', diff --git a/app/controllers/search.php b/app/controllers/search.php index 47e5b28..9466949 100644 --- a/app/controllers/search.php +++ b/app/controllers/search.php @@ -22,7 +22,7 @@ Router\get_action('search', function() { $nb_items = Model\ItemSearch\count_items($user_id, $text); } - Response\html(Template\layout('search', array( + Response\html(Template\layout('search/items', array( 'favicons' => Model\Favicon\get_items_favicons($items), 'original_marks_read' => Helper\config('original_marks_read'), 'text' => $text, diff --git a/app/controllers/services.php b/app/controllers/services.php index a3fa059..9accb67 100644 --- a/app/controllers/services.php +++ b/app/controllers/services.php @@ -14,7 +14,7 @@ use Miniflux\Helper; Router\get_action('services', function () { $user_id = SessionStorage::getInstance()->getUserId(); - Response\html(Template\layout('services', array( + Response\html(Template\layout('config/services', array( 'errors' => array(), 'values' => Model\Config\get_all($user_id) + array('csrf' => Helper\generate_csrf()), 'menu' => 'config', diff --git a/app/controllers/users.php b/app/controllers/users.php index a4fd7a2..bfc8223 100644 --- a/app/controllers/users.php +++ b/app/controllers/users.php @@ -16,7 +16,7 @@ Router\get_action('users', function () { Response\text('Access Forbidden', 403); } - Response\html(Template\layout('users', array( + Response\html(Template\layout('users/list', array( 'users' => Model\User\get_all_users(), 'menu' => 'config', 'title' => t('Users'), @@ -28,7 +28,7 @@ Router\get_action('new-user', function () { Response\text('Access Forbidden', 403); } - Response\html(Template\layout('new_user', array( + Response\html(Template\layout('users/create', array( 'values' => array('csrf' => Helper\generate_csrf()), 'errors' => array(), 'menu' => 'config', @@ -55,7 +55,7 @@ Router\post_action('new-user', function () { Response\redirect('?action=users'); } - Response\html(Template\layout('new_user', array( + Response\html(Template\layout('users/create', array( 'values' => $values + array('csrf' => Helper\generate_csrf()), 'errors' => $errors, 'menu' => 'config', @@ -74,7 +74,7 @@ Router\get_action('edit-user', function () { Response\redirect('?action=users'); } - Response\html(Template\layout('edit_user', array( + Response\html(Template\layout('users/edit', array( 'values' => $user + array('csrf' => Helper\generate_csrf()), 'errors' => array(), 'menu' => 'config', @@ -103,7 +103,7 @@ Router\post_action('edit-user', function () { Response\redirect('?action=users'); } - Response\html(Template\layout('edit_user', array( + Response\html(Template\layout('users/edit', array( 'values' => $values + array('csrf' => Helper\generate_csrf()), 'errors' => $errors, 'menu' => 'config', @@ -116,7 +116,7 @@ Router\get_action('confirm-remove-user', function () { Response\text('Access Forbidden', 403); } - Response\html(Template\layout('confirm_remove_user', array( + Response\html(Template\layout('users/remove', array( 'user' => Model\User\get_user_by_id_without_password(Request\int_param('user_id')), 'csrf_token' => Helper\generate_csrf(), 'menu' => 'config', diff --git a/app/templates/login.php b/app/templates/auth/login.php similarity index 100% rename from app/templates/login.php rename to app/templates/auth/login.php diff --git a/app/templates/bookmarks.php b/app/templates/bookmarks/items.php similarity index 79% rename from app/templates/bookmarks.php rename to app/templates/bookmarks/items.php index 02fe84a..66b54d6 100644 --- a/app/templates/bookmarks.php +++ b/app/templates/bookmarks/items.php @@ -1,7 +1,8 @@

- + + @@ -24,7 +24,7 @@
- $item, 'menu' => $menu, 'offset' => $offset, @@ -36,6 +36,6 @@ )) ?> - $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction, 'group_id' => $group_id)) ?> + $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction, 'group_id' => $group_id)) ?>
diff --git a/app/templates/keyboard_shortcuts.php b/app/templates/common/keyboard_shortcuts.php similarity index 100% rename from app/templates/keyboard_shortcuts.php rename to app/templates/common/keyboard_shortcuts.php diff --git a/app/templates/common/menu.php b/app/templates/common/menu.php new file mode 100644 index 0000000..e63cbae --- /dev/null +++ b/app/templates/common/menu.php @@ -0,0 +1,38 @@ +
+ +
+ diff --git a/app/templates/search_form.php b/app/templates/common/search.php similarity index 100% rename from app/templates/search_form.php rename to app/templates/common/search.php diff --git a/app/templates/about.php b/app/templates/config/about.php similarity index 100% rename from app/templates/about.php rename to app/templates/config/about.php diff --git a/app/templates/api.php b/app/templates/config/api.php similarity index 100% rename from app/templates/api.php rename to app/templates/config/api.php diff --git a/app/templates/help.php b/app/templates/config/help.php similarity index 97% rename from app/templates/help.php rename to app/templates/config/help.php index 77a3ffa..5d14e66 100644 --- a/app/templates/help.php +++ b/app/templates/config/help.php @@ -15,7 +15,7 @@
- +

diff --git a/app/templates/help_layer.php b/app/templates/config/help_layer.php similarity index 65% rename from app/templates/help_layer.php rename to app/templates/config/help_layer.php index 8b62bc3..13be58e 100644 --- a/app/templates/help_layer.php +++ b/app/templates/config/help_layer.php @@ -1,6 +1,6 @@
×
- +
diff --git a/app/templates/import.php b/app/templates/config/import.php similarity index 100% rename from app/templates/import.php rename to app/templates/config/import.php diff --git a/app/templates/config.php b/app/templates/config/preferences.php similarity index 100% rename from app/templates/config.php rename to app/templates/config/preferences.php diff --git a/app/templates/services.php b/app/templates/config/services.php similarity index 100% rename from app/templates/services.php rename to app/templates/config/services.php diff --git a/app/templates/database.php b/app/templates/database.php deleted file mode 100644 index 1e2ddcc..0000000 --- a/app/templates/database.php +++ /dev/null @@ -1,22 +0,0 @@ - -
-
-
    -
  • -
  • -
  • -
-
-
diff --git a/app/templates/add.php b/app/templates/feeds/create.php similarity index 100% rename from app/templates/add.php rename to app/templates/feeds/create.php diff --git a/app/templates/edit_feed.php b/app/templates/feeds/edit.php similarity index 100% rename from app/templates/edit_feed.php rename to app/templates/feeds/edit.php diff --git a/app/templates/feed_items.php b/app/templates/feeds/items.php similarity index 88% rename from app/templates/feed_items.php rename to app/templates/feeds/items.php index 859043a..3e71070 100644 --- a/app/templates/feed_items.php +++ b/app/templates/feeds/items.php @@ -30,7 +30,7 @@
- $feed, 'item' => $item, 'menu' => $menu, @@ -47,7 +47,7 @@
- $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction, 'feed_id' => $feed['id'])) ?> + $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction, 'feed_id' => $feed['id'])) ?> diff --git a/app/templates/feeds.php b/app/templates/feeds/list.php similarity index 100% rename from app/templates/feeds.php rename to app/templates/feeds/list.php diff --git a/app/templates/confirm_remove_feed.php b/app/templates/feeds/remove.php similarity index 100% rename from app/templates/confirm_remove_feed.php rename to app/templates/feeds/remove.php diff --git a/app/templates/confirm_flush_items.php b/app/templates/history/flush.php similarity index 100% rename from app/templates/confirm_flush_items.php rename to app/templates/history/flush.php diff --git a/app/templates/history.php b/app/templates/history/items.php similarity index 84% rename from app/templates/history.php rename to app/templates/history/items.php index b5abb2f..3d348e4 100644 --- a/app/templates/history.php +++ b/app/templates/history/items.php @@ -1,7 +1,8 @@

- + + ') ?> %s') ?> - + + diff --git a/app/templates/search.php b/app/templates/search/items.php similarity index 69% rename from app/templates/search.php rename to app/templates/search/items.php index 7f0f992..ec3a5ac 100644 --- a/app/templates/search.php +++ b/app/templates/search/items.php @@ -1,4 +1,5 @@ - $text, 'opened' => true)) ?> + true, 'text' => $text)) ?> +

@@ -8,7 +9,7 @@
- $item, 'menu' => $menu, 'offset' => $offset, @@ -20,7 +21,7 @@ )) ?> - $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'text' => $text)) ?> + $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'text' => $text)) ?>
diff --git a/app/templates/unread_items.php b/app/templates/unread/items.php similarity index 84% rename from app/templates/unread_items.php rename to app/templates/unread/items.php index 3f06176..48aa63c 100644 --- a/app/templates/unread_items.php +++ b/app/templates/unread/items.php @@ -1,4 +1,4 @@ - + - $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction, 'group_id' => $group_id)) ?> + $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction, 'group_id' => $group_id)) ?> diff --git a/app/templates/new_user.php b/app/templates/users/create.php similarity index 100% rename from app/templates/new_user.php rename to app/templates/users/create.php diff --git a/app/templates/edit_user.php b/app/templates/users/edit.php similarity index 100% rename from app/templates/edit_user.php rename to app/templates/users/edit.php diff --git a/app/templates/users.php b/app/templates/users/list.php similarity index 100% rename from app/templates/users.php rename to app/templates/users/list.php diff --git a/app/templates/profile.php b/app/templates/users/profile.php similarity index 100% rename from app/templates/profile.php rename to app/templates/users/profile.php diff --git a/app/templates/confirm_remove_user.php b/app/templates/users/remove.php similarity index 100% rename from app/templates/confirm_remove_user.php rename to app/templates/users/remove.php