Class: Admin::ThemesController

Inherits:
BaseController show all
Defined in:
app/controllers/admin/themes_controller.rb

Instance Method Summary collapse

Methods included from BlogHelper

#blog_base_url, #this_blog

Instance Method Details

#indexObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/admin/themes_controller.rb', line 8

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

#previewObject



18
19
20
21
22
# File 'app/controllers/admin/themes_controller.rb', line 18

def preview
  theme = Theme.find(params[:theme])
  send_file File.join(theme.path, "preview.png"),
            type: "image/png", disposition: "inline", stream: false
end

#switchtoObject



24
25
26
27
28
29
30
# File 'app/controllers/admin/themes_controller.rb', line 24

def switchto
  this_blog.theme = params[:theme]
  this_blog.save
  this_blog.current_theme(:reload)
  flash[:success] = I18n.t("admin.themes.switchto.success")
  redirect_to admin_themes_url
end