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.
24 lines
875 B
24 lines
875 B
import ApplicationController from './application_controller' |
|
export default class extends ApplicationController { |
|
connect () { |
|
super.connect() |
|
} |
|
|
|
loadSubjectsAccordion () { |
|
var $this = this, params = { per_page: 200 }, parent_id = $this.element.dataset["subjectParentId"], |
|
opts = { parent_accordion_id: $this.element.dataset["accordionId"], accordionTarget: $this.element.dataset["accordionTarget"], |
|
accordionFor: $this.element.dataset["accordionFor"] } |
|
|
|
if (parent_id !== null && parent_id !== undefined && parent_id !== "") { |
|
params.parent_id = parent_id |
|
} else { |
|
params.is_root = true |
|
} |
|
|
|
$.get("/api/subjects.json", params, function (search_results, status) { |
|
if (status === "success") { |
|
$this.stimulate("SubjectsReflex#render_subjects_accordion", search_results, opts) |
|
} |
|
}) |
|
} |
|
}
|
|
|