Class: Alchemy::Admin::LayoutpagesController

Inherits:
BaseController show all
Includes:
Clipboard, CurrentLanguage
Defined in:
app/controllers/alchemy/admin/layoutpages_controller.rb

Instance Method Summary collapse

Methods included from Clipboard

#clipboard_empty?

Methods inherited from BaseController

#leave

Methods included from Modules

included, #module_definition_for, register_module

Methods included from Alchemy::AbilityHelper

#current_ability

Methods included from ConfigurationMethods

#configuration, #multi_language?, #multi_site?, #prefix_locale?

Instance Method Details

#editObject



18
19
20
# File 'app/controllers/alchemy/admin/layoutpages_controller.rb', line 18

def edit
  @page = Page.find(params[:id])
end

#indexObject



13
14
15
16
# File 'app/controllers/alchemy/admin/layoutpages_controller.rb', line 13

def index
  @layout_pages = Page.layoutpages.where(language: @current_language)
  @languages = Language.on_current_site
end

#updateObject



22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/alchemy/admin/layoutpages_controller.rb', line 22

def update
  @page = Page.find(params[:id])
  if @page.update(page_params)
    @notice = Alchemy.t("Page saved", name: @page.name)
    @while_page_edit = request.referer.include?("edit")
    render "alchemy/admin/pages/update"
  else
    render :edit, status: 422
  end
end