Skip to content

Commit

Permalink
Issue #197: Removed all instances of compact_link.
Browse files Browse the repository at this point in the history
  • Loading branch information
ronliskey authored and quicksketch committed Sep 16, 2014
1 parent c5711ae commit 0c4bc5d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 114 deletions.
7 changes: 0 additions & 7 deletions core/modules/system/css/system.admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ div.admin .expert-link {
padding-left: 4px;
}

/**
* Markup generated by theme_system_compact_link().
*/
.compact-link {
margin: 0 0 0.5em 0;
}

/**
* Quick inline admin links.
*/
Expand Down
7 changes: 1 addition & 6 deletions core/modules/system/system.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2276,13 +2276,10 @@ function theme_admin_block_content($variables) {

if (!empty($content)) {
$class = 'admin-list';
if ($compact = system_admin_compact_mode()) {
$class .= ' compact';
}
$output .= '<dl class="' . $class . '">';
foreach ($content as $item) {
$output .= '<dt>' . l($item['title'], $item['href'], $item['localized_options']) . '</dt>';
if (!$compact && isset($item['description'])) {
if (isset($item['description'])) {
$output .= '<dd>' . filter_xss_admin($item['description']) . '</dd>';
}
}
Expand Down Expand Up @@ -2323,7 +2320,6 @@ function theme_admin_page($variables) {
}

$output = '<div class="admin clearfix">';
$output .= theme('system_compact_link');

foreach ($container as $id => $data) {
$output .= '<div class="' . $id . ' clearfix">';
Expand Down Expand Up @@ -2375,7 +2371,6 @@ function theme_system_admin_index($variables) {
}

$output = '<div class="admin clearfix">';
$output .= theme('system_compact_link');
foreach ($container as $id => $data) {
$output .= '<div class="' . $id . ' clearfix">';
$output .= $data;
Expand Down
62 changes: 0 additions & 62 deletions core/modules/system/system.module
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ function system_theme() {
'system_powered_by' => array(
'variables' => array(),
),
'system_compact_link' => array(
'variables' => array(),
),
));
}

Expand Down Expand Up @@ -555,13 +552,6 @@ function system_menu() {
'menu_name' => 'management',
'file' => 'system.admin.inc',
);
$items['admin/compact'] = array(
'title' => 'Compact mode',
'page callback' => 'system_admin_compact_page',
'access arguments' => array('access administration pages'),
'type' => MENU_CALLBACK,
'file' => 'system.admin.inc',
);
$items['admin/tasks'] = array(
'title' => 'Tasks',
'type' => MENU_DEFAULT_LOCAL_TASK,
Expand Down Expand Up @@ -3084,40 +3074,6 @@ function system_jump_menu_submit($form, &$form_state) {
$form_state['redirect'] = array($redirect['path'], $redirect);
}

/**
* Determines whether the current user is in compact mode.
*
* Compact mode shows certain administration pages with less description text,
* such as the configuration page and the permissions page.
*
* Whether the user is in compact mode is determined by a cookie, which is set
* for the user by system_admin_compact_page().
*
* If the user does not have the cookie, the default value is given by the
* system variable 'admin_compact_mode', which itself defaults to FALSE. This
* does not have a user interface to set it: it is a hidden variable which can
* be set in the settings.php file.
*
* @return
* TRUE when in compact mode, FALSE when in expanded mode.
*/
function system_admin_compact_mode() {
// PHP converts dots into underscores in cookie names to avoid problems with
// its parser, so we use a converted cookie name.
return isset($_COOKIE['Drupal_visitor_admin_compact_mode']) ? $_COOKIE['Drupal_visitor_admin_compact_mode'] : variable_get('admin_compact_mode', FALSE);
}

/**
* Menu callback; Sets whether the admin menu is in compact mode or not.
*
* @param $mode
* Valid values are 'on' and 'off'.
*/
function system_admin_compact_page($mode = 'off') {
user_cookie_save(array('admin_compact_mode' => ($mode == 'on')));
backdrop_goto();
}

/**
* Generate a list of tasks offered by a specified module.
*
Expand Down Expand Up @@ -3579,24 +3535,6 @@ function theme_system_powered_by() {
return '<span>' . t('Powered by <a href="@poweredby">Backdrop CMS</a>', array('@poweredby' => 'http://backdropcms.org')) . '</span>';
}

/**
* Returns HTML for a link to show or hide inline help descriptions.
*
* @ingroup themeable
*/
function theme_system_compact_link() {
$output = '<div class="compact-link">';
if (system_admin_compact_mode()) {
$output .= l(t('Show descriptions'), 'admin/compact/off', array('attributes' => array('title' => t('Expand layout to include descriptions.')), 'query' => backdrop_get_destination()));
}
else {
$output .= l(t('Hide descriptions'), 'admin/compact/on', array('attributes' => array('title' => t('Compress layout by hiding descriptions.')), 'query' => backdrop_get_destination()));
}
$output .= '</div>';

return $output;
}

/**
* Implements hook_image_toolkits().
*/
Expand Down
19 changes: 0 additions & 19 deletions core/modules/system/system.test
Original file line number Diff line number Diff line change
Expand Up @@ -2219,25 +2219,6 @@ class SystemAdminTestCase extends BackdropWebTestCase {
}
}
}

/**
* Test compact mode.
*/
function testCompactMode() {
$this->backdropGet('admin/compact/on');
$this->assertTrue($this->cookies['Backdrop.visitor.admin_compact_mode']['value'], 'Compact mode turns on.');
$this->backdropGet('admin/compact/on');
$this->assertTrue($this->cookies['Backdrop.visitor.admin_compact_mode']['value'], 'Compact mode remains on after a repeat call.');
$this->backdropGet('');
$this->assertTrue($this->cookies['Backdrop.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.');

$this->backdropGet('admin/compact/off');
$this->assertEqual($this->cookies['Backdrop.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode turns off.');
$this->backdropGet('admin/compact/off');
$this->assertEqual($this->cookies['Backdrop.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode remains off after a repeat call.');
$this->backdropGet('');
$this->assertTrue($this->cookies['Backdrop.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.');
}
}

/**
Expand Down
29 changes: 12 additions & 17 deletions core/modules/user/user.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ function user_admin_permissions($form, $form_state, $rid = NULL) {
// Render role/permission overview:
$options = array();
$module_info = system_get_info('module');
$hide_descriptions = system_admin_compact_mode();

// Get a list of all the modules implementing a hook_permission() and sort by
// display name.
Expand All @@ -751,7 +750,7 @@ function user_admin_permissions($form, $form_state, $rid = NULL) {
$form['permission'][$perm] = array(
'#type' => 'item',
'#markup' => $perm_item['title'],
'#description' => theme('user_permission_description', array('permission_item' => $perm_item, 'hide' => $hide_descriptions)),
'#description' => theme('user_permission_description', array('permission_item' => $perm_item)),
);
foreach ($role_names as $rid => $name) {
// Builds arrays for checked boxes for each role
Expand Down Expand Up @@ -835,7 +834,7 @@ function theme_user_admin_permissions($variables) {
foreach (element_children($form['role_names']) as $rid) {
$header[] = array('data' => backdrop_render($form['role_names'][$rid]), 'class' => array('checkbox'));
}
$output = theme('system_compact_link');
$output = '';
$output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'permissions')));
$output .= backdrop_render_children($form);
return $output;
Expand All @@ -851,24 +850,20 @@ function theme_user_admin_permissions($variables) {
* - description: The text of the permission description.
* - warning: A security-related warning message about the permission (if
* there is one).
* - hide: A boolean indicating whether or not the permission description was
* requested to be hidden rather than shown.
*
* @ingroup themeable
*/
function theme_user_permission_description($variables) {
if (!$variables['hide']) {
$description = array();
$permission_item = $variables['permission_item'];
if (!empty($permission_item['description'])) {
$description[] = $permission_item['description'];
}
if (!empty($permission_item['warning'])) {
$description[] = '<em class="permission-warning">' . $permission_item['warning'] . '</em>';
}
if (!empty($description)) {
return implode(' ', $description);
}
$description = array();
$permission_item = $variables['permission_item'];
if (!empty($permission_item['description'])) {
$description[] = $permission_item['description'];
}
if (!empty($permission_item['warning'])) {
$description[] = '<em class="permission-warning">' . $permission_item['warning'] . '</em>';
}
if (!empty($description)) {
return implode(' ', $description);
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/modules/user/user.module
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function user_theme() {
'file' => 'user.admin.inc',
),
'user_permission_description' => array(
'variables' => array('permission_item' => NULL, 'hide' => NULL),
'variables' => array('permission_item' => NULL),
'file' => 'user.admin.inc',
),
'user_signature' => array(
Expand Down
4 changes: 2 additions & 2 deletions core/themes/seven/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ function seven_admin_block_content($variables) {
$content = $variables['content'];
$output = '';
if (!empty($content)) {
$output = system_admin_compact_mode() ? '<ul class="admin-list compact">' : '<ul class="admin-list">';
$output = '<ul class="admin-list">';
foreach ($content as $item) {
$output .= '<li class="leaf">';
$output .= l($item['title'], $item['href'], $item['localized_options']);
if (isset($item['description']) && !system_admin_compact_mode()) {
if (isset($item['description'])) {
$output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
}
$output .= '</li>';
Expand Down

0 comments on commit 0c4bc5d

Please sign in to comment.