diff --git a/app/models/page.rb b/app/models/page.rb index 7e7dc50..685311e 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -26,7 +26,7 @@ class Page < ActiveRecord::Base def title_for_url self.title.gsub(/ /, '_') end - + ## # Gets a title from an url name. # diff --git a/app/views/pages/_page.rhtml b/app/views/pages/_page.rhtml index 5fc4b0d..86cc8dd 100644 --- a/app/views/pages/_page.rhtml +++ b/app/views/pages/_page.rhtml @@ -1,9 +1,9 @@
-

<%= @page.title -%>

+

<%= link_to_page(@page) -%>

<%= @page.html %>
-Current Version: <%= @page.version -%> +Current Version: <%= @page.version %>
diff --git a/app/views/pages/edit.rhtml b/app/views/pages/edit.rhtml new file mode 100644 index 0000000..32db15e --- /dev/null +++ b/app/views/pages/edit.rhtml @@ -0,0 +1,18 @@ +

Editing page

+ +<%= error_messages_for :page %> + +<% form_for(:page, :url => page_path({ :id => @page.title_for_url }), :html => { :method => :put }) do |f| %> +

+ <%= text_field 'page', 'title' %> +

+

+ <%= text_area 'page', 'redcloth' %> +

+

+ <%= submit_tag "Update" %> +

+<% end %> + +<%= link_to 'Show', page_path({ :id => @page.title_for_url }) %> | +<%= link_to 'Back', pages_path %> diff --git a/app/views/pages/new.rhtml b/app/views/pages/new.rhtml new file mode 100644 index 0000000..fb82989 --- /dev/null +++ b/app/views/pages/new.rhtml @@ -0,0 +1,11 @@ +

New page

+ +<%= error_messages_for :page %> + +<% form_for(:page, :url => pages_path) do |f| %> +

+ <%= submit_tag "Create" %> +

+<% end %> + +<%= link_to 'Back', pages_path %> \ No newline at end of file diff --git a/app/views/pages/show.rhtml b/app/views/pages/show.rhtml new file mode 100644 index 0000000..a38b777 --- /dev/null +++ b/app/views/pages/show.rhtml @@ -0,0 +1,4 @@ +<%= render :partial => 'page' %> + +<%= link_to 'Edit', edit_page_path({ :id => @page.title_for_url }) %> | +<%= link_to 'Back', pages_path %>