Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2010-01-07 08:14:28 -06:00
commit 36089f1543
2 changed files with 3 additions and 1 deletions

View file

@ -273,6 +273,7 @@ class WikiController < ApplicationController
cookies['author'] = { :value => author_name.dup.as_bytes, :expires => Time.utc(2030) } cookies['author'] = { :value => author_name.dup.as_bytes, :expires => Time.utc(2030) }
if @page if @page
new_name = params['new_name'] ? params['new_name'].purify : @page_name new_name = params['new_name'] ? params['new_name'].purify : @page_name
new_name = @page_name if new_name.empty?
prev_content = @page.current_revision.content prev_content = @page.current_revision.content
raise Instiki::ValidationError.new('Your new title cannot contain a "."') if new_name.include? '.' raise Instiki::ValidationError.new('Your new title cannot contain a "."') if new_name.include? '.'
raise Instiki::ValidationError.new('A page named "' + new_name.escapeHTML + '" already exists.') if raise Instiki::ValidationError.new('A page named "' + new_name.escapeHTML + '" already exists.') if

View file

@ -55,7 +55,8 @@ function toggleVisibility() {
} }
function addRedirect(){ function addRedirect(){
if (document.getElementById('new_name').value != "<%= escape_javascript(@page.name) %>" ) { var e = document.getElementById('new_name').value;
if ( e != "<%= escape_javascript(@page.name) %>" && e != '') {
var content = document.getElementById('content'); var content = document.getElementById('content');
content.value = '[[!redirects <%= escape_javascript(@page.name) %>]]\n' + content.value content.value = '[[!redirects <%= escape_javascript(@page.name) %>]]\n' + content.value
} }