Skip to content
This repository has been archived by the owner on Mar 25, 2019. It is now read-only.

issue #717: Добавить в меню ссылки на создание материала #724

Merged
merged 1 commit into from Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 69 additions & 0 deletions profiles/drupalru/modules/drurum/drurum.install
@@ -0,0 +1,69 @@
<?php

/**
* @file Stores hooks for install and update the module.
*/


/**
* Add link to create content into User Menu.
*/
function drurum_update_7001() {
$tree = menu_load_links('user-menu');
$x = $right_weight = -50;
foreach ($tree as $item) {
if (!$item['plid']) {
$item['weight'] = $x++;
menu_link_save($item, $item);
// Finding place between link to Messages and Logout.
if ($item['link_path'] == 'messages') {
$right_weight = $x++;
}
}
}
$parent = array(
'link_path' => 'node/add',
'link_title' => 'Создать',
'menu_name' => 'user-menu',
'weight' => $right_weight,
'expanded' => 1,
'has_children' => 0,
'customized' => 1,
'language' => LANGUAGE_NONE,
'plid' => 0,
'module' => 'menu',
);
$plid = menu_link_save($parent);
$items = array(
array(
'link_path' => 'node/add/blog',
'link_title' => 'Запись в блог',
'menu_name' => 'user-menu',
'weight' => 0,
'language' => LANGUAGE_NONE,
'plid' => $plid,
'module' => 'menu',
),
array(
'link_path' => 'node/add/simple-event',
'link_title' => 'Событие',
'menu_name' => 'user-menu',
'weight' => 1,
'language' => LANGUAGE_NONE,
'plid' => $plid,
'module' => 'menu',
),
array(
'link_path' => 'node/add/organization',
'link_title' => 'Компания',
'menu_name' => 'user-menu',
'weight' => 2,
'language' => LANGUAGE_NONE,
'plid' => $plid,
'module' => 'menu',
),
);
foreach ($items as $item) {
menu_link_save($item);
}
}
39 changes: 38 additions & 1 deletion profiles/drupalru/themes/druru/css/style.css
Expand Up @@ -6909,7 +6909,8 @@ fieldset[disabled] .btn-accent.focus {
}
.navbar.navbar-default .nav > li > a:hover,
.navbar.navbar-default .nav > li > a:focus,
.navbar.navbar-default .nav > li > a.active {
.navbar.navbar-default .nav > li > a.active,
.navbar.navbar-default .nav > li > a.open {
color: #fff;
border-left-color: #df9b10;
}
Expand Down Expand Up @@ -6968,6 +6969,25 @@ fieldset[disabled] .btn-accent.focus {
border-top-color: #df9b10;
}
}
.navbar.navbar-default .nav > li.open > a {
color: #fff;
border-left-color: #df9b10;
}
.navbar.navbar-default .nav > li.open > a:before,
.navbar.navbar-default .nav > li.open > a:after {
width: 100%;
}
.navbar.navbar-default .nav > li.open > a:before {
height: 100%;
}
.navbar.navbar-default .nav > li.open > a:after {
height: 0;
}
@media screen and (min-width: 748px) {
.navbar.navbar-default .nav > li.open > a {
border-top-color: #df9b10;
}
}
.navbar .navbar-second {
background: rgba(0, 0, 0, 0.1);
}
Expand Down Expand Up @@ -8705,6 +8725,23 @@ body .main-content {
left: calc(50% - 11px);
top: calc(50% - 11px);
}
nav .dropdown-menu.dropdown-menu-right {
background: #5184aa;
border: 1px solid #376a90;
border-top: 0;
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.3);
margin-right: -1px;
padding: 0;
width: 200px;
}
nav .dropdown-menu.dropdown-menu-right li.leaf a {
padding: .6em 1.2em;
color: #fff;
}
nav .dropdown-menu.dropdown-menu-right li.leaf a:hover,
nav .dropdown-menu.dropdown-menu-right li.leaf a:focus {
background: #376a90;
}
.field.field-name-field-admin-message {
background: #dff0d8;
border: 1px solid #88c76e;
Expand Down
Expand Up @@ -114,7 +114,7 @@
vertical-align: bottom;
}

&:hover, &:focus, &.active {
&:hover, &:focus, &.active, &.open {
color: @navbar-default-link-hover-color;
border-left-color: @nav-item-active-border;
}
Expand All @@ -129,6 +129,27 @@
}
}
}

&.open {
> a {
color: @navbar-default-link-hover-color;
border-left-color: @nav-item-active-border;

&:before, &:after {
width: 100%;
}
&:before {
height: 100%;
}
&:after {
height: 0;
}

@media @tablet {
border-top-color: @nav-item-hover-border;
}
}
}
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions profiles/drupalru/themes/druru/less/drupal/components/_menu.less
Expand Up @@ -12,3 +12,23 @@
.loader-circle('small');
}
}

nav {
.dropdown-menu.dropdown-menu-right {
background: #5184aa;
border: 1px solid #376a90;
border-top: 0;
box-shadow: 0 4px 4px rgba(0, 0, 0, .3);
margin-right: -1px;
padding: 0;
width: 200px;

li.leaf a {
padding: .6em 1.2em;
color: #fff;
&:hover, &:focus {
background: #376a90;
}
}
}
}
9 changes: 8 additions & 1 deletion profiles/drupalru/themes/druru/theme/menu/menu-link.func.php
Expand Up @@ -21,7 +21,11 @@ function druru_menu_link(array $variables) {
elseif ((!empty($element['#original_link']['depth'])) && ($element['#original_link']['depth'] == 1)) {
// Add our own wrapper.
unset($element['#below']['#theme_wrappers']);
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
$second_calss = '';
if($element['#theme'] == 'menu_link__user_menu') {
$second_calss = 'dropdown-menu-right';
}
$sub_menu = "<ul class=\"dropdown-menu $second_calss\">" . drupal_render($element['#below']) . '</ul>';
// Generate as standard dropdown.
$element['#title'] .= ' <span class="caret"></span>';
$element['#attributes']['class'][] = 'dropdown';
Expand Down Expand Up @@ -92,6 +96,9 @@ function _druru_menu_link_fill_icons(&$element) {

case 'user/register':
_druru_menu_link_fill_icon($element, 'user-plus');

case 'node/add':
_druru_menu_link_fill_icon($element, 'plus');
break;

default:
Expand Down