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



4
5
6
7
# File 'app/controllers/admin/themes_controller.rb', line 4

def index
  @themes = Theme.find_all
  @active = this_blog.current_theme
end

#previewObject



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

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

#switchtoObject



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

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