Sha256: 28ff764a8245be095a676013a36a33e65f62dcf014170ba905d81b7b8798ec58
Contents?: true
Size: 958 Bytes
Versions: 2
Compression:
Stored size: 958 Bytes
Contents
require 'open-uri' require 'time' require 'rexml/document' class Admin::ThemesController < Admin::BaseController cache_sweeper :blog_sweeper def index @themes = Theme.find_all @themes.each do |theme| # TODO: Move to Theme theme.description_html = TextFilter.filter_text(theme.description, [:markdown, :smartypants]) end @active = this_blog.current_theme end def preview theme = Theme.find(params[:theme]) send_file File.join(theme.path, 'preview.png'), type: 'image/png', disposition: 'inline', stream: false end def switchto this_blog.theme = params[:theme] this_blog.save zap_theme_caches this_blog.current_theme(:reload) flash[:success] = I18n.t('admin.themes.switchto.success') redirect_to admin_themes_url end protected def zap_theme_caches FileUtils.rm_rf(%w(stylesheets javascript images).map { |v| page_cache_directory + "/#{v}/theme" }) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
publify_core-9.0.0.pre2 | app/controllers/admin/themes_controller.rb |
publify_core-9.0.0.pre1 | app/controllers/admin/themes_controller.rb |