Skip to content

Commit

Permalink
Change joining of filenames to allow nested folders. Refactor slightl…
Browse files Browse the repository at this point in the history
…y to simplify future changes
  • Loading branch information
James Stewart committed Apr 25, 2009
1 parent 53d1e10 commit 9663c97
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/theme_controller.rb
Expand Up @@ -5,15 +5,15 @@ class ThemeController < ActionController::Base
after_filter :cache_theme_files

def stylesheets
render_theme_item(:stylesheets, params[:filename].join('/'), params[:theme], 'text/css')
render_theme_item(:stylesheets, joined_filename, params[:theme], 'text/css')
end

def javascript
render_theme_item(:javascript, params[:filename].join('/'), params[:theme], 'text/javascript')
render_theme_item(:javascript, joined_filename, params[:theme], 'text/javascript')
end

def images
render_theme_item(:images, params[:filename].join('/'), params[:theme])
render_theme_item(:images, joined_filename, params[:theme])
end

def error
Expand All @@ -31,6 +31,10 @@ def render_theme_item(type, file, theme, mime = mime_for(file))
send_file file_path, :type => mime, :disposition => 'inline', :stream => false
end
end

def joined_filename
params[:filename].join '/'
end

def cache_theme_files
path = request.request_uri
Expand All @@ -41,7 +45,6 @@ def cache_theme_files
end
end


def mime_for(filename)
case filename.downcase
when /\.js$/
Expand Down

0 comments on commit 9663c97

Please sign in to comment.