From d8ed718aab99ad47897fb70ea9086fa704bb912b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 5 Oct 2014 17:29:09 +0200 Subject: Refactor javascript_vars.phtml Introduce kind of context objectin JavaScript See https://github.com/marienfressinaud/FreshRSS/issues/634 See https://github.com/marienfressinaud/FreshRSS/issues/655 --- p/scripts/global_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'p/scripts/global_view.js') diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index 7105520a6..6e1f61066 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -40,7 +40,7 @@ function load_panel(link) { function init_close_panel() { $("#panel .close").click(function () { - $("#panel").html('' + window.iconClose + ''); + $("#panel").html('' + icons['close'] + ''); init_close_panel(); $("#panel").slideToggle(); $("#overlay").fadeOut(); -- cgit v1.2.3 From 8a7bab3a55442f85553ab1d897084e89c10f7e05 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Oct 2014 19:35:22 +0200 Subject: Refactoring of indexController Global view has been moved to a different action (all is not working) See https://github.com/marienfressinaud/FreshRSS/issues/634 and https://github.com/marienfressinaud/FreshRSS/issues/655 --- app/Controllers/errorController.php | 2 +- app/Controllers/indexController.php | 33 +++++++++++++++----- app/layout/nav_menu.phtml | 2 +- app/views/helpers/view/global_view.phtml | 53 -------------------------------- app/views/index/global.phtml | 46 +++++++++++++++++++++++++++ app/views/index/index.phtml | 2 -- lib/lib_rss.php | 4 +++ p/scripts/global_view.js | 3 +- 8 files changed, 79 insertions(+), 66 deletions(-) delete mode 100644 app/views/helpers/view/global_view.phtml create mode 100644 app/views/index/global.phtml (limited to 'p/scripts/global_view.js') diff --git a/app/Controllers/errorController.php b/app/Controllers/errorController.php index 76ab930e0..6c080bea8 100644 --- a/app/Controllers/errorController.php +++ b/app/Controllers/errorController.php @@ -37,7 +37,7 @@ class FreshRSS_error_Controller extends Minz_ActionController { if ($this->view->errorMessage == '') { switch($code_int) { case 403: - $this->view->errorMessage = _t('forbidden_access'); + $this->view->errorMessage = _t('access_denied'); break; case 404: default: diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index f994e257c..e1ce71b28 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -1,5 +1,8 @@ array(_t('access_denied'))) - ); + Minz_Error::error(403); return; } elseif ($output !== 'rss') { // "hard" redirection is not required, just ask dispatcher to @@ -201,17 +201,34 @@ class FreshRSS_index_Controller extends Minz_ActionController { return false; } } + + /** + * This action displays the global view of FreshRSS. + */ + public function globalAction() { + if (!FreshRSS_Auth::hasAccess() && !Minz_Configuration::allowAnonymous()) { + Minz_Error::error(403); + } + + Minz_View::appendScript(Minz_Url::display('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); + + $catDAO = new FreshRSS_CategoryDAO(); + $this->view->categories = $catDAO->listCategories(); + } + /** + * This action displays the about page of FreshRSS. + */ public function aboutAction() { Minz_View::prependTitle(_t('about') . ' · '); } + /** + * This action displays logs of FreshRSS for the current user. + */ public function logsAction() { if (!FreshRSS_Auth::hasAccess()) { - Minz_Error::error( - 403, - array('error' => array(_t('access_denied'))) - ); + Minz_Error::error(403); } Minz_View::prependTitle(_t('logs') . ' · '); diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index bb9468ab1..1a26422df 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -240,7 +240,7 @@ - + diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml deleted file mode 100644 index ae8af820d..000000000 --- a/app/views/helpers/view/global_view.phtml +++ /dev/null @@ -1,53 +0,0 @@ -partial('nav_menu'); ?> - -entries)) { ?> -
- 'index', 'a' => 'index', 'params' => array()); - if (FreshRSS_Context::$conf->view_mode !== 'normal') { - $arUrl['params']['output'] = 'normal'; - } - $p = Minz_Request::param('state', ''); - if (($p != '') && (FreshRSS_Context::$conf->default_view !== $p)) { - $arUrl['params']['state'] = $p; - } - - foreach ($this->cat_aside as $cat) { - $feeds = $cat->feeds(); - if (!empty($feeds)) { -?> -
- - -
- -
- -
-
display_posts ? '' : ' class="hide_posts"'; ?>> - -
- - -
-

-

-
- diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml new file mode 100644 index 000000000..a72e431df --- /dev/null +++ b/app/views/index/global.phtml @@ -0,0 +1,46 @@ +partial('nav_menu'); ?> + +
+ 'index', + 'a' => 'index', + 'params' => array( + 'state' => FreshRSS_Context::$state + ) + ); + + foreach ($this->categories as $cat) { + $feeds = $cat->feeds(); + $url_base['params']['get'] = 'c_' . $cat->id(); + + if (!empty($feeds)) { +?> +
+ + +
    + nbNotRead(); + $error = $feed->inError() ? 'error ' : ''; + $empty = $feed->nbEntries() === 0 ? 'empty ' : ''; + $url_base['params']['get'] = 'f_' . $feed->id(); + ?> +
  • + ✇ + name(); ?> +
  • + +
+
+ +
+ +
+
display_posts ? '' : ' class="hide_posts"'; ?>> + +
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index a59063557..8b93461dd 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -7,8 +7,6 @@ if (FreshRSS_Auth::hasAccess() || Minz_Configuration::allowAnonymous()) { $this->renderHelper('view/normal_view'); } elseif ($output === 'reader') { $this->renderHelper('view/reader_view'); - } elseif ($output === 'global') { - $this->renderHelper('view/global_view'); } elseif ($output === 'rss') { $this->renderHelper('view/rss_view'); } else { diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 9abdf18ce..80eb206d2 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -60,6 +60,10 @@ function formatNumber($n, $precision = 0) { return str_replace(' ', ' ', //Espace insécable //TODO: remplacer par une espace _fine_ insécable number_format($n, $precision, '.', ' ')); //number_format does not seem to be Unicode-compatible } +function format_number($n, $precision = 0) { + // TODO: coding style, prefer THIS function. Remove formatNumber. + return formatNumber($n, $precision); +} function formatBytes($bytes, $precision = 2, $system = 'IEC') { if ($system === 'IEC') { diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index 6e1f61066..8c2e6c1a2 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -50,7 +50,8 @@ function init_close_panel() { } function init_global_view() { - $("#stream .box-category a").click(function () { + // TODO: should be based on generic classes. + $(".box a").click(function () { var link = $(this).attr("href"); load_panel(link); -- cgit v1.2.3 From fa0c7d75e6b9d01130f1c9518eef5f37d8e6d4ff Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 24 Oct 2014 13:50:08 +0200 Subject: Begin to fix global view --- app/layout/aside_feed.phtml | 6 ++-- app/views/index/global.phtml | 27 ++++++++++++------ p/scripts/global_view.js | 2 +- p/themes/Dark/dark.css | 3 -- p/themes/Origine/origine.css | 11 +++----- p/themes/Pafat/pafat.css | 4 --- p/themes/Screwdriver/screwdriver.css | 3 -- p/themes/base-theme/base.css | 3 -- p/themes/base-theme/template.css | 54 ++++++++++++------------------------ 9 files changed, 44 insertions(+), 69 deletions(-) (limited to 'p/scripts/global_view.js') diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index 12beba3a1..06e12a5cf 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -42,7 +42,7 @@ $c_show = $c_active && (!FreshRSS_Context::$conf->display_categories || FreshRSS_Context::$current_get['feed']); ?> -
  • +
  • name(); ?> @@ -53,13 +53,13 @@ foreach ($feeds as $feed) { $f_active = FreshRSS_Context::isCurrentGet('f_' . $feed->id()); ?> -
  • +
  • - ✇ name(); ?> + ✇ name(); ?>
  • diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml index ab63c409a..5159882ba 100644 --- a/app/views/index/global.phtml +++ b/app/views/index/global.phtml @@ -1,11 +1,20 @@ -partial('nav_menu'); ?> +partial('nav_menu'); + + $class = ''; + if (FreshRSS_Context::$conf->hide_read_feeds && + FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) && + !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) { + $class = ' state_unread'; + } +?> -
    +
    'index', 'a' => 'index', - 'params' => array() + 'params' => Minz_Request::params() ); foreach ($this->categories as $cat) { @@ -14,20 +23,20 @@ if (!empty($feeds)) { ?> -
    - +
    +
      nbNotRead(); - $error = $feed->inError() ? 'error ' : ''; - $empty = $feed->nbEntries() === 0 ? 'empty ' : ''; + $error = $feed->inError() ? ' error' : ''; + $empty = $feed->nbEntries() === 0 ? ' empty' : ''; $url_base['params']['get'] = 'f_' . $feed->id(); ?> -
    • +
    • ✇ - name(); ?> + name(); ?>
    diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index 8c2e6c1a2..14909f44e 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -9,7 +9,7 @@ function load_panel(link) { panel_loading = true; $.get(link, function (data) { - $("#panel").append($(".nav_menu, #stream .day, #stream .flux, #stream .pagination", data)); + $("#panel").append($(".nav_menu, #stream .day, #stream .flux, #stream .pagination, #stream.prompt", data)); $("#panel .nav_menu").children().not("#nav_menu_read_all").remove(); diff --git a/p/themes/Dark/dark.css b/p/themes/Dark/dark.css index 2b853a45c..25a3e66f6 100644 --- a/p/themes/Dark/dark.css +++ b/p/themes/Dark/dark.css @@ -852,9 +852,6 @@ a.btn { border-radius: 5px; text-align: left; } -#stream.global .category { - margin: 0; -} #stream.global .btn { width: auto; height: 2em; diff --git a/p/themes/Origine/origine.css b/p/themes/Origine/origine.css index b4465a717..7230aa128 100644 --- a/p/themes/Origine/origine.css +++ b/p/themes/Origine/origine.css @@ -593,7 +593,7 @@ a.btn { } /*=== Aside main page (categories) */ -.aside_feed .tree-folder-title > .title:not([data-unread="0"]):after { +.aside_feed .category .title:not([data-unread="0"]):after { position: absolute; right: 0; margin: 10px 0; @@ -603,6 +603,9 @@ a.btn { background: inherit; border-left: 1px solid #aaa; } +.feed .item-title:not([data-unread="0"]) { + font-weight: bold; +} /*=== Aside main page (feeds) */ .aside_feed .tree-folder-items > .item.empty.active { @@ -621,9 +624,6 @@ a.btn { .aside_feed .tree-folder-items > .item.error.active > a { color: #fff; } -.aside_feed .tree-folder-items > .item:not([data-unread="0"]) { - font-weight: bold; -} .aside_feed .tree-folder-items .dropdown-menu:after { left: 2px; } @@ -903,9 +903,6 @@ a.btn { text-align: left; box-shadow: 0 0 3px #bbb; } -#stream.global .category { - margin: 0; -} #stream.global .btn { width: auto; height: 2em; diff --git a/p/themes/Pafat/pafat.css b/p/themes/Pafat/pafat.css index cdbedbf22..84a485e13 100644 --- a/p/themes/Pafat/pafat.css +++ b/p/themes/Pafat/pafat.css @@ -914,10 +914,6 @@ a.btn { text-align: left; } -#stream.global .category { - margin: 0; -} - #stream.global .category:first-child { margin: 0; } diff --git a/p/themes/Screwdriver/screwdriver.css b/p/themes/Screwdriver/screwdriver.css index aa5758a90..5771bb68f 100644 --- a/p/themes/Screwdriver/screwdriver.css +++ b/p/themes/Screwdriver/screwdriver.css @@ -969,9 +969,6 @@ opacity: 1; box-shadow: 0 0 4px #171717; overflow:hidden; } -#stream.global .category { - margin: 0; -} #stream.global .btn { width: auto; height: 2em; diff --git a/p/themes/base-theme/base.css b/p/themes/base-theme/base.css index 4de5fa98a..53f59bbe5 100644 --- a/p/themes/base-theme/base.css +++ b/p/themes/base-theme/base.css @@ -668,9 +668,6 @@ a.btn { #stream.global .box-category { text-align: left; } -#stream.global .category { - margin: 0; -} #stream.global .btn { width: auto; height: 2em; diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index b07b579d0..1af7a73d6 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -289,6 +289,7 @@ a.btn { vertical-align: top; } .box .box-title { + position: relative; font-size: 1.2rem; font-weight: bold; text-align: center; @@ -400,22 +401,10 @@ a.btn { vertical-align: top; } -/*=== Aside main page (categories) */ -.aside_feed.state_unread .tree-folder:not(.active)[data-unread="0"], -.aside_feed.state_unread .tree-folder-items > .item:not(.active)[data-unread="0"] { - display: none; -} -.aside_feed .tree-folder-title > .title:not([data-unread="0"]):after { - content: attr(data-unread); -} - /*=== Aside main page (feeds) */ .aside_feed .tree-folder-items:not(.active) { display: none; } -.aside_feed .tree-folder-items > .item > a:not([data-unread="0"]):before { - content: "(" attr(data-unread) ") "; -} .aside_feed .tree-folder-items .dropdown-menu { left: 0; } @@ -612,32 +601,13 @@ br + br + br { /*=== GLOBAL VIEW */ /*================*/ -/*=== Category boxes */ - -/* TODO */ -#stream.global .box-category { - display: inline-block; - width: 19em; - max-width: 95%; - margin: 20px 10px; - border: 1px solid #ccc; - vertical-align: top; -} -#stream.global .category { - width: 100%; -} -#stream.global .btn { - display: block; -} -#stream.global .box-category .feeds { - display: block; - overflow: auto; +#stream.global { + text-align: center; } -#stream.global .box-category .feed { - width: 19em; - max-width: 90%; + +#stream.global .box { + text-align: left; } -/* TODO Date: Fri, 31 Oct 2014 16:43:05 +0100 Subject: Fix global view mark as read --- app/views/index/global.phtml | 5 +++-- p/scripts/global_view.js | 12 ++++++------ p/themes/base-theme/template.css | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'p/scripts/global_view.js') diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml index 0975a5a00..ae7f5ffbc 100644 --- a/app/views/index/global.phtml +++ b/app/views/index/global.phtml @@ -47,7 +47,8 @@ ?>
    -
    -
    display_posts ? '' : ' class="hide_posts"'; ?>> +
    +
    display_posts ? '' : ' class="hide_posts"'; ?>> +
    diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index 14909f44e..7d7ba22b5 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -24,12 +24,13 @@ function load_panel(link) { // en en ouvrant une autre ensuite, on se retrouve au même point de scroll $("#panel").scrollTop(0); - $('#panel').on('click', '#nav_menu_read_all > a, #nav_menu_read_all .item > a, #bigMarkAsRead', function () { + $('#panel').on('click', '#nav_menu_read_all button, #bigMarkAsRead', function () { + console.log($(this).attr("formaction")); $.ajax({ - url: $(this).attr("href"), + type: "POST", + url: $(this).attr("formaction"), async: false }); - //$("#panel .close").first().click(); window.location.reload(false); return false; }); @@ -39,9 +40,8 @@ function load_panel(link) { } function init_close_panel() { - $("#panel .close").click(function () { - $("#panel").html('' + icons['close'] + ''); - init_close_panel(); + $("#overlay .close").click(function () { + $("#panel").html(''); $("#panel").slideToggle(); $("#overlay").fadeOut(); diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index 79fe506f2..5ba621415 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -645,13 +645,13 @@ br + br + br { overflow: auto; background: #fff; } -#panel .close { +#overlay .close { position: fixed; top: 0; bottom: 0; left: 0; right: 0; display: block; } -#panel .close img { +#overlay .close img { display: none; } @@ -762,7 +762,7 @@ br + br + br { } #panel { - top: 0; bottom: 0; + top: 25px; bottom: 30px; left: 0; right: 0; } #panel .close { -- cgit v1.2.3