Created
March 20, 2012 10:43
-
-
Save leucos/2134036 to your computer and use it in GitHub Desktop.
Sample for sidebar rendering
This file contains 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
class Domains < MainController | |
def index | |
@title = 'Domains' | |
@domains = Domain | |
@sidebar = render_sidebar | |
end | |
def edit(id) | |
@domain = Domain[id] | |
if @domain.nil? | |
flash[:error] = 'sorry, this domain doesn\'t exist' | |
redirect_referrer | |
end | |
@title = "#{@domain.name} domain" | |
@sidebar = render_sidebar | |
end | |
# ... | |
private | |
def render_sidebar | |
render_partial :sidebar | |
end |
This file contains 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
<div class="row-fluid"> | |
<div class="span3"> | |
<div class="well sidebar-nav"> | |
#{@sidebar} | |
</div><!--/.well --> | |
</div><!--/span--> | |
<div class="span9"> | |
<?r [:success, :error, :info].each do |type| ?> | |
<?r if flash[type] ?> | |
<div class="alert alert-block alert-#{type} fade in"> | |
<a class="close" data-dismiss="alert" href="#">×</a> | |
<h4 class="alert-heading">#{type.capitalize}</h4> | |
<p>#{flash[type].capitalize}</p> | |
</div> | |
<?r end ?> | |
<?r end ?> | |
#{@content} | |
</div><!--/span--> | |
</div><!--/row--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment