Class: Admin::PagesController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/admin/pages_controller.rb

Defined Under Namespace

Classes: PreviewStop

Instance Method Summary collapse

Instance Method Details

#indexObject



24
25
26
27
# File 'app/controllers/admin/pages_controller.rb', line 24

def index
  @homepage = Page.find_by_parent_id(nil)
  response_for :plural
end

#newObject



29
30
31
32
33
# File 'app/controllers/admin/pages_controller.rb', line 29

def new
  @page = self.model = model_class.new_with_defaults(trusty_config)
  assign_page_attributes
  response_for :new
end

#previewObject



35
36
37
38
39
# File 'app/controllers/admin/pages_controller.rb', line 35

def preview
  render_preview
rescue PreviewStop => exception
  render :text => exception.message unless @performed_render
end

#save_table_positionObject



41
42
43
44
45
# File 'app/controllers/admin/pages_controller.rb', line 41

def save_table_position
  new_position = params[:new_position]
  Page.save_order(new_position)
  head :ok
end