Skip to content

Commit

Permalink
Sidebar now handled via content_for block. [concerto#105 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
bamnet committed Aug 17, 2010
1 parent 2dbf109 commit ec4dcdf
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 91 deletions.
15 changes: 14 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
module ApplicationHelper

# Generate the HTML for the standardized back buttons used
# in the header elements.
def back_button(path, name = "Back", options = {})
options[:class] ||= "button back"

tag("div", {:class => "C-header_back"}, true) + link_to(name, path, options) + raw("</div>")
end

# Figure out which class we should be using to setup the sidebar.
# The default for no sidebar is "no" but if a sidebar is used
# the default becomes "sm" (small) but it can be overridden by
# setting @sidebar_class anywhere a sidebar is used.
def sidebar_class
if content_for?(:sidebar)
@sidebar_class || "sm"
else
"no"
end
end

end
65 changes: 30 additions & 35 deletions app/views/contents/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
<div class="C-full sm">
<div class="C-header">
<h1>Browse Content</h1>
</div>
<div class="C-cont">
<div class="C-center column">
<a class="button" href="#" onclick="this.blur();"><span>Design a Graphic</span></a>
<% @contents.each do |content| %>
<ul class="iconlist">
<li>
<a href="">
<div class="iconlist_padding">
<div class="ins">
<div class="type-folder"><%= content.data %><%#= image_tag("ph/ph.png", :alt => "") %></div>
</div>
<h2>
<%= content.name %>
<br />
<%= content.start_time %> - <%= content.end_time %>
</h2>
</div>
</a>
</li>
</ul>
<% end %>
</div>
<div class="C-sidebar column">
<ul class="feedbuttons">
<li class="selected"><% link_to "#", :class => "button" do %><span>99+</span>Service &amp; Community<% end %></li>
<li><% link_to "#", :class => "button" do %><span>7</span>Entertainment<% end %></li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
<% content_for :header do %>
<%= back_button screens_path %>
<h1>New Screen</h1>
<% end %>
<% content_for :sidebar do %>
<ul class="feedbuttons">
<li class="selected"><% link_to "#", :class => "button" do %><span>99+</span>Service &amp; Community<% end %></li>
<li><% link_to "#", :class => "button" do %><span>7</span>Entertainment<% end %></li>
</ul>
<% end %>

<a class="button" href="#" onclick="this.blur();"><span>Design a Graphic</span></a>
<% @contents.each do |content| %>
<ul class="iconlist">
<li>
<a href="">
<div class="iconlist_padding">
<div class="ins">
<div class="type-folder"><%= content.data %><%#= image_tag("ph/ph.png", :alt => "") %></div>
</div>
<h2>
<%= content.name %>
<br />
<%= content.start_time %> - <%= content.end_time %>
</h2>
</div>
</a>
</li>
</ul>
<% end %>
11 changes: 5 additions & 6 deletions app/views/feeds/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<h1>Editing feed</h1>

<%= render 'form' %>
<%= link_to 'Show', @feed %> |
<%= link_to 'Back', feeds_path %>
<% content_for :header do %>
<%= back_button feeds_path %>
<h1>Edit Feed</h1>
<% end %>
<%= render 'form' %>
17 changes: 5 additions & 12 deletions app/views/feeds/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<div class="C-full no">
<div class="C-header">
<%= back_button feeds_path %>
<h1>New Feed</h1>
</div>
<div class="C-cont">
<div class="C-center column">
<%= render 'form' %>
</div>
<div class="clear"></div>
</div>
</div>
<% content_for :header do %>
<%= back_button feeds_path %>
<h1>New Feed</h1>
<% end %>
<%= render 'form' %>
11 changes: 5 additions & 6 deletions app/views/groups/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<h1>Editing group</h1>

<%= render 'form' %>
<%= link_to 'Show', @group %> |
<%= link_to 'Back', groups_path %>
<% content_for :header do %>
<%= back_button groups_path %>
<h1>Edit Group</h1>
<% end %>
<%= render 'form' %>
15 changes: 5 additions & 10 deletions app/views/groups/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<div class="C-header">
<%= back_button groups_path %>
<h1>New Group</h1>
</div>
<div class="C-cont">
<div class="C-center column">
<%= render 'form' %>
</div>
<div class="clear"></div>
</div>
<% content_for :header do %>
<%= back_button groups_path %>
<h1>New Group</h1>
<% end %>
<%= render 'form' %>
20 changes: 18 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,23 @@
<% if flash[:notice] %>
<p class="notice"><%= notice %></p>
<% end %>
<%= yield %>
<div class="C-full <%= sidebar_class %>">
<div class="C-header">
<% if content_for?(:header) %>
<%= yield :header %>
<% end %>
</div>
<div class="C-cont">
<div class="C-center column">
<%= yield %>
</div>
<% if content_for?(:sidebar) %>
<div class="C-sidebar column">
<%= yield :sidebar %>
</div>
<% end %>
<div class="clear"></div>
</div>
</div>
</body>
</html>
</html>
11 changes: 5 additions & 6 deletions app/views/screens/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<h1>Editing screen</h1>

<%= render 'form' %>
<%= link_to 'Show', @screen %> |
<%= link_to 'Back', screens_path %>
<% content_for :header do %>
<%= back_button screens_path %>
<h1>Edit Screen</h1>
<% end %>
<%= render 'form' %>
18 changes: 5 additions & 13 deletions app/views/screens/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<div class="C-full no">
<div class="C-header">
<%= back_button screens_path %>
<h1>New Screen</h1>
</div>
<div class="C-cont">
<div class="C-center column">
<%= render 'form' %>
</div>
<div class="clear"></div>
</div>
</div>

<% content_for :header do %>
<%= back_button screens_path %>
<h1>New Screen</h1>
<% end %>
<%= render 'form' %>

0 comments on commit ec4dcdf

Please sign in to comment.