-
-
Save bf4/42841a16c70e35650f8293a7921cc45c to your computer and use it in GitHub Desktop.
A simple badge that shows your Rails environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ In app/views/shared/ | |
#dev-badge | |
span= Rails.env | |
span It ain't production! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html | |
= render 'layouts/head' | |
body | |
== render partial: 'shared/dev_badge' unless Rails.env.production? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Be sure to `@import "dev-badge"` from your application.css.scss */ | |
#dev-badge { | |
left: -65px; | |
height: 30px; | |
top: 40px; | |
position: absolute; | |
text-decoration: none; | |
width: 250px; | |
-webkit-transform: rotate(-45deg); | |
-moz-transform: rotate(-45deg); | |
-ms-transform: rotate(-45deg); | |
-o-transform: rotate(-45deg); | |
transform: rotate(-45deg); | |
span { | |
background: #073642; | |
color: #839496; | |
font-size: 14px; | |
left: 0; | |
padding: 5px 0; | |
position: absolute; | |
text-align: center; | |
width: 250px; | |
-webkit-box-shadow: rgba(255, 255, 255, 0.3) 1px 1px 10px; | |
-moz-box-shadow: rgba(255, 255, 255, 0.3) 1px 1px 10px; | |
box-shadow: rgba(255, 255, 255, 0.3) 1px 1px 10px; | |
-webkit-transition: opacity 1s; | |
-moz-transition: opacity 1s; | |
-o-transition: opacity 1s; | |
transition: opacity 1s; | |
&:last-child { | |
/* this is the backside */ | |
background: #0087FF; | |
color: #eee8d5; | |
opacity: 0; | |
} | |
} | |
:hover span { | |
&:first-child { opacity: 0; } | |
&:last-child { opacity: 1; } | |
} | |
} | |
@media all and (-webkit-transform-3d) { | |
#dev-badge { | |
span { | |
opacity: 1 !important; | |
-webkit-backface-visibility: hidden; | |
-webkit-transition: -webkit-transform 1s; | |
&:last-child { | |
-webkit-transform: rotateX(180deg); | |
} | |
} | |
&:hover span { | |
&:first-child { | |
-webkit-transform: rotateX(180deg); | |
} | |
&:last-child { | |
-webkit-transform: rotateX(360deg); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment