making models styled using scribbish
git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@29 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7master
parent
34fb69e444
commit
4670fc1a8a
|
@ -5,6 +5,8 @@ class BeersController < ApplicationController
|
|||
# GET /beers
|
||||
# GET /beers.xml
|
||||
def index
|
||||
@content_title = 'The Beers'
|
||||
@secondary_title = 'Browsing all beers'
|
||||
@pages, @beers = paginate :beers, :include => 'page', :per_page => 50,
|
||||
:order => 'beers.title ASC'
|
||||
respond_to do |format|
|
||||
|
@ -24,12 +26,14 @@ class BeersController < ApplicationController
|
|||
|
||||
# GET /beers/new
|
||||
def new
|
||||
@secondary_title = 'Create a new beer'
|
||||
@beer = Beer.new
|
||||
@page = Page.new
|
||||
end
|
||||
|
||||
# GET /beers/1;edit
|
||||
def edit
|
||||
@secondary_title = 'Update existing beer'
|
||||
end
|
||||
|
||||
# POST /beers
|
||||
|
|
|
@ -5,6 +5,8 @@ class BreweriesController < ApplicationController
|
|||
# GET /breweries
|
||||
# GET /breweries.xml
|
||||
def index
|
||||
@content_title = 'The Breweries'
|
||||
@secondary_title = 'Browsing all breweries'
|
||||
@pages, @breweries = paginate :breweries, :include => 'page',
|
||||
:order => 'breweries.title ASC', :per_page => 50
|
||||
respond_to do |format|
|
||||
|
|
|
@ -3,16 +3,15 @@ module ApplicationHelper
|
|||
# Returns the title for a page. This could be a Page title or something else.
|
||||
#
|
||||
def page_title
|
||||
"BarleySodas :: #{controller.class.to_s.gsub(/Controller/, '')}"
|
||||
"BarleySodas :: #{content_title} :: #{secondary_title}"
|
||||
end
|
||||
|
||||
##
|
||||
# Returns a pretty name for the current chunk.
|
||||
#
|
||||
def content_title
|
||||
return @page_title if @page_title
|
||||
return @page.title if @page
|
||||
"BarleySodas"
|
||||
return @content_title if @content_title
|
||||
controller.class.to_s.gsub(/Controller/, '')
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -21,7 +20,7 @@ module ApplicationHelper
|
|||
#
|
||||
def secondary_title
|
||||
return @secondary_title if @secondary_title
|
||||
return params[:action].to_s.capitalize.gsub(/_/) do |x|
|
||||
params[:action].to_s.capitalize.gsub(/_/) do |x|
|
||||
$1.capitalize
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
module BeersHelper
|
||||
def new_beer_link
|
||||
link_to "Beer Me!", new_beer_path, { :title => 'Create a new beer' }
|
||||
end
|
||||
|
||||
def abv(beer)
|
||||
number_to_percentage(beer.abv, { :precision => 1 })
|
||||
end
|
||||
|
|
|
@ -10,6 +10,4 @@
|
|||
<p>
|
||||
<label for="beer_final_gravity">Final Gravity</label> <%= text_field 'beer', 'final_gravity' %>
|
||||
</p>
|
||||
<p>
|
||||
<label for="page_redcloth">Description</label> <%= text_area 'page', 'redcloth' %>
|
||||
</p>
|
||||
<%= render :partial => 'pages/page_form' %>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<h1>Editing beer</h1>
|
||||
|
||||
<%= error_messages_for :beer %>
|
||||
|
||||
<% form_for(:beer, :url => beer_path(@beer.page.title_for_url), :html => { :method => :put }) do |f| %>
|
||||
|
@ -9,7 +7,7 @@
|
|||
</p>
|
||||
<% end -%>
|
||||
|
||||
<div id="related_links">
|
||||
<%= link_to 'Show', beer_path(@beer.page.title_for_url) %> |
|
||||
<%= link_to 'Beers', beers_path %>
|
||||
</div>
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to 'New Beer', new_beer_path -%><br />
|
||||
<%= link_to 'Show', beer_path(@beer.page.title_for_url) -%><br />
|
||||
<% end -%>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<h1>The Beers</h1>
|
||||
|
||||
<% unless @beers.empty? -%>
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -16,10 +14,10 @@
|
|||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% else -%>
|
||||
<p>No beers, yet</p>
|
||||
<% end -%>
|
||||
|
||||
<br />
|
||||
|
||||
<div id="related_links">
|
||||
<%= new_beer_link %>
|
||||
</div>
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to "New Beer", new_beer_path, { :title => 'Create a new beer' } -%><br />
|
||||
<% end -%>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<h1>Create a new beer</h1>
|
||||
|
||||
<%= error_messages_for :beer %>
|
||||
|
||||
<% form_for(:beer, :url => beers_path, :html => { :method => :post }) do |f| %>
|
||||
|
@ -8,7 +6,3 @@
|
|||
<%= submit_tag "Create" %>
|
||||
</p>
|
||||
<% end -%>
|
||||
|
||||
<div id="related_links">
|
||||
<%= link_to 'Beers', beers_path %>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
<h1><%= @beer.title -%></h1>
|
||||
<%= render :partial => 'pages/page' %>
|
||||
|
||||
<%
|
||||
attributes = []
|
||||
|
@ -13,9 +13,7 @@
|
|||
</div>
|
||||
<% end -%>
|
||||
|
||||
<%= @page.html %>
|
||||
|
||||
<div id="related_links">
|
||||
<%= link_to 'Edit', edit_beer_path(@beer) %> |
|
||||
<%= link_to 'Beers', beers_path %>
|
||||
</div>
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to 'New Beer', new_beer_path -%><br />
|
||||
<%= link_to 'Edit Beer', edit_beer_path(@beer.page.title_for_url) -%><br />
|
||||
<% end -%>
|
||||
|
|
|
@ -16,6 +16,4 @@
|
|||
<p>
|
||||
<label for="brewery_county">Country</label> <%= country_select 'brewery', 'country', [ 'United States', 'United Kingdom', 'Germany' ] %>
|
||||
</p>
|
||||
<p>
|
||||
<label for="page_redcloth">Description</label> <%= text_area 'page', 'redcloth' %>
|
||||
</p>
|
||||
<%= render :partial => 'pages/page_form' %>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<h1>Editing brewery</h1>
|
||||
|
||||
<%= error_messages_for :brewery %>
|
||||
|
||||
<% form_for(:brewery, :url => brewery_path(@brewery.page.title_for_url), :html => { :method => :put }) do |f| %>
|
||||
|
@ -9,7 +7,7 @@
|
|||
</p>
|
||||
<% end %>
|
||||
|
||||
<div id="related_links">
|
||||
<%= link_to 'Show', brewery_path(@brewery.page.title_for_url) %> |
|
||||
<%= link_to 'Breweries', breweries_path %>
|
||||
</div>
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to 'New Brewery', new_brewery_path -%><br />
|
||||
<%= link_to 'Show', brewery_path(@brewery.page.title_for_url) -%><br />
|
||||
<% end -%>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<h1>Breweries</h1>
|
||||
|
||||
<% unless @breweries.empty? -%>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
|
@ -16,9 +15,10 @@
|
|||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% else -%>
|
||||
<p>No breweries, yet.</p>
|
||||
<% end -%>
|
||||
|
||||
<br />
|
||||
|
||||
<div id="related_links">
|
||||
<%= link_to 'New brewery', new_brewery_path %>
|
||||
</div>
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to 'New brewery', new_brewery_path -%><br />
|
||||
<% end -%>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<h1>New brewery</h1>
|
||||
|
||||
<%= error_messages_for :brewery %>
|
||||
|
||||
<% form_for(:brewery, :url => breweries_path, :html => { :method => :post }) do |f| %>
|
||||
|
@ -8,7 +6,3 @@
|
|||
<%= submit_tag "Create" %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<div id="related_links">
|
||||
<%= link_to 'Breweries', breweries_path %>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
<h1><%= @brewery.title -%></h1>
|
||||
<%= render :partial => 'pages/page' %>
|
||||
|
||||
<div id="attributes">
|
||||
<ul>
|
||||
|
@ -6,9 +6,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<%= @page.html %>
|
||||
|
||||
<div id="related_links">
|
||||
<%= link_to 'Edit', edit_brewery_path(@brewery.page.title_for_url) %> |
|
||||
<%= link_to 'Breweries', breweries_path %>
|
||||
</div>
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to 'New Brewery', new_brewery_path -%><br />
|
||||
<%= link_to 'Edit', edit_brewery_path(@brewery.page.title_for_url) -%><br />
|
||||
<% end -%>
|
||||
|
|
|
@ -28,7 +28,11 @@
|
|||
<%= yield %>
|
||||
</div>
|
||||
<div id="sidebar">
|
||||
<p>todo</p>
|
||||
<%= link_to_unless_current 'Browse The Beer Wiki', pages_path -%><br />
|
||||
<%= link_to_unless_current 'Browse Beers', beers_path -%><br />
|
||||
<%= link_to_unless_current 'Browse Breweries', breweries_path -%><br />
|
||||
<hr />
|
||||
<%= yield :sidebar %>
|
||||
</div>
|
||||
<br style="clear:both;" />
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
<div id="page_container">
|
||||
<h1><%= link_to_page(@page) -%></h1>
|
||||
<div class="page_container_content">
|
||||
<%= @page.html %>
|
||||
</div>
|
||||
<div class="page_container_controls">
|
||||
Current Version: <%= @page.version %>
|
||||
</div>
|
||||
<div class="hentry" id="article-<%= @page.id %>">
|
||||
<h2 class="entry-title">
|
||||
<%= @page.title %>
|
||||
<span class="comment_count">Comment Size Here</span>
|
||||
</h2>
|
||||
<div class="vcard">
|
||||
Posted by <span class="fn">Author Name Here</span>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
<div class="entry-content">
|
||||
<%= @page.html %>
|
||||
</div>
|
||||
<ul class="meta">
|
||||
<li>Add Tags here</li>
|
||||
<li>Meta
|
||||
Version: <%= @page.version -%> / <%= @page.versions.size %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
<p>
|
||||
<label for="page_redcloth">Description</label> <%= text_area 'page', 'redcloth' %>
|
||||
</p>
|
|
@ -3,16 +3,13 @@
|
|||
<%= error_messages_for :page %>
|
||||
|
||||
<% form_for(:page, :url => page_path({ :id => @page.title_for_url }), :html => { :method => :put }) do |f| %>
|
||||
<p>
|
||||
<label for="page_title">Title</label> <%= text_field 'page', 'title' %>
|
||||
</p>
|
||||
<p>
|
||||
<label for="page_redcloth">Description</label> <%= text_area 'page', 'redcloth' %>
|
||||
</p>
|
||||
<p>
|
||||
<%= submit_tag "Update" %>
|
||||
</p>
|
||||
<%= render :partial => 'page_form' %>
|
||||
<p>
|
||||
<%= submit_tag "Update" %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Show', page_path({ :id => @page.title_for_url }) %> |
|
||||
<%= link_to 'Back', pages_path %>
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to 'Show', page_path({ :id => @page.title_for_url }) %><br />
|
||||
<%= link_to 'Browse Pages', pages_path %><br />
|
||||
<% end -%>
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
<%= render :partial => 'page' -%>
|
||||
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to 'New Page', new_page_path -%><br />
|
||||
<% end -%>
|
||||
|
|
|
@ -3,9 +3,15 @@
|
|||
<%= error_messages_for :page %>
|
||||
|
||||
<% form_for(:page, :url => pages_path) do |f| %>
|
||||
<p>
|
||||
<%= submit_tag "Create" %>
|
||||
</p>
|
||||
<p>
|
||||
<label for="page_title">Title</label> <%= text_field 'page', 'title' %>
|
||||
</p>
|
||||
<%= render :partial => 'page_form' %>
|
||||
<p>
|
||||
<%= submit_tag "Create" %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', pages_path %>
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to 'Browse Pages', pages_path %><br />
|
||||
<% end -%>
|
|
@ -1,4 +1,6 @@
|
|||
<%= render :partial => 'page' %>
|
||||
|
||||
<%= link_to 'Edit', edit_page_path({ :id => @page.title_for_url }) %> |
|
||||
<%= link_to 'Back', pages_path %>
|
||||
<% content_for :sidebar do -%>
|
||||
<%= link_to 'Edit Page', edit_page_path({ :id => @page.title_for_url }) %><br />
|
||||
<%= link_to 'Browse Pages', pages_path %><br />
|
||||
<% end -%>
|
||||
|
|
Reference in New Issue