Permalink
Browse files

perf(views): only draw menus when they are used

In a lot of cases a menu was drawn only to disregard it a few lines
later. This caused a load on the system that wasn't needed.
  • Loading branch information...
jeabakker committed Jul 2, 2015
1 parent ebfbef0 commit b9f85e4c06f675a4460e219d7b9368e5a5451581
@@ -46,18 +46,17 @@
$comments_link = '';
}
$metadata = elgg_view_menu('entity', array(
'entity' => $vars['entity'],
'handler' => 'blog',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
$subtitle = "$author_text $date $comments_link $categories";
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
$metadata = '';
$metadata = '';
if (!elgg_in_context('widgets')) {
// only show entity menu outside of widgets
$metadata = elgg_view_menu('entity', array(
'entity' => $vars['entity'],
'handler' => 'blog',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
}
if ($full) {
@@ -41,18 +41,17 @@
$comments_link = '';
}
$metadata = elgg_view_menu('entity', array(
'entity' => $vars['entity'],
'handler' => 'bookmarks',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
$subtitle = "$author_text $date $comments_link $categories";
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
$metadata = '';
$metadata = '';
if (!elgg_in_context('widgets') && !elgg_in_context('gallery')) {
// only show entity menu outside of widgets and gallery view
$metadata = elgg_view_menu('entity', array(
'entity' => $vars['entity'],
'handler' => 'bookmarks',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
}
if ($full && !elgg_in_context('gallery')) {
@@ -67,9 +67,9 @@
}
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
$metadata = '';
} else {
$metadata = '';
if (!elgg_in_context('widgets')) {
// only show entity menu outside of widgets
$metadata = elgg_view_menu('entity', array(
'entity' => $vars['entity'],
'handler' => 'discussion',
@@ -22,10 +22,9 @@
$date = elgg_view_friendly_time($reply->time_created);
// Do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
$metadata = '';
} else {
$metadata = '';
if (!elgg_in_context('widgets')) {
// only show entity menu outside of widgets
$metadata = elgg_view_menu('entity', array(
'entity' => $vars['entity'],
'handler' => 'discussion_reply',
@@ -40,18 +40,17 @@
$comments_link = '';
}
$metadata = elgg_view_menu('entity', array(
'entity' => $vars['entity'],
'handler' => 'file',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
$subtitle = "$author_text $date $comments_link $categories";
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
$metadata = '';
$metadata = '';
if (!elgg_in_context('widgets') && !elgg_in_context('gallery')) {
// only show entity menu outside of widgets and gallery view
$metadata = elgg_view_menu('entity', array(
'entity' => $vars['entity'],
'handler' => 'file',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
}
if ($full && !elgg_in_context('gallery')) {
@@ -1,23 +1,23 @@
<?php
<?php
/**
* Group entity view
*
*
* @package ElggGroups
*/
$group = $vars['entity'];
$icon = elgg_view_entity_icon($group, 'tiny', $vars);
$metadata = elgg_view_menu('entity', array(
'entity' => $group,
'handler' => 'groups',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
if (elgg_in_context('owner_block') || elgg_in_context('widgets')) {
$metadata = '';
$metadata = '';
if (!elgg_in_context('owner_block') && !elgg_in_context('widgets')) {
// only show entity menu outside of widgets and owner block
$metadata = elgg_view_menu('entity', array(
'entity' => $group,
'handler' => 'groups',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
}
@@ -42,7 +42,9 @@
<p class="elgg-subtext">$subtitle</p>
HTML;
$menu = '';
if (!elgg_in_context('widgets')) {
// only show annotation menu outside of widgets
$menu = elgg_view_menu('annotation', array(
'annotation' => $annotation,
'sort_by' => 'priority',
@@ -69,6 +69,7 @@
$subtitle = "$editor_text $comments_link $categories";
$metadata = '';
// do not show the metadata and controls in widget view
if (!elgg_in_context('widgets')) {
// If we're looking at a revision, display annotation menu
@@ -1,7 +1,7 @@
<?php
/**
* View a wire post
*
*
* @uses $vars['entity']
*/
@@ -31,18 +31,17 @@
$author_text = elgg_echo('byline', array($owner_link));
$date = elgg_view_friendly_time($post->time_created);
$metadata = elgg_view_menu('entity', array(
'entity' => $post,
'handler' => 'thewire',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
$subtitle = "$author_text $date";
// do not show the metadata and controls in widget view
$metadata = '';
if (elgg_in_context('widgets')) {
$metadata = '';
// only show entity menu outside of widgets
$metadata = elgg_view_menu('entity', array(
'entity' => $post,
'handler' => 'thewire',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
}
$params = array(
@@ -29,19 +29,18 @@
$title = elgg_view('output/url', $link_params);
}
$metadata = elgg_view_menu('entity', array(
'entity' => $entity,
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
if (elgg_in_context('owner_block') || elgg_in_context('widgets')) {
$metadata = '';
}
if (elgg_get_context() == 'gallery') {
echo $icon;
} else {
$metadata = '';
if (!elgg_in_context('owner_block') && !elgg_in_context('widgets')) {
$metadata = elgg_view_menu('entity', array(
'entity' => $entity,
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
}
if ($entity->isBanned()) {
$banned = elgg_echo('banned');
$params = array(

0 comments on commit b9f85e4

Please sign in to comment.