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
25
26
27
28
29
30
31
32
33
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 25
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
47
48
49
50
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 47
def destroy
@video.destroy
redirect_to(forge_videos_path)
end
|
#edit ⇒ Object
22
23
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 22
def edit
end
|
#encode ⇒ Object
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 62
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
73
74
75
76
77
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 73
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
16
|
# 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 {
params[:q] ||= ''
@videos = Video.where("LOWER(title) LIKE ?", "%#{params[:q].downcase}%")
render :partial => "video", :collection => @videos
}
end
end
|
#new ⇒ Object
18
19
20
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 18
def new
@video = Video.new
end
|
#play ⇒ Object
52
53
54
55
56
57
58
59
60
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 52
def play
respond_to do |format|
format.js {
response.["Content-Type"] = 'text/html'
render :partial => "play", :locals => {:video => @video}
}
end
end
|
#update ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/forge/app/controllers/forge/videos_controller.rb', line 35
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
|