move to AR

This commit is contained in:
Rick Okin 2005-08-09 02:20:28 +00:00
parent c4b7b2d9f2
commit 26c046cdfa
51 changed files with 2345 additions and 516 deletions

View file

@ -46,7 +46,6 @@ class AdminController < ApplicationController
end
def edit_web
system_password = @params['system_password']
if system_password
# form submitted
@ -67,6 +66,7 @@ class AdminController < ApplicationController
flash[:info] = "Web '#{@params['address']}' was successfully updated"
redirect_home(@params['address'])
rescue Instiki::ValidationError => e
logger.warn e.message
@error = e.message
# and re-render the same template again
end

View file

@ -10,12 +10,12 @@ class ApplicationController < ActionController::Base
# a global variable is used here because Rails reloads controller and model classes in the
# development environment; therefore, storing it as a class variable does not work
# class variable is, anyway, not much different from a global variable
$instiki_wiki_service = the_wiki
#$instiki_wiki_service = the_wiki
logger.debug("Wiki service: #{the_wiki.to_s}")
end
def self.wiki
$instiki_wiki_service
Wiki.new
end
protected
@ -146,7 +146,7 @@ class ApplicationController < ActionController::Base
end
def wiki
$instiki_wiki_service
self.class.wiki
end
def needs_authorization?(action)

View file

@ -78,7 +78,7 @@ class FileController < ApplicationController
return false
end
unless @web.allow_uploads
unless @web.allow_uploads?
render_text 'File uploads are blocked by the webmaster', '403 Forbidden'
return false
end

View file

@ -1,4 +1,3 @@
require 'application'
require 'fileutils'
require 'redcloth_for_tex'
require 'parsedate'
@ -156,7 +155,7 @@ class WikiController < ApplicationController
end
def published
if @web.published
if @web.published?
@page = wiki.read_page(@web_name, @page_name || 'HomePage')
else
redirect_home
@ -270,7 +269,7 @@ class WikiController < ApplicationController
end
def export_web_to_tex(file_path)
@tex_content = table_of_contents(@web.pages['HomePage'].content, render_tex_web)
@tex_content = table_of_contents(@web.page('HomePage').content, render_tex_web)
File.open(file_path, 'w') { |f| f.write(render_to_string('wiki/tex_web')) }
end
@ -342,7 +341,7 @@ class WikiController < ApplicationController
end
def rss_with_content_allowed?
@web.password.nil? or @web.published
@web.password.nil? or @web.published?
end
def truncate(text, length = 30, truncate_string = '...')