Class: Plum::Cp::ThemesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/plum/cp/themes_controller.rb', line 17

def create
  installer = ThemePackageInstaller.new(params[:theme_package])

  if installer.install
    redirect_to cp_themes_path, notice: "Theme installed"
  else
    @theme_package_errors = installer.errors
    render :index, status: :unprocessable_entity
  end
end

#indexObject



14
15
# File 'app/controllers/plum/cp/themes_controller.rb', line 14

def index
end

#updateObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/plum/cp/themes_controller.rb', line 28

def update
  theme = ThemeRegistry.new.find(params[:id])

  if theme
    site_settings.update!(theme_name: theme.handle)
    current_site.update!(
      theme_name: theme.handle,
      theme_settings: ThemeSettingsParams.new(theme).normalize(theme_settings_params_for(theme))
    )
    redirect_to cp_themes_path, notice: theme_update_notice(theme)
  else
    redirect_to cp_themes_path, alert: "Theme not found"
  end
end