Class: Forge::VideoFeedsController

Inherits:
ForgeController show all
Defined in:
lib/forge/app/controllers/forge/video_feeds_controller.rb

Instance Method Summary collapse

Methods inherited from ForgeController

#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor

Methods inherited from ApplicationController

#app_init

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
# File 'lib/forge/app/controllers/forge/video_feeds_controller.rb', line 23

def create
  @video = VideoFeed.new(params[:video_feed])
  if @video.save
    flash[:notice] = 'VideoFeed was successfully created.'
    redirect_to(forge_video_feeds_path)
  else
    render :action => "new"
  end
end

#editObject



19
20
21
# File 'lib/forge/app/controllers/forge/video_feeds_controller.rb', line 19

def edit
  @video = VideoFeed.find(params[:id])
end

#indexObject



4
5
6
7
8
9
10
11
12
# File 'lib/forge/app/controllers/forge/video_feeds_controller.rb', line 4

def index
  respond_to do |format|
    format.html { @videos = VideoFeed.paginate(:per_page => 10, :page => params[:page]) }
    format.js { 
      @videos = VideoFeed.where("title LIKE ?", "%#{params[:q]}%")
      render :partial => "video", :collection => @videos
    }
  end
end

#newObject



14
15
16
17
# File 'lib/forge/app/controllers/forge/video_feeds_controller.rb', line 14

def new
  flash[:notice] = VideoFeed.import_videos(MySettings.video_feed_source)
  redirect_to forge_video_feeds_path    
end

#publishObject



42
43
44
45
# File 'lib/forge/app/controllers/forge/video_feeds_controller.rb', line 42

def publish
  @video.update_attributes(:published => @video.published? ? false : true)
  redirect_to forge_video_feeds_path    
end

#updateObject



33
34
35
36
37
38
39
40
# File 'lib/forge/app/controllers/forge/video_feeds_controller.rb', line 33

def update
  if @video.update_attributes(params[:video_feed])
    flash[:notice] = 'VideoFeed was successfully updated.'
    redirect_to(forge_video_feeds_path)
  else
    render :action => "edit"
  end
end