class Admin::ThemesController < Admin::BaseController
  
  def index
    @themes = ThemeSystem.themes
    @active = ThemeSystem.theme
  end
  
  def preview
    send_file RAILS_ROOT + "#{ThemeSystem.themes_root}/#{params[:theme]}/preview.png", :type => 'image/png', :disposition => 'inline', :stream => false
  end
  
  def switchto
    
    setting = Setting.find_by_name('theme')    
    setting.value = params[:theme]
    setting.save
    
    redirect_to :action => 'index'
    
  end
  
end

class Admin::ThemesController < Admin::BaseController
  
  def index
    @themes = ThemeSystem.themes
    @active = ThemeSystem.theme
  end
  
  def preview
    send_file RAILS_ROOT + "#{ThemeSystem.themes_root}/#{params[:theme]}/preview.png", :type => 'image/png', :disposition => 'inline', :stream => false
  end
  
  def switchto
    
    setting = (Setting.find_by_name('theme') or Setting.new("name" => 'theme'))

    setting.value = params[:theme]
    setting.save
    
    redirect_to :action => 'index'
    
  end
  
end

Create new setting in ThemesController if a 'theme' setting doesn't already exist
Create new setting in ThemesController if a 'theme' setting doesn't already exist


git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@427 820eb932-12ee-0310-9ca8-eeb645f39767
