Class: Admin::Atreides::ContentPartsController

Inherits:
Atreides::AdminController
  • Object
show all
Includes:
Atreides::Extendable
Defined in:
app/controllers/admin/atreides/content_parts_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



26
27
28
29
30
31
32
33
# File 'app/controllers/admin/atreides/content_parts_controller.rb', line 26

def destroy
  super do |wants|
    wants.html { head :ok }
    wants.xml  { head :ok }
    wants.json { head :ok }
    wants.js
  end
end

#newObject



5
6
7
8
9
10
11
12
# File 'app/controllers/admin/atreides/content_parts_controller.rb', line 5

def new
  if Atreides::ContentPart.content_types.include?(params[:content_type])
    resource.content_type = params[:content_type]
  end
  super do |wants|
    wants.js
  end
end

#reorderObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/admin/atreides/content_parts_controller.rb', line 14

def reorder
  if params[:parts_list].is_a?(Array)
    i = 0
    params[:parts_list].each do |id|
      Atreides::ContentPart.update_all({:display_order => (i+=1)}, {:id => id})
    end
    render :nothing => true, :status => :ok
  else
    render :nothing => true, :status => :error
  end
end