adding other views

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@11 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2007-10-04 04:54:54 +00:00
parent 6e73a18f9c
commit 4ffbec197e
5 changed files with 36 additions and 3 deletions

View File

@ -26,7 +26,7 @@ class Page < ActiveRecord::Base
def title_for_url
self.title.gsub(/ /, '_')
end
##
# Gets a title from an url name.
#

View File

@ -1,9 +1,9 @@
<div class="page_container">
<h1><%= @page.title -%></h1>
<h1><%= link_to_page(@page) -%></h1>
<div class="page_container_content">
<%= @page.html %>
</div>
<div class="page_container_controls">
Current Version: <%= @page.version -%>
Current Version: <%= @page.version %>
</div>
</div>

View File

@ -0,0 +1,18 @@
<h1>Editing page</h1>
<%= 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>
<% end %>
<%= link_to 'Show', page_path({ :id => @page.title_for_url }) %> |
<%= link_to 'Back', pages_path %>

11
app/views/pages/new.rhtml Normal file
View File

@ -0,0 +1,11 @@
<h1>New page</h1>
<%= error_messages_for :page %>
<% form_for(:page, :url => pages_path) do |f| %>
<p>
<%= submit_tag "Create" %>
</p>
<% end %>
<%= link_to 'Back', pages_path %>

View File

@ -0,0 +1,4 @@
<%= render :partial => 'page' %>
<%= link_to 'Edit', edit_page_path({ :id => @page.title_for_url }) %> |
<%= link_to 'Back', pages_path %>