Class: Course::ObjectDuplicationsController

Inherits:
ComponentController show all
Defined in:
app/controllers/course/object_duplications_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

#authorize_duplicationObject (protected)


32
33
34
# File 'app/controllers/course/object_duplications_controller.rb', line 32

def authorize_duplication
  authorize!(:duplicate_from, current_course)
end

#createObject


16
17
18
19
20
21
# File 'app/controllers/course/object_duplications_controller.rb', line 16

def create
  job = Course::ObjectDuplicationJob.perform_later(
    current_course, authorized_destination_course, objects_to_duplicate, current_user: current_user
  ).job
  render json: { redirect_url: job_path(job) }
end

#dataObject

Duplication data for the current course


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

def data
  respond_to do |format|
    format.json { load_items_data }
  end
end

#newObject


6
7
8
9
10
11
12
13
14
# File 'app/controllers/course/object_duplications_controller.rb', line 6

def new
  respond_to do |format|
    format.json do
      load_source_courses_data
      load_destination_courses_data
      load_items_data
    end
  end
end