Class: Admin::Atreides::VideosController
- Inherits:
-
Atreides::AdminController
- Object
- Atreides::AdminController
- Admin::Atreides::VideosController
- Includes:
- Atreides::Extendable
- Defined in:
- app/controllers/admin/atreides/videos_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/admin/atreides/videos_controller.rb', line 5 def create @video = resource = if params.key?(:Filedata) end_of_association_chain.new(:upload => params[:Filedata], :part => part) elsif params.key?(:video_url) end_of_association_chain.new(:url => params[:video_url], :part => part) end if @video.save respond_to do |wants| wants.js wants.html { render :status => :ok } end else logger.debug { "video errors: #{resource.errors..to_sentence}\n#{resource.inspect}" } render :text => resource.errors..to_sentence end end |
#destroy ⇒ Object
35 36 37 38 39 |
# File 'app/controllers/admin/atreides/videos_controller.rb', line 35 def destroy super do |wants| wants.js end end |
#reorder ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/admin/atreides/videos_controller.rb', line 23 def reorder if params[:videos_list].is_a?(Array) i = 0 params[:videos_list].each do |id| Atreides::Video.update_all({:display_order => (i+=1)}, {:id => id}) end render :nothing => true, :status => :ok else render :nothing => true, :status => :error end end |