diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c8d597ac..1d3df38f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,9 +33,19 @@ module ApplicationHelper html_options.join("\n") end + # Creates a hyperlink to a Wiki page, without checking if the page exists or not + def link_to_existing_page(page, text = nil, html_options = {}) + link_to( + text || page.name, + {:web => @web.address, :action => 'show', :id => page.name, :only_path => true}, + html_options) + end + + + # Creates a hyperlink to a Wiki page, or to a "new page" form if the page doesn't exist yet def link_to_page(page_name, web = @web, text = nil, options = {}) raise 'Web not defined' if web.nil? - home_page_url = url_for :web => web.address, :action => 'show', :id => 'HomePage', :only_path => true + home_page_url = url_for :web => web.address, :action => 'show', :id => page_name, :only_path => true base_url = home_page_url.sub(%r-/show/HomePage/?$-, '') web.make_link(page_name, text, options.merge(:base_url => base_url)) end diff --git a/app/models/page.rb b/app/models/page.rb index 1f714101..ddb286f7 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -85,10 +85,6 @@ class Page @web.make_link(author, nil, options) end - def url - CGI.escape(self.name) - end - private def continous_revision?(created_at, author) diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index 386676f0..9a05e05c 100644 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -8,7 +8,10 @@ <%= render("#{@web.markup}_help") if @web %> -
+<%= form_tag({ :action => 'save', :web => @web.address, :id => @page.name}, + {'id' => 'editForm', 'method' => 'post', 'onSubmit' => 'cleanAuthorName();'}) +%> +

@@ -16,9 +19,13 @@ as - | Cancel (unlocks page) + | + <%= link_to('Cancel', {:web => @web.name, :action => 'cancel_edit', :id => @page.name}, + {:accesskey => 'c'}) + %> + (unlocks page)

-
+<%= end_form_tag %>