summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-06-02 16:09:42 (GMT)
committerAlex Pott2015-06-02 16:09:42 (GMT)
commiteed1c99c51b40db48754c3fa14f44da48fb2c8c5 (patch)
tree451bb2bcaa6cfeab717934d69d2a99dd77fb4e33
parent537da55a56a67173063aa78ba96dd72d2b8ab76c (diff)
Issue #2485375 by marieke_h, Manjit.Singh, MathieuSpil, LewisNyman, geertvd: Clean up shortcut CSS inline with our CSS standards
-rw-r--r--core/modules/shortcut/css/shortcut.icons.theme.css14
-rw-r--r--core/modules/shortcut/css/shortcut.theme.css12
-rw-r--r--core/modules/shortcut/shortcut.module10
-rw-r--r--core/modules/shortcut/src/Tests/ShortcutLinksTest.php14
-rw-r--r--core/themes/bartik/css/components/shortcut.css2
-rw-r--r--core/themes/bartik/css/print.css2
6 files changed, 29 insertions, 25 deletions
diff --git a/core/modules/shortcut/css/shortcut.icons.theme.css b/core/modules/shortcut/css/shortcut.icons.theme.css
index 54569c2..99812fd 100644
--- a/core/modules/shortcut/css/shortcut.icons.theme.css
+++ b/core/modules/shortcut/css/shortcut.icons.theme.css
@@ -17,24 +17,24 @@
/**
* Add/remove links.
*/
-.add-or-remove-shortcuts .icon {
+.shortcut-action__icon {
background: transparent url(../images/favstar.svg) no-repeat left top;
width: 20px;
height: 20px;
display: inline-block;
vertical-align: -2px;
}
-[dir="rtl"] .add-or-remove-shortcuts .icon {
+[dir="rtl"] .shortcut-action__icon {
background-image: url(../images/favstar-rtl.svg);
}
-.add-shortcut a:hover .icon,
-.add-shortcut a:focus .icon {
+.shortcut-action--add:hover .shortcut-action__icon,
+.shortcut-action--add:focus .shortcut-action__icon {
background-position: -20px top;
}
-.remove-shortcut .icon {
+.shortcut-action--remove .shortcut-action__icon {
background-position: -40px top;
}
-.remove-shortcut a:focus .icon,
-.remove-shortcut a:hover .icon {
+.shortcut-action--remove:focus .shortcut-action__icon,
+.shortcut-action--remove:hover .shortcut-action__icon {
background-position: -60px top;
}
diff --git a/core/modules/shortcut/css/shortcut.theme.css b/core/modules/shortcut/css/shortcut.theme.css
index 5b22f82..73d58c6 100644
--- a/core/modules/shortcut/css/shortcut.theme.css
+++ b/core/modules/shortcut/css/shortcut.theme.css
@@ -23,15 +23,15 @@
/**
* Add/remove links.
*/
-.add-or-remove-shortcuts {
+.shortcut-action {
display: inline-block;
margin-left: 0.3em; /* LTR */
}
-[dir="rtl"] .add-or-remove-shortcuts {
+[dir="rtl"] .shortcut-action {
margin-left: 0;
margin-right: 0.3em;
}
-.add-or-remove-shortcuts .text {
+.shortcut-action__message {
background: #000000;
background: rgba(0, 0, 0, 0.5);
border-radius: 5px;
@@ -49,12 +49,12 @@
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
-[dir="rtl"] .add-or-remove-shortcuts .text {
+[dir="rtl"] .shortcut-action__message {
margin-left: 0;
margin-right: 0.3em;
}
-.add-or-remove-shortcuts a:hover .text,
-.add-or-remove-shortcuts a:focus .text {
+.shortcut-action:hover .shortcut-action__message,
+.shortcut-action:focus .shortcut-action__message {
opacity: 1;
-ms-transform: translateY(-2px);
-webkit-transform: translateY(-2px);
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index ccca313..1d5c275 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -347,12 +347,16 @@ function shortcut_preprocess_page(&$variables) {
'shortcut/drupal.shortcut',
),
),
- '#prefix' => '<div class="add-or-remove-shortcuts ' . $link_mode . '-shortcut">',
'#type' => 'link',
- '#title' => SafeMarkup::format('<span class="icon"></span><span class="text">@text</span>', array('@text' => $link_text)),
+ '#title' => SafeMarkup::format('<span class="shortcut-action__icon"></span><span class="shortcut-action__message">@text</span>', array('@text' => $link_text)),
'#url' => Url::fromRoute($route_name, $route_parameters),
'#options' => array('query' => $query),
- '#suffix' => '</div>',
+ '#attributes' => array(
+ 'class' => array(
+ 'shortcut-action',
+ 'shortcut-action--' . $link_mode,
+ ),
+ ),
);
}
}
diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
index 3b5811f..52ec545 100644
--- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
@@ -243,23 +243,23 @@ class ShortcutLinksTest extends ShortcutTestBase {
->save();
$this->drupalGet('page-that-does-not-exist');
- $result = $this->xpath('//div[contains(@class, "add-shortcut")]');
+ $result = $this->xpath('//a[contains(@class, "shortcut-action--add")]');
$this->assertTrue(empty($result), 'Add to shortcuts link was not shown on a page not found.');
// The user does not have access to this path.
$this->drupalGet('admin/modules');
- $result = $this->xpath('//div[contains(@class, "add-shortcut")]');
+ $result = $this->xpath('//a[contains(@class, "shortcut-action--add")]');
$this->assertTrue(empty($result), 'Add to shortcuts link was not shown on a page the user does not have access to.');
- // Verify that the testing mechanism works by verifying the shortcut
- // link appears on admin/people.
- $this->drupalGet('admin/people');
- $result = $this->xpath('//div[contains(@class, "remove-shortcut")]');
+ // Verify that the testing mechanism works by verifying the shortcut link
+ // appears on admin/content.
+ $this->drupalGet('admin/content');
+ $result = $this->xpath('//a[contains(@class, "shortcut-action--remove")]');
$this->assertTrue(!empty($result), 'Remove from shortcuts link was shown on a page the user does have access to.');
// Verify that the shortcut link appears on routing only pages.
$this->drupalGet('router_test/test2');
- $result = $this->xpath('//div[contains(@class, "add-shortcut")]');
+ $result = $this->xpath('//a[contains(@class, "shortcut-action--add")]');
$this->assertTrue(!empty($result), 'Add to shortcuts link was shown on a page the user does have access to.');
}
diff --git a/core/themes/bartik/css/components/shortcut.css b/core/themes/bartik/css/components/shortcut.css
index 2262be8..36c28e0 100644
--- a/core/themes/bartik/css/components/shortcut.css
+++ b/core/themes/bartik/css/components/shortcut.css
@@ -10,6 +10,6 @@
[dir="rtl"] .shortcut-wrapper h1#page-title {
float: right;
}
-div.add-or-remove-shortcuts {
+.shortcut-action {
padding-top: 0.9em;
}
diff --git a/core/themes/bartik/css/print.css b/core/themes/bartik/css/print.css
index 58d1841..248fe6e 100644
--- a/core/themes/bartik/css/print.css
+++ b/core/themes/bartik/css/print.css
@@ -20,7 +20,7 @@ body {
#toolbar,
.site-footer,
.tabs,
-.add-or-remove-shortcuts {
+.shortcut-action {
display: none;
}
.one-sidebar #content,