Fix BlahTeX/PNG

The BlahTeX/PNG code was busted by Revision 344.
Fixed now.
Ari better supply me with a test suite, so this doesn't happen again.
This commit is contained in:
Jacques Distler 2009-01-27 11:35:05 -06:00
parent b4b1dde8fd
commit 1cdf0536c1
3 changed files with 13 additions and 0 deletions

View file

@ -37,6 +37,10 @@ class FileController < ApplicationController
end end
end end
def blahtex_png
send_file(@web.blahtex_pngs_path + '/' + params['id'])
end
def delete def delete
@file_name = params['id'] @file_name = params['id']
file = WikiFile.find_by_file_name(@file_name) file = WikiFile.find_by_file_name(@file_name)

View file

@ -125,6 +125,14 @@ class Web < ActiveRecord::Base
end end
end end
def blahtex_pngs_path
if default_web?
"#{RAILS_ROOT}/webs/files/pngs"
else
"#{RAILS_ROOT}/webs/#{self.address}/files/pngs"
end
end
private private
# Returns an array of all the wiki words in any current revision # Returns an array of all the wiki words in any current revision

View file

@ -19,6 +19,7 @@ ActionController::Routing::Routes.draw do |map|
connect_to_web map, ':web/remove_orphaned_pages', :controller => 'admin', :action => 'remove_orphaned_pages' connect_to_web map, ':web/remove_orphaned_pages', :controller => 'admin', :action => 'remove_orphaned_pages'
connect_to_web map, ':web/remove_orphaned_pages_in_category', :controller => 'admin', :action => 'remove_orphaned_pages_in_category' connect_to_web map, ':web/remove_orphaned_pages_in_category', :controller => 'admin', :action => 'remove_orphaned_pages_in_category'
connect_to_web map, ':web/file/delete/:id', :controller => 'file', :action => 'delete', :requirements => {:id => /[-._\w]+/}, :id => nil connect_to_web map, ':web/file/delete/:id', :controller => 'file', :action => 'delete', :requirements => {:id => /[-._\w]+/}, :id => nil
connect_to_web map, ':web/files/pngs/:id', :controller => 'file', :action => 'blahtex_png', :requirements => {:id => /[-._\w]+/}, :id => nil
connect_to_web map, ':web/files/:id', :controller => 'file', :action => 'file', :requirements => {:id => /[-._\w]+/}, :id => nil connect_to_web map, ':web/files/:id', :controller => 'file', :action => 'file', :requirements => {:id => /[-._\w]+/}, :id => nil
connect_to_web map, ':web/file_list/:sort_order', :controller => 'wiki', :action => 'file_list', :sort_order => nil connect_to_web map, ':web/file_list/:sort_order', :controller => 'wiki', :action => 'file_list', :sort_order => nil
connect_to_web map, ':web/import/:id', :controller => 'file', :action => 'import' connect_to_web map, ':web/import/:id', :controller => 'file', :action => 'import'