From 23812e5b48b7a4d4f0c275c0fbb3d244a582397c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 8 Oct 2017 19:43:03 -0700 Subject: ability to pin apps to the navbar when using named navbars --- Zotlabs/Lib/Apps.php | 7 +++++++ include/nav.php | 13 +++++++++++-- view/tpl/app_nav.tpl | 1 + view/tpl/navbar_tucson.tpl | 7 +++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 view/tpl/app_nav.tpl diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index c4f4038dc..f13fbe362 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -383,6 +383,13 @@ class Apps { $install_action = (($installed) ? t('Update') : t('Install')); $icon = ((strpos($papp['photo'],'icon:') === 0) ? substr($papp['photo'],5) : ''); + if($mode === 'navbar') { + return replace_macros(get_markup_template('app_nav.tpl'),array( + '$app' => $papp, + '$icon' => $icon, + )); + } + return replace_macros(get_markup_template('app.tpl'),array( '$app' => $papp, '$icon' => $icon, diff --git a/include/nav.php b/include/nav.php index 622717347..588104eda 100644 --- a/include/nav.php +++ b/include/nav.php @@ -261,10 +261,18 @@ EOT; if(\App::$nav_sel['active'] == $app['name']) $app['active'] = true; - if($is_owner) + if($is_owner) { $nav_apps[] = Zlib\Apps::app_render($app,'nav'); - elseif(! $is_owner && strpos($app['requires'], 'local_channel') === false) + if(strpos($app['categories'],'navbar_' . $template)) { + $navbar_apps[] = Zlib\Apps::app_render($app,'navbar'); + } + } + elseif(! $is_owner && strpos($app['requires'], 'local_channel') === false) { $nav_apps[] = Zlib\Apps::app_render($app,'nav'); + if(strpos($app['categories'],'navbar_' . $template)) { + $navbar_apps[] = Zlib\Apps::app_render($app,'navbar'); + } + } } $c = theme_include('navbar_' . $template . '.css'); @@ -294,6 +302,7 @@ EOT; '$help' => t('@name, #tag, ?doc, content'), '$pleasewait' => t('Please wait...'), '$nav_apps' => $nav_apps, + '$navbar_apps' => $navbar_apps, '$channel_menu' => get_config('system','channel_menu'), '$channel_thumb' => ((App::$profile) ? App::$profile['thumb'] : ''), '$channel_apps' => $channel_apps, diff --git a/view/tpl/app_nav.tpl b/view/tpl/app_nav.tpl new file mode 100644 index 000000000..1ee5adb70 --- /dev/null +++ b/view/tpl/app_nav.tpl @@ -0,0 +1 @@ +{{if $icon}}{{else}}{{/if}} diff --git a/view/tpl/navbar_tucson.tpl b/view/tpl/navbar_tucson.tpl index 15f06eda1..ace22a880 100755 --- a/view/tpl/navbar_tucson.tpl +++ b/view/tpl/navbar_tucson.tpl @@ -213,6 +213,13 @@