TreeView v1
This commit is contained in:
parent
d1294c2fc4
commit
e9743cd00c
6 changed files with 148 additions and 50 deletions
|
|
@ -1,26 +1,30 @@
|
|||
div id=dom_id(report, :page_nav)
|
||||
- if report.pages.any?
|
||||
details open=true
|
||||
summary Struktur
|
||||
details.switch open=true
|
||||
summary.justify-content-end
|
||||
span Pfade
|
||||
nav
|
||||
ul
|
||||
- report.pages.each do |page|
|
||||
- is_current = current_page == page
|
||||
li
|
||||
details open=current_page_displayed(page) class=""
|
||||
summary
|
||||
i.bi.me-1 class="bi-file-earmark-check#{is_current ? "-fill" : "" }"
|
||||
details.tree open=current_page_displayed(page) class=""
|
||||
summary class=(is_current ? "active" : nil)
|
||||
i.bi.me-1 class="bi-file-earmark-check#{is_current ? "" : "" }"
|
||||
- if is_current
|
||||
=< "#{page.position} #{page.path}"
|
||||
=< "#{page.position} #{page.path}"
|
||||
- else
|
||||
=< link_to("#{page.position} #{page.path}", report_path(report, page_id: page.id), class: "#{is_current ? " active text-decoration-underline" : nil }", data: { "turbo-frame": :_top })
|
||||
=< link_to("#{page.position} #{page.path}", report_path(report, page_id: page.id), data: { "turbo-frame": :_top })
|
||||
ul id=dom_id(page, :page_nav_elements)
|
||||
- page.elements.each do |element|
|
||||
li
|
||||
i.bi.bi-boxes.me-1
|
||||
- if current_page == page
|
||||
=< link_to("#{element.number} #{element.title}", "##{dom_id(element)}", data: { "turbo": false })
|
||||
=< link_to("##{dom_id(element)}", data: { "turbo": false }) do
|
||||
i.bi.bi-boxes.me-1
|
||||
=< "#{element.number} #{element.title}"
|
||||
- else
|
||||
=< link_to("#{element.number} #{element.title}", report_path(report, page_id: page.id, anchor: dom_id(element)), data: { "turbo": false })
|
||||
=< link_to(report_path(report, page_id: page.id, anchor: dom_id(element)), data: { "turbo": false }) do
|
||||
i.bi.bi-boxes.me-1
|
||||
=< "#{element.number} #{element.title}"
|
||||
= turbo_frame_tag "new_page_frame" do
|
||||
= render partial: "reports/new_page_button", locals: { report: report }
|
||||
Loading…
Add table
Add a link
Reference in a new issue