aboutsummaryrefslogtreecommitdiff
path: root/templates/sidebar
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2022-05-24 15:58:53 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2022-05-24 15:58:53 +0000
commitbd504e86f280f0e48e085f1bc1b16308cb2ad895 (patch)
tree94bd229670e9f72cad2086072f7df4e2acd21391 /templates/sidebar
parente5fec07a498298de2a6642e7802b36a85ff90e91 (diff)
correctly render clipboard widgets
Closes #1102 Merge request studip/studip!654
Diffstat (limited to 'templates/sidebar')
-rw-r--r--templates/sidebar/clipboard-widget.php97
-rw-r--r--templates/sidebar/room-clipboard-widget.php109
-rw-r--r--templates/sidebar/widget-layout.php2
3 files changed, 94 insertions, 114 deletions
diff --git a/templates/sidebar/clipboard-widget.php b/templates/sidebar/clipboard-widget.php
index f3716a6..dc2b911 100644
--- a/templates/sidebar/clipboard-widget.php
+++ b/templates/sidebar/clipboard-widget.php
@@ -1,56 +1,47 @@
-<section class="sidebar-widget clipboard-widget"
- id="ClipboardWidget_<?= htmlReady($clipboard_widget_id) ?>"
- data-widget_id="<?= htmlReady($clipboard_widget_id) ?>">
- <header class="sidebar-widget-header">
- <?= _('Eigene Merkzettel') ?>
- </header>
- <section class="sidebar-widget-content">
- <?= $this->render_partial(
- 'sidebar/clipboard-area.php',
- [
- 'clipboards' => $clipboards,
- 'empty_clipboard_string' => _('Ziehen Sie Elemente in diesen Bereich um den Merkzettel zu füllen.'),
- 'selected_clipboard_id' => ($clipboards[0] instanceof Clipboard
- ? $clipboards[0]->id
- : ''),
- 'draggable_items' => $draggable_items,
- 'clipboard_widget_id' => $clipboard_widget_id
- ]
- ) ?>
+<?= $this->render_partial(
+ 'sidebar/clipboard-area.php',
+ [
+ 'clipboards' => $clipboards,
+ 'empty_clipboard_string' => _('Ziehen Sie Elemente in diesen Bereich um den Merkzettel zu füllen.'),
+ 'selected_clipboard_id' => ($clipboards[0] instanceof Clipboard
+ ? $clipboards[0]->id
+ : ''),
+ 'draggable_items' => $draggable_items,
+ 'clipboard_widget_id' => $clipboard_widget_id
+ ]
+) ?>
- <ul class="widget-list widget-links invisible">
- <? foreach ($elements as $index => $element): ?>
- <li id="<?= htmlReady('link-' . md5($element->url)) ?>" <?= $element->icon ? 'style="' . $element->icon->asCSS() .'"' : '' ?>>
- <?= $element->render() ?>
- </li>
- <? endforeach; ?>
- </ul>
+<ul class="widget-list widget-links invisible">
+<? foreach ($elements as $index => $element): ?>
+ <li id="<?= htmlReady('link-' . md5($element->url)) ?>" <?= $element->icon ? 'style="' . $element->icon->asCSS() .'"' : '' ?>>
+ <?= $element->render() ?>
+ </li>
+<? endforeach; ?>
+</ul>
- <? if (!$readonly): ?>
- <form class="default new-clipboard-form"
- action="<?= URLHelper::getLink(
- 'dispatch.php/clipboard/add'
- )?>"
- method="post">
- <?= CSRFProtection::tokenTag() ?>
- <input type="hidden" name="allowed_item_class"
- value="<?= htmlReady($allowed_item_class) ?>">
- <input type="hidden" name="widget_id"
- value="<?= htmlReady($clipboard_widget_id) ?>">
- <label>
- <?= _('Merkzettel hinzufügen') ?>
- <?= tooltipIcon(_('Geben Sie bitte einen Namen ein und klicken Sie auf das Plus-Symbol um einen neuen Merkzettel zu erstellen.')) ?>
- <input type="text" name="name" placeholder="<?= _('Name des neuen Merkzettels') ?>"
- </label>
+<? if (!$readonly): ?>
+ <form class="default new-clipboard-form"
+ action="<?= URLHelper::getLink(
+ 'dispatch.php/clipboard/add'
+ )?>"
+ method="post">
+ <?= CSRFProtection::tokenTag() ?>
+ <input type="hidden" name="allowed_item_class"
+ value="<?= htmlReady($allowed_item_class) ?>">
+ <input type="hidden" name="widget_id"
+ value="<?= htmlReady($clipboard_widget_id) ?>">
+ <label>
+ <?= _('Merkzettel hinzufügen') ?>
+ <?= tooltipIcon(_('Geben Sie bitte einen Namen ein und klicken Sie auf das Plus-Symbol um einen neuen Merkzettel zu erstellen.')) ?>
+ <input type="text" name="name" placeholder="<?= _('Name des neuen Merkzettels') ?>"
+ </label>
- <?= Icon::create('add', 'clickable',
- [ 'title' => _('Hinzufügen')])->asInput([
- 'name' => 'save',
- 'id' => 'add-clipboard-button',
- 'class' => 'middle',
- 'disabled' => 'disabled'
- ]) ?>
- </form>
- <? endif ?>
- </section>
-</section>
+ <?= Icon::create('add', 'clickable',
+ [ 'title' => _('Hinzufügen')])->asInput([
+ 'name' => 'save',
+ 'id' => 'add-clipboard-button',
+ 'class' => 'middle',
+ 'disabled' => 'disabled'
+ ]) ?>
+ </form>
+<? endif ?>
diff --git a/templates/sidebar/room-clipboard-widget.php b/templates/sidebar/room-clipboard-widget.php
index ff00513..dfd2a01 100644
--- a/templates/sidebar/room-clipboard-widget.php
+++ b/templates/sidebar/room-clipboard-widget.php
@@ -1,63 +1,52 @@
-<section class="sidebar-widget clipboard-widget"
- id="ClipboardWidget_<?= htmlReady($clipboard_widget_id) ?>"
- data-widget_id="<?= htmlReady($clipboard_widget_id) ?>">
- <header class="sidebar-widget-header">
- <?= _('Individuelle Raumgruppen') ?>
- </header>
- <section class="sidebar-widget-content">
- <div id="clipboard-group-container" class="<?= $clipboards ? '' : 'invisible' ?>">
- <?= $this->render_partial(
- 'sidebar/clipboard-area.php',
- [
- 'clipboards' => $clipboards,
- 'allowed_item_class' => $allowed_item_class,
- 'empty_clipboard_string' => _('Ziehen Sie Räume in diesen Bereich um die Raumgruppe zu füllen.'),
- 'selected_clipboard_id' => $selected_clipboard_id,
- 'draggable_items' => $draggable_items,
- 'special_item_template' => 'sidebar/room-clipboard-item',
- 'clipboard_widget_id' => $clipboard_widget_id
- ]
- ); ?>
+<div id="clipboard-group-container" class="<?= $clipboards ? '' : 'invisible' ?>">
+ <?= $this->render_partial(
+ 'sidebar/clipboard-area.php',
+ [
+ 'clipboards' => $clipboards,
+ 'allowed_item_class' => $allowed_item_class,
+ 'empty_clipboard_string' => _('Ziehen Sie Räume in diesen Bereich um die Raumgruppe zu füllen.'),
+ 'selected_clipboard_id' => $selected_clipboard_id,
+ 'draggable_items' => $draggable_items,
+ 'special_item_template' => 'sidebar/room-clipboard-item',
+ 'clipboard_widget_id' => $clipboard_widget_id
+ ]
+ ); ?>
- <? if (!$readonly): ?>
- <ul class="widget-list widget-links invisible">
- <? foreach ($elements as $index => $element): ?>
- <li id="<?= htmlReady('link-' . md5($element->url)) ?>" <?= $element->icon ? 'style="' . $element->icon->asCSS() .'"' : '' ?>>
- <a <?= arrayToHtmlAttributes($element->attributes) ?>
- data-url_path = "<?= htmlReady($element->url) ?>">
- <?= htmlReady($element->label) ?>
- </a>
- </li>
- <? endforeach; ?>
- </ul>
+<? if (!$readonly): ?>
+ <ul class="widget-list widget-links invisible">
+ <? foreach ($elements as $index => $element): ?>
+ <li id="<?= htmlReady('link-' . md5($element->url)) ?>" <?= $element->icon ? 'style="' . $element->icon->asCSS() .'"' : '' ?>>
+ <a <?= arrayToHtmlAttributes($element->attributes) ?>
+ data-url_path = "<?= htmlReady($element->url) ?>">
+ <?= htmlReady($element->label) ?>
+ </a>
+ </li>
+ <? endforeach; ?>
+ </ul>
+ <form class="default new-clipboard-form"
+ action="<?= URLHelper::getLink(
+ 'dispatch.php/clipboard/add'
+ )?>"
+ method="post">
+ <?= CSRFProtection::tokenTag() ?>
+ <input type="hidden" name="allowed_item_class"
+ value="<?= htmlReady($allowed_item_class) ?>">
+ <input type="hidden" name="widget_id"
+ value="<?= htmlReady($clipboard_widget_id) ?>">
+ <label>
+ <?= _('Raumgruppe hinzufügen') ?>
+ <?= tooltipIcon(_('Geben Sie bitte einen Namen ein und klicken Sie auf das Plus-Symbol um eine neue Raumgruppe zu erstellen.')) ?>
+ <input type="text" name="name" placeholder="<?= _('Name der neuen Raumgruppe') ?>">
- </div>
+ <?= Icon::create('add', 'clickable',
+ [ 'title' => _('Hinzufügen')])->asInput([
+ 'name' => 'save',
+ 'id' => 'add-clipboard-button',
+ 'class' => 'middle',
+ 'disabled' => 'disabled'
+ ]) ?>
+ </label>
- <form class="default new-clipboard-form"
- action="<?= URLHelper::getLink(
- 'dispatch.php/clipboard/add'
- )?>"
- method="post">
- <?= CSRFProtection::tokenTag() ?>
- <input type="hidden" name="allowed_item_class"
- value="<?= htmlReady($allowed_item_class) ?>">
- <input type="hidden" name="widget_id"
- value="<?= htmlReady($clipboard_widget_id) ?>">
- <label>
- <?= _('Raumgruppe hinzufügen') ?>
- <?= tooltipIcon(_('Geben Sie bitte einen Namen ein und klicken Sie auf das Plus-Symbol um eine neue Raumgruppe zu erstellen.')) ?>
- <input type="text" name="name" placeholder="<?= _('Name der neuen Raumgruppe') ?>">
-
- <?= Icon::create('add', 'clickable',
- [ 'title' => _('Hinzufügen')])->asInput([
- 'name' => 'save',
- 'id' => 'add-clipboard-button',
- 'class' => 'middle',
- 'disabled' => 'disabled'
- ]) ?>
- </label>
-
- </form>
- <? endif ?>
- </section>
-</section>
+ </form>
+<? endif ?>
+</div>
diff --git a/templates/sidebar/widget-layout.php b/templates/sidebar/widget-layout.php
index 7fc3a0c..aa85a41 100644
--- a/templates/sidebar/widget-layout.php
+++ b/templates/sidebar/widget-layout.php
@@ -1,5 +1,5 @@
<div class="<?= $base_class ?>-widget <?= is_array($layout_css_classes) ? htmlReady(implode(' ', $layout_css_classes)) : '' ?>"
- <?= !empty($id) ? sprintf('id="%s"', htmlReady($id)) : '' ?>>
+ <?= arrayToHtmlAttributes($additional_attributes) ?>>
<? if ($title): ?>
<div class="<?= $base_class ?>-widget-header">
<? if (isset($extra)): ?>