Model menus, modal edit and layout improvements
This commit is contained in:
parent
7b0f05a448
commit
70500c49a1
35 changed files with 1079 additions and 148 deletions
|
|
@ -20,37 +20,6 @@ $tertiary-dark-active-open: $gray-600;
|
|||
}
|
||||
}
|
||||
|
||||
// // Fix trix dark mode
|
||||
// .trix-button-row {
|
||||
// .trix-button-group {
|
||||
// border: var(--bs-border-width) solid var(--bs-border-color);
|
||||
|
||||
// .trix-button {
|
||||
// border: 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// [data-bs-theme=dark] {
|
||||
// .trix-button-row {
|
||||
// .trix-button-group {
|
||||
// .trix-button {
|
||||
// background-color: transparent;
|
||||
// filter: invert(100%);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // end fix trix dark mode
|
||||
|
||||
// .trix-content pre {
|
||||
// background-color: var(--bs-secondary-bg);
|
||||
// color: var(--bs-secondary-color);
|
||||
// border: var(--bs-border-width) solid var(--bs-border-color);
|
||||
// border-radius: var(--bs-border-radius);
|
||||
// padding: var(--bs-padding);
|
||||
// }
|
||||
|
||||
.hover-row:hover {
|
||||
background-color: var(--bs-tertiary-bg);
|
||||
}
|
||||
|
|
@ -91,6 +60,7 @@ $tertiary-dark-active-open: $gray-600;
|
|||
.page_nav nav ul {
|
||||
padding-left: 0;
|
||||
list-style-type: none;
|
||||
|
||||
li {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
|
@ -230,8 +200,9 @@ details.success_criterion:last-child {
|
|||
}
|
||||
|
||||
details.success_criterion {
|
||||
border: solid 1px $tertiary;
|
||||
border-bottom: solid 0px $tertiary;
|
||||
border-left: solid 1px $tertiary;
|
||||
border-right: solid 0px $tertiary;
|
||||
border-top: solid 0px $tertiary;
|
||||
|
||||
summary:hover {
|
||||
background-color: $tertiary-hover;
|
||||
|
|
@ -248,6 +219,7 @@ details.success_criterion {
|
|||
>.content {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -262,7 +234,7 @@ details.success_criterion {
|
|||
|
||||
|
||||
details.success_criterion[open] {
|
||||
border: solid 1px $tertiary;
|
||||
/* border: solid 1px $tertiary; */
|
||||
|
||||
>summary {
|
||||
background-color: $tertiary;
|
||||
|
|
@ -275,14 +247,17 @@ details.success_criterion[open] {
|
|||
|
||||
@include color-mode(dark) {
|
||||
details.success_criterion {
|
||||
border: solid 1px $tertiary-dark;
|
||||
border-bottom: solid 0px $tertiary-dark;
|
||||
border-left: solid 1px $tertiary-dark;
|
||||
border-right: solid 1px $tertiary-dark;
|
||||
border-top: solid 1px $tertiary-dark;
|
||||
}
|
||||
|
||||
details.success_criterion:last-child {
|
||||
border-bottom: solid 1px $tertiary-dark;
|
||||
}
|
||||
|
||||
details.success_criterion[open] {
|
||||
border: solid 1px $tertiary-dark;
|
||||
/* border: solid 1px $tertiary-dark; */
|
||||
|
||||
>summary {
|
||||
background-color: $tertiary-dark;
|
||||
|
|
@ -343,3 +318,64 @@ details[open] {
|
|||
.sortable-ghost {
|
||||
border: solid 3px $primary !important;
|
||||
}
|
||||
|
||||
$dialog-animation-time: 0.5s;
|
||||
$dialog-animation-start-state: scaleX(1);
|
||||
$dialog-animation-end-state: scaleX(1);
|
||||
/* dialog::backdrop { */
|
||||
/* background-color: white; */
|
||||
/* opacity: 0.75; */
|
||||
/* } */
|
||||
|
||||
/* Open state of the dialog */
|
||||
dialog[open] {
|
||||
opacity: 1;
|
||||
transform: $dialog-animation-end-state;
|
||||
}
|
||||
|
||||
/* Closed state of the dialog */
|
||||
dialog {
|
||||
opacity: 0;
|
||||
transform: $dialog-animation-start-state;
|
||||
transition:
|
||||
opacity $dialog-animation-time ease-out,
|
||||
transform $dialog-animation-time ease-out,
|
||||
overlay $dialog-animation-time ease-out allow-discrete,
|
||||
display $dialog-animation-time ease-out allow-discrete;
|
||||
/* Equivalent to
|
||||
transition: all $dialog-animation-time allow-discrete; */
|
||||
}
|
||||
|
||||
/* Before-open state */
|
||||
/* Needs to be after the previous dialog[open] rule to take effect,
|
||||
as the specificity is the same */
|
||||
@starting-style {
|
||||
dialog[open] {
|
||||
opacity: 0;
|
||||
transform: $dialog-animation-start-state;
|
||||
}
|
||||
}
|
||||
|
||||
/* Transition the :backdrop when the dialog modal is promoted to the top layer */
|
||||
dialog::backdrop {
|
||||
background-color: rgb(0 0 0 / 75%);
|
||||
transition:
|
||||
display $dialog-animation-time allow-discrete,
|
||||
overlay $dialog-animation-time allow-discrete,
|
||||
background-color $dialog-animation-time;
|
||||
/* Equivalent to
|
||||
transition: all $dialog-animation-time allow-discrete; */
|
||||
}
|
||||
|
||||
dialog[open]::backdrop {
|
||||
background-color: rgb(0 0 0 / 75%);
|
||||
}
|
||||
|
||||
/* This starting-style rule cannot be nested inside the above selector
|
||||
because the nesting selector cannot represent pseudo-elements. */
|
||||
|
||||
@starting-style {
|
||||
dialog[open]::backdrop {
|
||||
background-color: rgb(0 0 0 / 0%);
|
||||
}
|
||||
}
|
||||
|
|
@ -50,4 +50,8 @@ class ApplicationController < ActionController::Base
|
|||
def initialize_sidebar_items
|
||||
[]
|
||||
end
|
||||
|
||||
def render_modal(action: action_name)
|
||||
render action, layout: "modal" if turbo_frame_request_id == "modal"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ class ElementsController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /elements/1/edit
|
||||
def edit; end
|
||||
def edit
|
||||
render_modal
|
||||
end
|
||||
|
||||
# POST /elements
|
||||
def create
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class PagesController < ApplicationController
|
|||
|
||||
# GET /pages/1/edit
|
||||
def edit
|
||||
render_modal
|
||||
end
|
||||
|
||||
# POST /pages
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ class SuccessCriteriaController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /success_criteria/1/edit
|
||||
def edit; end
|
||||
def edit
|
||||
render_modal()
|
||||
end
|
||||
|
||||
# POST /success_criteria
|
||||
def create
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ module ApplicationHelper
|
|||
|
||||
|
||||
def dropdown_menu(items, klass: "")
|
||||
tag.details(class: "details-dropdown #{klass}") do
|
||||
tag.details(class: "details-dropdown #{klass}", data: { controller: "dropdown-menu" }) do
|
||||
tag.summary do
|
||||
tag.div(class: "details-dropdown-trigger") do
|
||||
tag.div(tag.i(class: "bi bi-three-dots-vertical"), class: "btn btn-outline-secondary")
|
||||
tag.div(tag.i(class: "bi bi-three-dots"), class: "btn btn-outline-body")
|
||||
end
|
||||
end +
|
||||
tag.div(class: "details-dropdown-content bg-secondary") do
|
||||
|
|
@ -48,7 +48,7 @@ module ApplicationHelper
|
|||
text = item[:icon] ? tag.i(class: "bi bi-#{item[:icon]} me-2") + " #{item[:text]}".html_safe : item[:text]
|
||||
case item[:method]
|
||||
when nil, :get
|
||||
link_to(text, item[:href], class: "#{c}")
|
||||
link_to(text, item[:href], class: "#{c}", data: { turbo_frame: item[:turbo_frame], action: item[:action] })
|
||||
else
|
||||
button_to(text,
|
||||
item[:href],
|
||||
|
|
@ -61,4 +61,8 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def modal?
|
||||
turbo_frame_request_id == "modal"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ElementsHelper
|
||||
def element_menu(element)
|
||||
dropdown_menu([
|
||||
{ text: "Bearbeiten",
|
||||
icon: "pencil",
|
||||
href: edit_element_path(element),
|
||||
turbo_frame: "modal",
|
||||
color: "body" },
|
||||
{ text: "Löschen",
|
||||
icon: "trash",
|
||||
href: element_path(element),
|
||||
color: :danger,
|
||||
method: :delete,
|
||||
confirm: "Bist du sicher?" } ],
|
||||
klass: "ms-auto")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,27 @@
|
|||
module PagesHelper
|
||||
def page_menu(page)
|
||||
dropdown_menu([
|
||||
{
|
||||
text: "Alle zu [s]",
|
||||
href: "#",
|
||||
action: "click->details-list#closeAll"
|
||||
},
|
||||
{
|
||||
text: "Alle auf [a]",
|
||||
href: "#",
|
||||
action: "click->details-list#openAll"
|
||||
},
|
||||
{ text: "Bearbeiten",
|
||||
icon: "pencil",
|
||||
href: edit_page_path(page),
|
||||
turbo_frame: "modal",
|
||||
color: "body" },
|
||||
{ text: "Löschen",
|
||||
icon: "trash",
|
||||
href: page_path(page),
|
||||
color: :danger,
|
||||
method: :delete,
|
||||
confirm: "Bist du sicher?" } ],
|
||||
klass: "ms-auto")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -27,19 +27,20 @@ module SuccessCriteriaHelper
|
|||
|
||||
def success_criterion_menu(success_criterion, show_mode = true)
|
||||
dropdown_menu([
|
||||
{ text: show_mode ? "Bearbeiten" : "Bearbeiten abbrechen",
|
||||
icon: "pencil",
|
||||
href: show_mode ? edit_success_criterion_path(success_criterion) : success_criterion_path(success_criterion)},
|
||||
{ text: "Löschen",
|
||||
icon: "trash",
|
||||
href: success_criterion_path(success_criterion),
|
||||
color: :danger,
|
||||
method: :delete,
|
||||
confirm: "Bist du sicher?"}],
|
||||
klass: "mt-3 ms-auto")
|
||||
{ text: "Bearbeiten",
|
||||
icon: "pencil",
|
||||
href: edit_success_criterion_path(success_criterion),
|
||||
turbo_frame: "modal",
|
||||
color: "body" },
|
||||
{ text: "Löschen",
|
||||
icon: "trash",
|
||||
href: success_criterion_path(success_criterion),
|
||||
color: :danger,
|
||||
method: :delete,
|
||||
confirm: "Bist du sicher?" } ],
|
||||
klass: "mt-3 ms-auto")
|
||||
end
|
||||
|
||||
|
||||
def success_criterion_edit_button(success_criterion, edit_mode)
|
||||
path = if success_criterion.persisted?
|
||||
if edit_mode
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default class extends Controller {
|
|||
e.preventDefault();
|
||||
const id = this.element.dataset["targetId"]
|
||||
const el = document.getElementById(id)
|
||||
el.querySelectorAll("details").forEach(el => {
|
||||
el.querySelectorAll("details.success_criterion").forEach(el => {
|
||||
el.setAttribute("open", "")
|
||||
})
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ export default class extends Controller {
|
|||
e.preventDefault();
|
||||
const id = this.element.dataset["targetId"]
|
||||
const el = document.getElementById(id)
|
||||
el.querySelectorAll("details").forEach(el => {
|
||||
el.querySelectorAll("details.success_criterion").forEach(el => {
|
||||
el.removeAttribute("open")
|
||||
})
|
||||
}
|
||||
|
|
|
|||
53
app/javascript/controllers/dialog_controller.js
Normal file
53
app/javascript/controllers/dialog_controller.js
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// app/javascript/controllers/dialog_controller.js
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
// Connects to data-controller="dialog"
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
this.open()
|
||||
console.log("connect dialog", this.element)
|
||||
this.element.addEventListener("turbo:submit-end", e => {
|
||||
this.submitEnd(e)
|
||||
})
|
||||
this.element.addEventListener("click", e => this.clickOutside(e))
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
}
|
||||
|
||||
// hide modal on successful form submission
|
||||
// data-action="turbo:submit-end->turbo-modal#submitEnd"
|
||||
submitEnd(e) {
|
||||
if (e.detail.success) {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
|
||||
open() {
|
||||
console.log("open dialog")
|
||||
this.element.showModal()
|
||||
document.body.classList.add('overflow-hidden')
|
||||
this.element.addEventListener("close", this.enableBodyScroll.bind(this))
|
||||
}
|
||||
|
||||
close() {
|
||||
this.element.removeEventListener("close", this.enableBodyScroll.bind(this))
|
||||
this.element.close()
|
||||
// clean up modal content
|
||||
const frame = document.getElementById('modal')
|
||||
frame.removeAttribute("src")
|
||||
frame.innerHTML = ""
|
||||
}
|
||||
|
||||
enableBodyScroll() {
|
||||
document.body.classList.remove('overflow-hidden')
|
||||
}
|
||||
|
||||
clickOutside(event) {
|
||||
console.log("clickOutside", event.target, this)
|
||||
if (event.target === this.element) {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
app/javascript/controllers/dropdown_menu_controller.js
Normal file
16
app/javascript/controllers/dropdown_menu_controller.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
// Connects to data-controller="dropdown-menu"
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
const x = this.element
|
||||
this.element.addEventListener("turbo:click", e => {
|
||||
console.log("turbo visit dropdown", e, this.element)
|
||||
this.element.removeAttribute("open");
|
||||
})
|
||||
this.element.addEventListener("turbo:submit-start", e => {
|
||||
console.log("turbo submit dropdown", e, this.element)
|
||||
this.element.removeAttribute("open");
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -19,9 +19,15 @@ application.register("collapse-chevron-toggler", CollapseChevronTogglerControlle
|
|||
import DetailsListController from "./details_list_controller"
|
||||
application.register("details-list", DetailsListController)
|
||||
|
||||
import DialogController from "./dialog_controller"
|
||||
application.register("dialog", DialogController)
|
||||
|
||||
import DragController from "./drag_controller"
|
||||
application.register("drag", DragController)
|
||||
|
||||
import DropdownMenuController from "./dropdown_menu_controller"
|
||||
application.register("dropdown-menu", DropdownMenuController)
|
||||
|
||||
import HelloController from "./hello_controller"
|
||||
application.register("hello", HelloController)
|
||||
|
||||
|
|
@ -48,6 +54,3 @@ application.register("toast", ToastController)
|
|||
|
||||
import UnsavedChangesController from "./unsaved_changes_controller"
|
||||
application.register("unsaved-changes", UnsavedChangesController)
|
||||
|
||||
import Lightbox from '@stimulus-components/lightbox'
|
||||
application.register('lightbox', Lightbox)
|
||||
|
|
@ -17,6 +17,8 @@ class SuccessCriterion < ApplicationRecord
|
|||
before_save :set_position
|
||||
before_update :update_positions, if: :position_changed?
|
||||
|
||||
validates :result, inclusion: { in: self.results.keys + [ nil ] }
|
||||
|
||||
def level_value
|
||||
return nil unless level
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
<%= turbo_stream.remove dom_id(@checklist_entry) %>
|
||||
<%= turbo_stream.remove dom_id(@checklist_entry) %>
|
||||
<%= turbo_stream_toast("Check wurde aus Checkliste entfernt", true) %>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<div id="<%= dom_id element %>" class="mb-5">
|
||||
<%= turbo_frame_tag dom_id(element, :frame) do %>
|
||||
<div class="d-flex">
|
||||
<div class="d-flex border-bottom mb-3">
|
||||
<h3 class="h4">
|
||||
<i class="bi bi-boxes">
|
||||
</i>
|
||||
|
|
@ -9,13 +9,7 @@
|
|||
<%= element.title %>
|
||||
</span>
|
||||
</h3>
|
||||
<%= link_to [:edit, element], class: "btn btn-link text-secondary" do %>
|
||||
<i class="bi bi-pencil">
|
||||
</i>
|
||||
<% end %>
|
||||
<%= button_to(element_path(element), method: :delete, class: "btn btn-link text-danger", data: { turbo_confirm: "Bist du sicher?"}) do %>
|
||||
<i class="bi bi-trash"></i>
|
||||
<% end %>
|
||||
<%= element_menu(element) %>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column flex-sm-row">
|
||||
|
|
@ -28,7 +22,7 @@
|
|||
<div class="mb-3" data-controller="lightbox">
|
||||
<%= link_to(s) do %>
|
||||
<%= image_tag(s.variant(:thumbnail), class: "img-fluid", alt: "Screenshot des getesteten Elements") %>
|
||||
<% end %>
|
||||
<% end rescue nil %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
= turbo_stream.replace dom_id(e, :page_nav_row), partial: "elements/page_nav_row", locals: { element: e, current_page: true }
|
||||
|
||||
|
||||
= turbo_stream_toast("Element wurde gelöscht", false)
|
||||
= turbo_stream_toast("Element wurde gelöscht", true)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
<h1><%= t("scaffold.pagetitle_edit", model: Element.model_name.human) %></h1>
|
||||
|
||||
<%= turbo_frame_tag dom_id(@element, :frame) do %>
|
||||
<div>
|
||||
<div class="d-flex">
|
||||
<h2 class="h3">
|
||||
<i class="bi bi-boxes">
|
||||
</i>
|
||||
<%= @element.title %>
|
||||
<%= link_to(tag.i(class: "bi bi-pencil"), @element, class: "btn btn-link text-warning") %>
|
||||
</div>
|
||||
<%= render "form", element: @element %>
|
||||
</div>
|
||||
<% unless modal? %>
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_show", model: Element.model_name.human), @element %>
|
||||
<%= link_to t("scaffold.link_index", model: Element.model_name.human(count: 2)), page_elements_path(@element.page) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_show", model: Element.model_name.human), @element %>
|
||||
<%= link_to t("scaffold.link_index", model: Element.model_name.human(count: 2)), page_elements_path(@element.page) %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.toast class="#{alert ? "text-bg-danger" : ""}" role="alert" aria-live="assertive" aria-atomic="true" data={ controller: "toast" }
|
||||
.toast class="#{alert ? "text-bg-danger" : "text-bg-info"}" role="alert" aria-live="assertive" aria-atomic="true" data={ controller: "toast" }
|
||||
.toast-header
|
||||
/img src="..." class="rounded me-2" alt="...">
|
||||
/strong.me-auto = heading
|
||||
|
|
|
|||
|
|
@ -17,11 +17,10 @@ html data-bs-theme="#{cookies[:"modeTheme"] || "light"}" data-controller="set-th
|
|||
#main-content[data-controller="rich-text-link-targets"]
|
||||
= yield
|
||||
|
||||
.toast-container.position-fixed.bottom-0.start-0.p-3 id="toasts"
|
||||
.toast-container.position-fixed.top-0.end-0.p-3 id="toasts"
|
||||
- if flash.alert
|
||||
= render partial: "layouts/toast", locals: { content: flash.alert, alert: true }
|
||||
- if flash.notice
|
||||
= render partial: "layouts/toast", locals: { content: flash.notice, alert: false }
|
||||
|
||||
/footer.container-fluid.mt-auto.border-top
|
||||
= Rails.configuration.build_version && "Version: #{Rails.configuration.build_version}"
|
||||
= turbo_frame_tag "modal"
|
||||
|
|
|
|||
9
app/views/layouts/modal.html.slim
Normal file
9
app/views/layouts/modal.html.slim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
= turbo_frame_tag "modal" do
|
||||
dialog.bg-body id="modal" data={ controller: :dialog }
|
||||
.float-end
|
||||
form method="dialog"
|
||||
button.btn.btn-outline-danger
|
||||
i.bi.bi-x-lg
|
||||
= yield
|
||||
|
||||
data-action="turbo:submit-end->turbo-modal#submitEnd"
|
||||
|
|
@ -11,5 +11,5 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to("Sprinte zum ersten Element", "##{dom_id(page.elements.first)}", class: "visually-hidden", data: {controller: :hotkey, hotkey: "e", turbo: false}) if page.elements.first %>
|
||||
<%= link_to("Springe zum ersten Element", "##{dom_id(page.elements.first)}", class: "visually-hidden", data: {controller: :hotkey, hotkey: "e", turbo: false}) if page.elements.first %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
<%= render "form", page: @page %>
|
||||
|
||||
<% unless modal? %>
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_show", model: Page.model_name.human), @page %>
|
||||
<%= link_to t("scaffold.link_index", model: Page.model_name.human(count: 2)), report_pages_path(@page.report) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ h2
|
|||
= turbo_frame_tag(dom_id(@page, :notes)) do
|
||||
= render partial: "pages/notes", locals: { page: @page }
|
||||
|
||||
.action-row
|
||||
= link_to t("scaffold.link_edit", model: @page.model_name.human), edit_page_path(@page)
|
||||
= link_to t("scaffold.link_index", model: @page.model_name.human(count: 2)), report_pages_path(@page.report)
|
||||
= button_to t("scaffold.link_destroy", model: @page.model_name.human), @page, method: :delete, class: "btn btn-outline-danger"
|
||||
- unless modal?
|
||||
.action-row
|
||||
= link_to t("scaffold.link_edit", model: @page.model_name.human), edit_page_path(@page)
|
||||
= link_to t("scaffold.link_index", model: @page.model_name.human(count: 2)), report_pages_path(@page.report)
|
||||
= button_to t("scaffold.link_destroy", model: @page.model_name.human), @page, method: :delete, class: "btn btn-outline-danger"
|
||||
|
|
|
|||
|
|
@ -1,29 +1,32 @@
|
|||
.border-bottom.mb-3
|
||||
h1
|
||||
i.bi.bi-journal-text.me-2
|
||||
= @report.name
|
||||
div
|
||||
small.float-end
|
||||
| Erstellt am
|
||||
small
|
||||
'Erstellt am
|
||||
= l(@report.created_at, format: :short)
|
||||
| , zuletzt bearbeitet am
|
||||
', zuletzt bearbeitet am
|
||||
= l(@report.updated_at, format: :short)
|
||||
h1
|
||||
i.bi.bi-journal-text.me-2
|
||||
= @report.name
|
||||
- if @report.comment
|
||||
.smb-4.lead.mb-3
|
||||
= @report.comment
|
||||
.smb-4.lead.mb-5
|
||||
= @report.comment || tag.i("leer")
|
||||
- if @current_page
|
||||
h2
|
||||
i.bi.bi-file-earmark-check
|
||||
=< @current_page.position
|
||||
=< @current_page.path
|
||||
p
|
||||
'URL:
|
||||
= safe_display(@current_page.full_url) { link_to(_1, _1, target: :_blank) }
|
||||
p.actions
|
||||
.d-flex.justify-content-end data-controller="details-list" data-target-id="element_list"
|
||||
.btn-group.me-3
|
||||
= link_to("Alle zu [s]", "#", data: { action: "click->details-list#closeAll", controller: :hotkey, hotkey: "s" }, class: "btn btn-outline-secondary")
|
||||
= link_to("Alle auf [a]", "#", data: { action: "click->details-list#openAll", controller: :hotkey, hotkey: "a" }, class: "btn btn-outline-secondary")
|
||||
= button_to(tag.i(class: "bi bi-trash"), page_path(@current_page), method: :delete, class: "btn btn-outline-danger", form: {data: { turbo_confirm: "Bist du sicher?" }})
|
||||
.current_page data-controller="details-list" data-target-id="element_list"
|
||||
.border-bottom.mb-3.d-flex
|
||||
h2
|
||||
i.bi.bi-file-earmark-check
|
||||
=< @current_page.position
|
||||
=< @current_page.path
|
||||
= page_menu(@current_page)
|
||||
p
|
||||
'URL:
|
||||
= safe_display(@current_page.full_url) { link_to(_1, _1, target: :_blank) }
|
||||
p.actions
|
||||
.d-flex.justify-content-end
|
||||
.btn-group.me-3.visually-hidden
|
||||
= link_to("Alle zu [s]", "#", data: { action: "click->details-list#closeAll", controller: :hotkey, hotkey: "s" }, class: "btn btn-outline-secondary")
|
||||
= link_to("Alle auf [a]", "#", data: { action: "click->details-list#openAll", controller: :hotkey, hotkey: "a" }, class: "btn btn-outline-secondary")
|
||||
/= button_to(tag.i(class: "bi bi-trash"), page_path(@current_page), method: :delete, class: "btn btn-outline-danger", form: {data: { turbo_confirm: "Bist du sicher?" }})
|
||||
.row
|
||||
.col-lg-3.col-md-4.col-sm-12
|
||||
.page_nav.sticky-top
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
.text-end.fw-bold = SuccessCriterion.human_attribute_name(:quick_fix)
|
||||
.col-md-8.col-lg-9
|
||||
= success_criterion.quick_fix
|
||||
.row.mb-3
|
||||
.row
|
||||
.col-md-4.col-lg-3
|
||||
.text-end.fw-bold = SuccessCriterion.human_attribute_name(:test_instructions)
|
||||
.col-md-8.col-lg-9
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@
|
|||
= form.rich_text_area :quick_fix
|
||||
= form.rich_text_area :test_comment
|
||||
= form.submit class: "btn btn-primary"
|
||||
= link_to "Abbrechen", success_criterion.persisted? ? success_criterion : success_criterion.element, class: "btn btn-outline-secondary"
|
||||
- unless modal?
|
||||
=< link_to "Abbrechen", success_criterion.persisted? ? success_criterion : success_criterion.element, class: "btn btn-outline-secondary"
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ summary.d-flex.align-items-start id=dom_id(success_criterion, :header)
|
|||
= success_criterion_badge(success_criterion.check.external_number, extra_classes: "text-bg-info me-1")
|
||||
|
||||
= success_criterion_badge(success_criterion.level, extra_classes: "sc-level-#{success_criterion.level.to_s.downcase} me-1")
|
||||
i.bi.bi-grip-vertical.handle
|
||||
i.bi.bi-grip-vertical.handle.me-1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
= turbo_stream.remove dom_id(@success_criterion)
|
||||
- @success_criterion.element.success_criteria.reject { _1 == @success_criterion }.each do |sc|
|
||||
- Rails.logger.debug "Send to sc #{sc.id}"
|
||||
= turbo_stream.update dom_id(sc, :position), "#{sc.page.position}.#{sc.element.position}.#{sc.position}"
|
||||
= turbo_stream.update dom_id(sc, :position), "#{sc.page.position}.#{sc.element.position}.#{sc.position}"
|
||||
|
||||
= turbo_stream_toast("Erfolgskriterium wurde gelöscht", true)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,7 @@
|
|||
h1
|
||||
= t("scaffold.pagetitle_edit", model: SuccessCriterion.model_name.human)
|
||||
= turbo_frame_tag(dom_id(@success_criterion, :frame)) do
|
||||
.d-flex
|
||||
h2.my-2 Bearbeiten
|
||||
.ms-auto
|
||||
= success_criterion_menu(@success_criterion, false)
|
||||
/= dropdown_menu(klass: "mt-3 b-0") do
|
||||
ul.list-group
|
||||
li.list-group-item
|
||||
= success_criterion_edit_button(@success_criterion, true)
|
||||
li.list-group-item
|
||||
= button_to(tag.i(class: "bi bi-trash") + " Löschen".html_safe, @success_criterion, method: :delete, class: "btn text-danger", data: { turbo_confirm: "Bist du sicher?"})
|
||||
|
||||
.mb-3
|
||||
= render "form", success_criterion: @success_criterion
|
||||
.action-row
|
||||
= link_to t("scaffold.link_show", model: SuccessCriterion.model_name.human), @success_criterion
|
||||
= link_to t("scaffold.link_index", model: SuccessCriterion.model_name.human(count: 2)), element_success_criteria_path(@success_criterion.element)
|
||||
h2 Erfolgskriterium bearbeiten
|
||||
.mb-3
|
||||
= render "form", success_criterion: @success_criterion
|
||||
- unless modal?
|
||||
.action-row
|
||||
= link_to t("scaffold.link_show", model: SuccessCriterion.model_name.human), @success_criterion
|
||||
= link_to t("scaffold.link_index", model: SuccessCriterion.model_name.human(count: 2)), element_success_criteria_path(@success_criterion.element)
|
||||
|
|
|
|||
|
|
@ -3,5 +3,4 @@
|
|||
|
||||
- @success_criterion.element.success_criteria.each do |sc|
|
||||
= turbo_stream.update(dom_id(sc, :position), sc.number)
|
||||
|
||||
= turbo_stream_toast("Erfolgskriterium gespeichert: #{t("activerecord.attributes.success_criterion.results/#{@success_criterion.result}")}", false)
|
||||
= turbo_stream_toast("Erfolgskriterium gespeichert: #{t("activerecord.attributes.success_criterion.results/#{@success_criterion.result}")}", false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue