From 0cde7656b1d883712a66a6004ef2e719e242929b Mon Sep 17 00:00:00 2001 From: Florian Kraft Date: Thu, 9 Apr 2015 18:40:45 +0200 Subject: [PATCH] kill the loops and branches with fire removes the @each and @ifs and makes the tooltip code a bit more readable --- app/assets/stylesheets/content/_tooltips.sass | 83 +++++++++---------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/app/assets/stylesheets/content/_tooltips.sass b/app/assets/stylesheets/content/_tooltips.sass index 5c30b9b5b7..7d6829b85c 100644 --- a/app/assets/stylesheets/content/_tooltips.sass +++ b/app/assets/stylesheets/content/_tooltips.sass @@ -107,7 +107,6 @@ $tooltip--arrow-size: 6px opacity: 1 visibility: visible - &.-multiline &:after height: auto @@ -117,47 +116,47 @@ $tooltip--arrow-size: 6px white-space: normal text-align: left - @each $position in left, right - &.tooltip--#{$position} - @extend %tooltip--left-right - @if $position == 'right' - &:before, &:after - left: 100% - &:before - margin-left: -2px - &:after - margin-left: 10px - @else - &:before, &:after - right: 100% - &:before - margin-right: -2px - &:after - margin-right: 10px - - @each $position in top, bottom - &.tooltip--#{$position} - @extend %tooltip--top-bottom - @if $position == 'top' - &:before, &:after - bottom: 100% - &:before - margin-bottom: $tooltip--arrow-size * -1 + 1 - &:after - margin-bottom: 7px - &:hover - &:before, &:after - transform: translate(-50%, 0px) - @else - &:before, &:after - top: 100% - &:before - margin-top: $tooltip--arrow-size * -1 + 1 - &:after - margin-top: 7px - &:hover - &:before, &:after - transform: translate(-50%, 0) + &.tooltip--right + @extend %tooltip--left-right + &:before, &:after + left: 100% + &:before + margin-left: -2px + &:after + margin-left: 10px + + &.tooltip--left + @extend %tooltip--left-right + &:before, &:after + right: 100% + &:before + margin-right: -2px + &:after + margin-right: 10px + + &.tooltip--top + @extend %tooltip--top-bottom + &:before, &:after + bottom: 100% + &:before + margin-bottom: $tooltip--arrow-size * -1 + 1 + &:after + margin-bottom: 7px + &:hover + &:before, &:after + transform: translate(-50%, 0px) + + &.tooltip--bottom + @extend %tooltip--top-bottom + &:before, &:after + top: 100% + &:before + margin-top: $tooltip--arrow-size * -1 + 1 + &:after + margin-top: 7px + &:hover + &:before, &:after + transform: translate(-50%, 0) // tooltips for table content (TODO: legacy?) table