Class: Lcms::Engine::Admin::DocumentsController
Constant Summary
AdminController::RE_GOOGLE_FOLDER
Instance Method Summary
collapse
document_path, engine_klass, host_engine_path, material_path, root_path, settings, #whoami
Instance Method Details
#create ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/lcms/engine/admin/documents_controller.rb', line 20
def create
if form_params[:link].match?(RE_GOOGLE_FOLDER)
file_ids = gdoc_files_from form_params[:link]
return bulk_import(file_ids) && render(:import) if file_ids.any?
flash.now[:alert] = t '.empty_folder'
return render(:new)
end
@document = reimport_lesson
if @document.save
redirect_to AdminController.document_path(@document.document),
notice: t('.success', name: @document.document.name)
else
render :new
end
end
|
#destroy ⇒ Object
39
40
41
42
43
|
# File 'app/controllers/lcms/engine/admin/documents_controller.rb', line 39
def destroy
@document = Document.find(params[:id])
@document.destroy
redirect_to admin_documents_path(query: params[:query]), notice: t('.success')
end
|
#destroy_selected ⇒ Object
45
46
47
48
|
# File 'app/controllers/lcms/engine/admin/documents_controller.rb', line 45
def destroy_selected
count = @documents.destroy_all.count
redirect_to admin_documents_path(query: params[:query]), notice: t('.success', count: count)
end
|
#import_status ⇒ Object
50
51
52
53
|
# File 'app/controllers/lcms/engine/admin/documents_controller.rb', line 50
def import_status
data = import_status_for DocumentGenerator.document_parse_job
render json: data, status: :ok
end
|
#index ⇒ Object
14
15
16
17
18
|
# File 'app/controllers/lcms/engine/admin/documents_controller.rb', line 14
def index
@query = OpenStruct.new(params[:query])
@documents = DocTemplate.config['queries']['document'].constantize.call(@query, page: params[:page])
render_customized_view
end
|
#new ⇒ Object
55
56
57
|
# File 'app/controllers/lcms/engine/admin/documents_controller.rb', line 55
def new
@document = DocumentForm.new
end
|
#reimport_selected ⇒ Object
59
60
61
62
|
# File 'app/controllers/lcms/engine/admin/documents_controller.rb', line 59
def reimport_selected
bulk_import @documents
render :import
end
|