Skip to content

Commit

Permalink
Merge pull request #242 from scireum/feature/jvo/Bootstrap-5
Browse files Browse the repository at this point in the history
Bootstrap 5
  • Loading branch information
jakobvogel authored Feb 14, 2024
2 parents a29a96e + bd6f6fe commit 75e012c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<url>https://s3ninja.net</url>

<properties>
<sirius.kernel>dev-42.2.0</sirius.kernel>
<sirius.web>dev-75.3.4</sirius.web>
<sirius.kernel>dev-42.3.0</sirius.kernel>
<sirius.web>dev-76.0.0</sirius.web>
</properties>

<repositories>
Expand Down
24 changes: 17 additions & 7 deletions src/main/resources/templates/bucket.html.pasta
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
<a class="btn btn-success w-100"
href="/ui/@bucket.getEncodedName()?make-public">
<i class="fa-solid fa-lock-open"></i>
<span class="pl-2">Make public</span>
<span class="ps-2">Make public</span>
</a>
<i:else>
<a class="btn btn-danger w-100"
href="/ui/@bucket.getEncodedName()?make-private">
<i class="fa-solid fa-lock"></i>
<span class="pl-2">Make private</span>
<span class="ps-2">Make private</span>
</a>
</i:else>
</i:if>
Expand Down Expand Up @@ -63,7 +63,7 @@
<i:if test="page.getItems().isEmpty()">
<tr>
<td colspan="2"
class="text-muted">
class="border-0 border-top text-muted">
(No objects in bucket)
</td>
</tr>
Expand All @@ -72,13 +72,13 @@
var="obj"
items="page.getItems()">
<tr>
<td>
<td class="border-0 border-top">
<a class="link"
href="/ui/@bucket.getEncodedName()/@obj.getEncodedKey()">@obj.getKey()</a><br/>
<div class="text-muted small">@obj.getSize()</div>
<div class="text-muted small">@obj.getLastModified()</div>
</td>
<td class="text-right pr-0">
<td class="border-0 border-top text-end pe-0">
<i:local name="modalId"
value="generateId('object_info_%s')"/>
<i:local name="propertyNames"
Expand All @@ -89,7 +89,7 @@
title="@obj.getKey()"
cancel="Close"
class="modal-lg modal-dialog-centered">
<div class="text-left"
<div class="text-start"
style="margin-bottom: -1rem;">
<i:if test="properties.isEmpty()">
<p class="text-muted">
Expand All @@ -114,7 +114,7 @@
</div>
</t:modal>
<t:additionalActions label="Actions">
<t:dropdownItem url="@apply('javascript:$(document.querySelector(\'#%s\')).modal()', modalId)"
<t:dropdownItem url="@apply('javascript:showProperties(\'#%s\')', modalId)"
icon="fa-solid fa-circle-info"
label="Properties"/>
<t:dropdownDeleteItem
Expand All @@ -133,6 +133,16 @@
</div>
</div>

<script>
function showProperties(selector) {
const _modalElement = document.querySelector(selector);
if (!_modalElement.modal) {
_modalElement.modal = new bootstrap.Modal(_modalElement);
}
_modalElement.modal.show();
}
</script>

<i:block name="footer">
<i:invoke template="/templates/footer.html.pasta"/>
</i:block>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/footer.html.pasta
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a href="https://www.scireum.de" target="_blank">scireum</a> in Remshalden
</small>
</div>
<div class="text-right">
<div class="text-end">
<small>@sirius.kernel.info.Product.getProduct().getDetails()</small>
</div>
</div>
Expand Down
24 changes: 11 additions & 13 deletions src/main/resources/templates/index.html.pasta
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}

function checkBucketName() {
return new Promise(function (resolve, reject) {
return new Promise((resolve, reject) => {
// make sure we have the text field
const textfield = resolveTextfield();
if (!textfield) {
Expand All @@ -45,13 +45,13 @@
* Checks the form for errors and styles the input accordingly.
*/
function checkForm() {
checkBucketName().then(function (name) {
checkBucketName().then(name => {
// remove style class `error`
const textfield = resolveTextfield();
if (textfield) {
textfield.classList.remove('sci-border-red');
}
}).catch(function (name) {
}).catch(name => {
// add style class `error` unless empty
const textfield = resolveTextfield();
if (textfield) {
Expand All @@ -67,9 +67,9 @@
* Checks the form for errors and submits the form if everything is fine.
*/
function submitForm() {
checkBucketName().then(function (name) {
checkBucketName().then(name => {
location.href = '/ui/' + encodeURIComponent(name) + '?create'
}).catch(function () {
}).catch(() => {
// ignore, error has already been indicated while typing
});
}
Expand Down Expand Up @@ -115,11 +115,9 @@
placeholder="New Bucket…"
autofocus
oninput="checkForm();"/>
<div class="input-group-append">
<a class="btn btn-outline-secondary"
onclick="submitForm();">
<i class="fa-solid fa-plus"></i></a>
</div>
<a class="btn btn-outline-secondary"
onclick="submitForm();">
<i class="fa-solid fa-plus"></i></a>
</div>
</form>
</div>
Expand Down Expand Up @@ -148,7 +146,7 @@
<i:if test="buckets.isEmpty()">
<tr>
<td colspan="2"
class="text-muted">
class="border-0 border-bottom text-muted">
(No buckets)
</td>
</tr>
Expand All @@ -157,7 +155,7 @@
var="bucket"
items="buckets">
<tr class="@if(bucket.isPrivate()) { sci-left-border-red } else { sci-left-border-green }">
<td>
<td class="border-0 border-top">
<a class="@if(bucket.isPrivate()) { sci-text-red } else { sci-text-green }"
href="/ui/@bucket.getEncodedName()">@bucket.getName()</a><br>
<i:if test="bucket.isPrivate()">
Expand All @@ -167,7 +165,7 @@
</i:else>
</i:if>
</td>
<td class="text-right pr-0">
<td class="border-0 border-top text-end pe-0">
<t:additionalActions label="Actions">
<i:if test="bucket.isPrivate()">
<t:dropdownItem url="@apply('/ui/%s?make-public&return=%%2Fui', bucket.getEncodedName())"
Expand Down

0 comments on commit 75e012c

Please sign in to comment.