Class: Forge::VideosController
Instance Method Summary
collapse
#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor
#app_init
Instance Method Details
#create ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 24
def create
@video = Video.new(params[:video])
if @video.save
flash[:notice] = 'Video was successfully created.'
redirect_to(forge_videos_path)
else
render :action => "new"
end
end
|
#destroy ⇒ Object
46
47
48
49
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 46
def destroy
@video.destroy
redirect_to(forge_videos_path)
end
|
#edit ⇒ Object
21
22
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 21
def edit
end
|
#encode ⇒ Object
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 61
def encode
response = @video.encode(Rails.env)
if response.success?
flash[:notice] = "Video has been queued for encoding."
else
flash[:warning] = "There was an error queueing that video for encoding:<br /><br />".html_safe
flash[:warning] += response.body["errors"].map { |e| e.titleize }.join('<br />').html_safe
end
redirect_to forge_videos_path
end
|
#encode_notify ⇒ Object
72
73
74
75
76
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 72
def encode_notify
@video = Video.find_by_job_id!(params[:job][:id].to_i)
@video.encode_notify(params[:output])
render :text => "Success"
end
|
#index ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 7
def index
respond_to do |format|
format.html { @videos = Video.paginate(:per_page => 10, :page => params[:page]) }
format.js {
@videos = Video.where("title LIKE ?", "%#{params[:q]}%")
render :partial => "video", :collection => @videos
}
end
end
|
#new ⇒ Object
17
18
19
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 17
def new
@video = Video.new
end
|
#play ⇒ Object
51
52
53
54
55
56
57
58
59
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 51
def play
respond_to do |format|
format.js {
response.["Content-Type"] = 'text/html'
render :partial => "play", :locals => {:video => @video}
}
end
end
|
#update ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 34
def update
@video.thumbnail = nil if params[:remove_asset] == "1"
@video.video = nil if params[:remove_video]
if @video.update_attributes(params[:video])
flash[:notice] = 'Video was successfully updated.'
redirect_to(forge_videos_path)
else
render :action => "edit"
end
end
|