diff --git a/app/views/beers/edit.rhtml b/app/views/beers/edit.rhtml new file mode 100644 index 0000000..1d6f91a --- /dev/null +++ b/app/views/beers/edit.rhtml @@ -0,0 +1,15 @@ +

Editing beer

+ +<%= error_messages_for :beer %> + +<% form_for(:beer, :url => beer_path(@beer.page.title_for_url), :html => { :method => :put }) do |f| %> +<%= render :partial => 'beer_form' %> +

+ <%= submit_tag "Update" %> +

+<% end -%> + + \ No newline at end of file diff --git a/app/views/beers/index.rhtml b/app/views/beers/index.rhtml new file mode 100644 index 0000000..1dacf5c --- /dev/null +++ b/app/views/beers/index.rhtml @@ -0,0 +1,25 @@ +

The Beers

+ +<% unless @beers.empty? -%> + + + + + + + +<% for beer in @beers %> + + + + + +<% end %> +
Beer
<%= link_to beer.title, beer_path(beer.page.title_for_url) %><%= link_to 'Edit', edit_beer_path(beer.page.title_for_url) %><%= link_to 'Destroy', beer_path(beer.page.title_for_url), :confirm => 'Are you sure?', :method => :delete %>
+<% end -%> + +
+ + \ No newline at end of file diff --git a/app/views/beers/new.rhtml b/app/views/beers/new.rhtml new file mode 100644 index 0000000..861bedb --- /dev/null +++ b/app/views/beers/new.rhtml @@ -0,0 +1,14 @@ +

Create a new beer

+ +<%= error_messages_for :beer %> + +<% form_for(:beer, :url => beers_path, :html => { :method => :post }) do |f| %> +<%= render :partial => 'beer_form' %> +

+ <%= submit_tag "Create" %> +

+<% end -%> + + \ No newline at end of file diff --git a/app/views/beers/show.rhtml b/app/views/beers/show.rhtml new file mode 100644 index 0000000..8e2889f --- /dev/null +++ b/app/views/beers/show.rhtml @@ -0,0 +1,21 @@ +

<%= @beer.title -%>

+ +<% + attributes = [] + attributes << "ABV: #{abv(@beer)}" unless @beer.abv.to_s.empty? + attributes << "Original Gravity: #{@beer.original_gravity}" unless @beer.original_gravity.to_s.empty? + attributes << "Final Gravity: #{@beer.final_gravity}" unless @beer.final_gravity.to_s.empty? + unless attributes.empty? +-%> +
+

Useful attributes

+ +
+<% end -%> + +<%= @page.html %> + + \ No newline at end of file