Class: Course::Video::VideosController

Inherits:
Controller show all
Defined in:
app/controllers/course/video/videos_controller.rb

Instance Method Summary collapse

Methods included from ApplicationSignInCallbacksConcern

#sign_in

Methods included from ApplicationPaginationConcern

#page_param

Methods included from ApplicationAnnouncementsConcern

#global_announcements, #unread_global_announcements

Methods included from ApplicationInstanceUserConcern

#current_instance_user

Methods included from ApplicationUserTimeZoneConcern

#set_time_zone

Methods included from ApplicationUserConcern

#handle_access_denied, #publicly_accessible?

Methods included from ApplicationComponentsConcern

#handle_component_not_found

Instance Method Details

#createObject


16
17
18
19
20
21
22
23
# File 'app/controllers/course/video/videos_controller.rb', line 16

def create
  if @video.save
    redirect_to course_videos_path(current_course, tab: @video.tab),
                success: t('.success', title: @video.title)
  else
    render 'new'
  end
end

#destroyObject


36
37
38
39
40
41
42
43
# File 'app/controllers/course/video/videos_controller.rb', line 36

def destroy
  if @video.destroy
    redirect_to course_videos_path(current_course), success: t('.success', title: @video.title)
  else
    redirect_to course_videos_path(current_course),
                danger: t('.failure', error: @video.errors.full_messages.to_sentence)
  end
end

#editObject


25
# File 'app/controllers/course/video/videos_controller.rb', line 25

def edit; end

#indexObject

:nodoc:


3
4
5
6
7
8
# File 'app/controllers/course/video/videos_controller.rb', line 3

def index #:nodoc:
  @videos = @videos.
            from_tab(current_tab).
            ordered_by_date_and_title.
            with_submissions_by(current_user)
end

#newObject


12
13
14
# File 'app/controllers/course/video/videos_controller.rb', line 12

def new
  @video.tab = current_tab
end

#showObject


10
# File 'app/controllers/course/video/videos_controller.rb', line 10

def show; end

#updateObject


27
28
29
30
31
32
33
34
# File 'app/controllers/course/video/videos_controller.rb', line 27

def update
  if @video.update(video_params)
    redirect_to course_videos_path(current_course, tab: @video.tab),
                success: t('.success', title: @video.title)
  else
    render 'edit'
  end
end