Created
June 15, 2009 02:08
-
-
Save sprite2005/129908 to your computer and use it in GitHub Desktop.
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
Application Helpers | |
def block_to_partial(partial_name, options = {}, &block) | |
options.merge!(:body => capture(&block)) | |
concat(render(:partial => partial_name, :locals => options)) | |
end | |
# Create as many of these as you like, each should call a different partial | |
# 1. Render 'shared/rounded_box' partial with the given options and block content | |
def rounded_box(options = {}, &block) | |
block_to_partial('shared/rounded_box', options, &block) | |
end | |
CSS: | |
.xrounded h1, .xrounded h2, .xrounded h3, .xrounded p, .xrounded p, .xrounded dl {margin:0 10px; letter-spacing:0px; padding:0;} | |
.xrounded li { margin-left: 10px; } | |
.xrounded form, .xrounded label { margin:0 10px; padding:0; } | |
.xrounded h1 {font-size:2.5em; color:#fff;} | |
.xrounded h2 {font-size:2em;color:#4096EE; border:0;} | |
.xrounded h3 {font-size:1em;color:#4096EE; border:0;} | |
.xrounded p, .xrounded dl {padding-top: 0.5em; padding-bottom:0.5em;} | |
.xrounded h2, h3 {padding-top:0.5em;} | |
.xrounded {background: transparent; margin:5px 0em 5px 0em;} | |
.xtop, .xbottom {display:block; background:transparent; font-size:1px;} | |
.xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;} | |
.xb1, .xb2, .xb3 {height:1px;} | |
.xb2, .xb3, .xb4 {background:#F7EEF6; border-left:1px solid #CA2AB8; border-right:1px solid #CA2AB8;} | |
.xb1 {margin:0 5px; background:#CA2AB8;} | |
.xb2 {margin:0 3px; border-width:0 2px;} | |
.xb3 {margin:0 2px;} | |
.xb4 {height:2px; margin:0 1px;} | |
.xboxcontent {display:block; background:#F7EEF6; border:0 solid #CA2AB8; border-width:0 1px;} | |
Rounded box partial: | |
<div class="xrounded"> | |
<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b> | |
<div class="xboxcontent"> | |
<%= body -%> | |
</div> | |
<b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b> | |
</div> | |
Usage | |
<% rounded_box do %> | |
Content blah blah | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment