Class: Course::CoursesController

Inherits:
Controller show all
Includes:
ActivityFeedsConcern
Defined in:
app/controllers/course/courses_controller.rb

Instance Method Summary collapse

Methods included from ActivityFeedsConcern

#recent_activity_feeds

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

Methods included from ApplicationComponentsConcern

#handle_component_not_found

Instance Method Details

#createObject

:nodoc:


22
23
24
25
26
27
28
# File 'app/controllers/course/courses_controller.rb', line 22

def create # :nodoc:
  if @course.save
    redirect_to course_admin_path(@course), success: t('.success', title: @course.title)
  else
    render 'new'
  end
end

#destroyObject

:nodoc:


30
31
# File 'app/controllers/course/courses_controller.rb', line 30

def destroy # :nodoc:
end

#indexObject

:nodoc:


8
9
10
# File 'app/controllers/course/courses_controller.rb', line 8

def index # :nodoc:
  @courses = Course.publicly_accessible.ordered_by_start_at.page(page_param).per(24)
end

#newObject

:nodoc:


19
20
# File 'app/controllers/course/courses_controller.rb', line 19

def new # :nodoc:
end

#publicly_accessible?Boolean (protected)

Returns:

  • (Boolean)

35
36
37
# File 'app/controllers/course/courses_controller.rb', line 35

def publicly_accessible?
  params[:action] == 'index'
end

#showObject

:nodoc:


12
13
14
15
16
17
# File 'app/controllers/course/courses_controller.rb', line 12

def show # :nodoc:
  @registration = Course::Registration.new
  @currently_active_announcements = current_course.announcements.currently_active.sorted_by_sticky.sorted_by_date
  @activity_feeds = recent_activity_feeds.limit(20).preload(activity: [:object, :actor])
  render layout: 'course'
end