first import
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Toolbar style for Administration menu.
|
||||
*
|
||||
* Important: We cannot re-use toolbar.png from Toolbar module, since we cannot
|
||||
* reliably determine the path to it.
|
||||
*
|
||||
* @todo Separate shortcut functionality into own module/widget.
|
||||
*/
|
||||
|
||||
/* Adjust margin/height */
|
||||
html body.admin-menu {
|
||||
margin-top: 29px !important;
|
||||
}
|
||||
html body.admin-menu-with-shortcuts {
|
||||
margin-top: 65px !important;
|
||||
}
|
||||
/* Displace the core Toolbar, if concurrently output. */
|
||||
body div#toolbar.toolbar {
|
||||
top: 30px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base styles.
|
||||
*
|
||||
* We use a keyword for the toolbar font size to make it display consistently
|
||||
* across different themes, while still allowing browsers to resize the text.
|
||||
*/
|
||||
#admin-menu {
|
||||
font: normal small "Lucida Grande", Verdana, sans-serif;
|
||||
-moz-box-shadow: 0 -10px 20px 13px #000;
|
||||
-webkit-box-shadow: 0 -10px 20px 13px #000;
|
||||
box-shadow: 0 -10px 20px 13px #000;
|
||||
right: 0;
|
||||
width: auto;
|
||||
}
|
||||
#admin-menu-wrapper {
|
||||
font-size: .846em;
|
||||
padding: 5px 10px 0;
|
||||
}
|
||||
|
||||
#admin-menu .dropdown a {
|
||||
color: #fafafa;
|
||||
}
|
||||
|
||||
/* Remove border from all lists and actions */
|
||||
#admin-menu .dropdown .admin-menu-action a {
|
||||
border-left: 0;
|
||||
}
|
||||
#admin-menu .dropdown .admin-menu-icon > a {
|
||||
padding: 2px 10px 3px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Administration menu.
|
||||
*/
|
||||
#admin-menu .dropdown .admin-menu-icon > a span {
|
||||
vertical-align: text-bottom;
|
||||
width: 11px;
|
||||
height: 14px;
|
||||
display: block;
|
||||
background: url(toolbar.png) no-repeat 0 -45px;
|
||||
text-indent: -9999px;
|
||||
}
|
||||
#admin-menu > div > .dropdown > li > a {
|
||||
border-right: 0;
|
||||
margin-bottom: 4px;
|
||||
padding: 2px 10px 3px;
|
||||
}
|
||||
#admin-menu .dropdown .admin-menu-toolbar-category > a,
|
||||
#admin-menu .dropdown .admin-menu-action > a {
|
||||
border-radius: 10px;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
}
|
||||
#admin-menu .dropdown .admin-menu-toolbar-category > a.active-trail {
|
||||
text-shadow: #333 0 1px 0;
|
||||
background: url(toolbar.png) 0 0 repeat-x;
|
||||
}
|
||||
#admin-menu .dropdown .admin-menu-toolbar-category > a:hover {
|
||||
background-color: #444;
|
||||
}
|
||||
#admin-menu .dropdown .admin-menu-tab a {
|
||||
border-right: 0;
|
||||
}
|
||||
#admin-menu .dropdown li li.expandable ul {
|
||||
margin: -22px 0 0 160px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcuts toggle.
|
||||
*/
|
||||
#admin-menu .shortcut-toggle {
|
||||
cursor: pointer;
|
||||
background: url(toolbar.png) 0 -20px no-repeat;
|
||||
display: block;
|
||||
float: right;
|
||||
margin: 0 0 0 1.3em;
|
||||
text-indent: -9999px;
|
||||
overflow: hidden;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
}
|
||||
#admin-menu .shortcut-toggle:focus,
|
||||
#admin-menu .shortcut-toggle:hover {
|
||||
background-position: -50px -20px;
|
||||
}
|
||||
#admin-menu .shortcut-toggle.active {
|
||||
background-position: -25px -20px;
|
||||
}
|
||||
#admin-menu .shortcut-toggle.active:focus,
|
||||
#admin-menu .shortcut-toggle.active:hover {
|
||||
background-position: -75px -20px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcuts widget.
|
||||
*/
|
||||
#admin-menu .shortcut-toolbar {
|
||||
background-color: #666;
|
||||
clear: both;
|
||||
display: none;
|
||||
margin: 0 -10px;
|
||||
overflow: hidden;
|
||||
/* Align with icon; @see shortcut.css */
|
||||
padding-left: 5px;
|
||||
}
|
||||
#admin-menu .shortcut-toolbar.active {
|
||||
display: block;
|
||||
}
|
||||
/* Override theme list style; @see shortcut.css */
|
||||
#admin-menu .shortcut-toolbar ul {
|
||||
margin: 0;
|
||||
}
|
||||
/* @see toolbar.css */
|
||||
#admin-menu .shortcut-toolbar li {
|
||||
float: left;
|
||||
list-style-image: none;
|
||||
list-style-type: none;
|
||||
}
|
||||
#admin-menu .shortcut-toolbar a {
|
||||
display: block;
|
||||
}
|
||||
|
@@ -0,0 +1,12 @@
|
||||
name = Administration menu Toolbar style
|
||||
description = A better Toolbar.
|
||||
package = Administration
|
||||
core = 7.x
|
||||
dependencies[] = admin_menu
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-01-31
|
||||
version = "7.x-3.0-rc4"
|
||||
core = "7.x"
|
||||
project = "admin_menu"
|
||||
datestamp = "1359651687"
|
||||
|
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Installation functionality for Administration menu toolbar module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_install().
|
||||
*/
|
||||
function admin_menu_toolbar_install() {
|
||||
// Required to load JS/CSS in hook_init() after admin_menu.
|
||||
db_update('system')
|
||||
->fields(array('weight' => 101))
|
||||
->condition('type', 'module')
|
||||
->condition('name', 'admin_menu_toolbar')
|
||||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set module weight to a value higher than admin_menu.
|
||||
*
|
||||
* At this point, admin_menu should have a weight of 100. To account for
|
||||
* customized weights, we increase the weight relatively.
|
||||
*
|
||||
* @see admin_menu_toolbar_install()
|
||||
*/
|
||||
function admin_menu_toolbar_update_6300() {
|
||||
$weight = db_query("SELECT weight FROM {system} WHERE type = 'module' AND name = 'admin_menu'")->fetchField();
|
||||
$weight++;
|
||||
db_update('system')
|
||||
->fields(array('weight' => $weight))
|
||||
->condition('type', 'module')
|
||||
->condition('name', 'admin_menu_toolbar')
|
||||
->execute();
|
||||
}
|
||||
|
@@ -0,0 +1,56 @@
|
||||
(function($) {
|
||||
|
||||
Drupal.admin = Drupal.admin || {};
|
||||
Drupal.admin.behaviors = Drupal.admin.behaviors || {};
|
||||
|
||||
/**
|
||||
* @ingroup admin_behaviors
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Apply active trail highlighting based on current path.
|
||||
*
|
||||
* @todo Not limited to toolbar; move into core?
|
||||
*/
|
||||
Drupal.admin.behaviors.toolbarActiveTrail = function (context, settings, $adminMenu) {
|
||||
if (settings.admin_menu.toolbar && settings.admin_menu.toolbar.activeTrail) {
|
||||
$adminMenu.find('> div > ul > li > a[href="' + settings.admin_menu.toolbar.activeTrail + '"]').addClass('active-trail');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggles the shortcuts bar.
|
||||
*/
|
||||
Drupal.admin.behaviors.shortcutToggle = function (context, settings, $adminMenu) {
|
||||
var $shortcuts = $adminMenu.find('.shortcut-toolbar');
|
||||
if (!$shortcuts.length) {
|
||||
return;
|
||||
}
|
||||
var storage = window.localStorage || false;
|
||||
var storageKey = 'Drupal.admin_menu.shortcut';
|
||||
var $body = $(context).find('body');
|
||||
var $toggle = $adminMenu.find('.shortcut-toggle');
|
||||
$toggle.click(function () {
|
||||
var enable = !$shortcuts.hasClass('active');
|
||||
$shortcuts.toggleClass('active', enable);
|
||||
$toggle.toggleClass('active', enable);
|
||||
if (settings.admin_menu.margin_top) {
|
||||
$body.toggleClass('admin-menu-with-shortcuts', enable);
|
||||
}
|
||||
// Persist toggle state across requests.
|
||||
storage && enable ? storage.setItem(storageKey, 1) : storage.removeItem(storageKey);
|
||||
this.blur();
|
||||
return false;
|
||||
});
|
||||
|
||||
if (!storage || storage.getItem(storageKey)) {
|
||||
$toggle.trigger('click');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @} End of "ingroup admin_behaviors".
|
||||
*/
|
||||
|
||||
})(jQuery);
|
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Renders Administration menu like Toolbar (core) module.
|
||||
*
|
||||
* @todo Separate shortcut functionality into own module/widget.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORMID_alter().
|
||||
*/
|
||||
function admin_menu_toolbar_form_admin_menu_theme_settings_alter(&$form) {
|
||||
// Add the shortcut links as component on behalf of Shortcut module.
|
||||
$form['plugins']['admin_menu_components']['#options']['shortcut.links'] = t('Shortcuts');
|
||||
// The shortcut bar consists of two elements, so we target their class names
|
||||
// instead of cluttering the markup with additional IDs.
|
||||
$form['plugins']['admin_menu_components']['shortcut.links']['#attributes']['rel'] = '.shortcut-toggle, .shortcut-toolbar';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_page_build().
|
||||
*/
|
||||
function admin_menu_toolbar_page_build(&$page) {
|
||||
if (!isset($page['page_bottom']['admin_menu'])) {
|
||||
return;
|
||||
}
|
||||
$path = drupal_get_path('module', 'admin_menu_toolbar');
|
||||
$attached = &$page['page_bottom']['admin_menu']['#attached'];
|
||||
$options = array('every_page' => TRUE);
|
||||
|
||||
$attached['css'][$path . '/admin_menu_toolbar.css'] = $options;
|
||||
$attached['js'][$path . '/admin_menu_toolbar.js'] = $options;
|
||||
|
||||
// @todo Stop-gap fix until cached rendering is resolved.
|
||||
// @see http://drupal.org/node/1567622
|
||||
if (module_exists('shortcut')) {
|
||||
$attached['css'][drupal_get_path('module', 'shortcut') . '/shortcut.css'] = $options;
|
||||
}
|
||||
|
||||
$settings = array();
|
||||
// Add current path to support menu item highlighting.
|
||||
// @todo Compile real active trail here?
|
||||
$args = explode('/', $_GET['q']);
|
||||
if ($args[0] == 'admin' && !empty($args[1])) {
|
||||
$settings['activeTrail'] = url($args[0] . '/' . $args[1]);
|
||||
}
|
||||
elseif (drupal_is_front_page()) {
|
||||
$settings['activeTrail'] = url('<front>');
|
||||
}
|
||||
|
||||
$attached['js'][] = array(
|
||||
'data' => array('admin_menu' => array('toolbar' => $settings)),
|
||||
'type' => 'setting',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_admin_menu_output_build().
|
||||
*/
|
||||
function admin_menu_toolbar_admin_menu_output_build(&$content) {
|
||||
if (empty($content['#components']['shortcut.links']) && !$content['#complete']) {
|
||||
return;
|
||||
}
|
||||
// Add shortcuts toggle.
|
||||
$content['shortcut-toggle'] = array(
|
||||
'#access' => module_exists('shortcut'),
|
||||
'#weight' => -200,
|
||||
'#type' => 'link',
|
||||
'#title' => t('Show shortcuts'),
|
||||
'#href' => '',
|
||||
'#options' => array(
|
||||
'attributes' => array('class' => 'shortcut-toggle'),
|
||||
),
|
||||
);
|
||||
|
||||
// Add shortcuts bar.
|
||||
$content['shortcut'] = array(
|
||||
'#access' => module_exists('shortcut'),
|
||||
'#weight' => 200,
|
||||
'#prefix' => '<div class="shortcut-toolbar">',
|
||||
'#suffix' => '</div>',
|
||||
);
|
||||
$content['shortcut']['shortcuts'] = array(
|
||||
// Shortcut module's CSS relies on Toolbar module's markup.
|
||||
// @see http://drupal.org/node/1217038
|
||||
'#prefix' => '<div id="toolbar">',
|
||||
'#suffix' => '</div>',
|
||||
// @todo Links may contain .active-trail classes.
|
||||
'#pre_render' => array('shortcut_toolbar_pre_render'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_admin_menu_output_alter().
|
||||
*/
|
||||
function admin_menu_toolbar_admin_menu_output_alter(&$content) {
|
||||
// Add a class to top-level items for styling.
|
||||
if (isset($content['menu'])) {
|
||||
foreach (element_children($content['menu']) as $link) {
|
||||
$content['menu'][$link]['#attributes']['class'][] = 'admin-menu-toolbar-category';
|
||||
}
|
||||
}
|
||||
|
||||
// Alter icon.
|
||||
if (isset($content['icon'])) {
|
||||
unset($content['icon']['icon']['#theme']);
|
||||
$content['icon']['icon']['#title'] = '<span>' . t('Home') . '</span>';
|
||||
$content['icon']['icon']['#attributes']['class'][] = 'admin-menu-toolbar-category';
|
||||
}
|
||||
|
||||
// Alter user account link.
|
||||
if (isset($content['account'])) {
|
||||
$content['account']['account']['#title'] = t('Hello <strong>@username</strong>', array('@username' => $content['account']['account']['#title']));
|
||||
$content['account']['account']['#options']['html'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
BIN
sites/all/modules/admin_menu/admin_menu_toolbar/toolbar.png
Normal file
BIN
sites/all/modules/admin_menu/admin_menu_toolbar/toolbar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 558 B |
Reference in New Issue
Block a user