You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.4 KiB
67 lines
2.4 KiB
import ApplicationController from './application_controller' |
|
export default class extends ApplicationController { |
|
connect () { |
|
super.connect() |
|
} |
|
|
|
loadSubjectsAccordion () { |
|
var $this = this, params = { per_page: 10000 }, parent_id = $this.element.dataset["subjectParentId"], |
|
opts = { parent_accordion_id: $this.element.dataset["accordionId"], accordionTarget: $this.element.dataset["accordionTarget"], |
|
accordionFor: $this.element.dataset["accordionFor"] } |
|
|
|
console.log(opts) |
|
if (parent_id !== null && parent_id !== undefined && parent_id !== "") { |
|
params.parent_id = parent_id |
|
} else { |
|
params.is_root = true |
|
} |
|
|
|
if ($(opts.accordionTarget).find(".accordion-flush").length === 0) { |
|
$.get("/api/subjects.json", params, function (search_results, status) { |
|
if (status === "success") { |
|
$this.stimulate("SubjectsReflex#render_subjects_accordion", search_results, opts) |
|
} |
|
}) |
|
} |
|
} |
|
|
|
loadSubjectsOffcanvasAccordion() { |
|
var $this = this, params = { per_page: 10000 }, parent_id = $this.element.dataset["subjectParentId"], |
|
opts = { accordionTarget: $this.element.dataset["accordionTarget"] } |
|
|
|
console.log(opts) |
|
if (parent_id !== null && parent_id !== undefined && parent_id !== "") { |
|
params.parent_id = parent_id |
|
} else { |
|
params.is_root = true |
|
} |
|
|
|
if ($(opts.accordionTarget).find(".accordion-flush").length === 0) { |
|
$.get("/api/subjects.json", params, function (search_results, status) { |
|
if (status === "success") { |
|
$this.stimulate("SubjectsReflex#render_subjects_offcanvas_accordion", search_results, opts) |
|
} |
|
}) |
|
} |
|
} |
|
|
|
loadDoctrinesOffcanvasAccordion() { |
|
var $this = this, params = { per_page: 10000 }, parent_id = $this.element.dataset["subjectParentId"], |
|
opts = { accordionTarget: $this.element.dataset["accordionTarget"] } |
|
|
|
console.log(opts) |
|
if (parent_id !== null && parent_id !== undefined && parent_id !== "") { |
|
params.parent_id = parent_id |
|
} else { |
|
params.is_root = true |
|
} |
|
|
|
if ($(opts.accordionTarget).find(".accordion-flush").length === 0) { |
|
$.get("/api/subjects.json", params, function (search_results, status) { |
|
if (status === "success") { |
|
$this.stimulate("SubjectsReflex#render_doctrines_offcanvas_accordion", search_results, opts) |
|
} |
|
}) |
|
} |
|
} |
|
}
|
|
|