Skip to content

Commit

Permalink
Merge branch 'dev' into 'master'
Browse files Browse the repository at this point in the history
- Strings : ::token added (mirror ::split)

See merge request Trehinos/Thor!37
  • Loading branch information
Trehinos committed Aug 17, 2023
2 parents 931fbf9 + 3ff7eb7 commit 08fe74f
Show file tree
Hide file tree
Showing 110 changed files with 1,622 additions and 789 deletions.
4 changes: 2 additions & 2 deletions app/res/config/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
app_vendor: Trehinos
app_name: Thor
app_version: 1.0.0
app_version_name: 'Thor v1'
app_version: 1.1.0
app_version_name: 'v1.1'
env: DEV
lang: fr
timezone: Europe/Paris
Expand Down
2 changes: 1 addition & 1 deletion app/res/static/assets/list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ vendors-css:
cache: true
list:
- vendors/bootstrap.min.css
- vendors/fontawesome/all.min.css
- vendors/datatables.min.css
vendors-js:
type: js
cache: true
list:
- vendors/jquery.min.js
- vendors/bootstrap.bundle.min.js
- vendors/fontawesome.min.js
- vendors/datatables.min.js
- vendors/dt-langs/fr.js
30 changes: 9 additions & 21 deletions app/res/static/assets/thor/thor-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ Main elements of Thor
*/

#footer {
position: fixed;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 64px;
background: #00000077;
color: #fff;
background: #ffffff77;
color: #000;
line-height: 14px;
font-size: 8pt;
padding: 8px 4px;
text-align: center;
}

#footer button {
color: #ddf;
color: #440;
text-decoration: none;
border: none;
background: none;
padding: 0 2px;
}
#footer button:hover {
color: #bbf;
color: #330;
}

#content {
Expand All @@ -43,33 +43,21 @@ Main elements of Thor
position: relative;
}

#toolbar {
z-index: 1;
width: 100%;
background: #bbb;
color: #444;
font-weight: 900;
padding: 8px 16px;
height: 48px;
line-height: 24px;
}

#titlebar {
z-index: 1;
width: 100%;
background: #444;
color: #ccc;
background: #ddd;
color: #444;
font-weight: 900;
height: 24px;
line-height: 24px;
padding-left: 16px;
}

#page {;
padding: 144px 16px 96px 16px;
padding: 80px 16px 96px 16px;
}


#modal .modal-header {
position: relative;
}
Expand Down Expand Up @@ -115,7 +103,7 @@ Main elements of Thor on pages
vertical-align: middle;
}

#menu .dropdown-menu li span.keys {
#menu .dropdown-menu span.keys {
opacity: 0.1;
transition: opacity ease 300ms;
}
Expand Down
6 changes: 3 additions & 3 deletions app/res/static/assets/thor/thor.toast.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let toastList = [];

function showToasts() {
$("#btn-show-toasts").find(".fa-lg").removeClass("text-danger");
$("#btn-show-toasts").removeClass("btn-danger").addClass("btn-dark");
toastList.forEach((toast) => {
toast.show();
});
Expand All @@ -11,12 +11,12 @@ function initToasts() {
let toastElList = [].slice.call(document.querySelectorAll('.toast'));
toastList = toastElList.map(function (toastEl) {
let toast = new bootstrap.Toast(toastEl);
$("#btn-show-toasts").find(".fa-lg").removeClass("text-danger");
$("#btn-show-toasts").removeClass("btn-danger").addClass("btn-dark");
toast.show();

toastEl.addEventListener('hidden.bs.toast', () => {
if ($(".toast.show").length < 1) {
$("#btn-show-toasts").find(".fa-lg").addClass("text-danger");
$("#btn-show-toasts").removeClass("btn-dark").addClass("btn-danger");
}
});

Expand Down
2 changes: 1 addition & 1 deletion app/res/static/assets/vendors
Submodule vendors updated from a6d71f to d04d24
4 changes: 4 additions & 0 deletions app/res/static/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,7 @@ clear/logs:
route/list:
class: Thor\Framework\Commands\Http\RoutesList
description: 'list all routes in app/res/static/routes.yml'

test:
class: App\Test
description: '...'
2 changes: 1 addition & 1 deletion app/res/static/kernels.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cli: Thor\Cli\CliKernel
daemon: Thor\Cli\DaemonScheduler
daemon: Thor\Cli\Daemon\DaemonScheduler
api: Thor\Http\HttpKernel
web: Thor\Web\WebKernel
1 change: 1 addition & 0 deletions app/res/views/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{% block head_js %}{% endblock %}
</head>
<body>
{% include "components.html.twig" %}
{% block body_html %}
<div class="container">
<h1>{% block body_title %}{% endblock %}</h1>
Expand Down
78 changes: 78 additions & 0 deletions app/res/views/components.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<template id="thor-vendors-css">{{ asset("thor-css") }}{{ asset("vendors-css") }}</template>

<script>
const E = {
create: (type = "div", classes = "", text = null) => {
let e = document.createElement(type);
e.setAttribute("class", classes);
if (text !== null) {
e.textContent = text;
}
return e;
},
icon: (type) => {
return E.create("i", `fas fa-${type}`);
},
template: (id) => {
return document.getElementById(id);
}
};
class ThorElement extends HTMLElement {
constructor(type = "div", classes = "", text = null) {
super();
let styles = E.template("thor-vendors-css").cloneNode(true).innerHTML;
this.shadow = this.attachShadow({mode: "open"});
this.shadow.innerHTML = styles;
this.root = E.create(type, classes, text);
}
}
class ThorButton extends ThorElement {
constructor() {
super("button", "box");
let menuTarget = this.getAttribute("menu-target");
let link = this.getAttribute("link");
let icon = this.getAttribute("icon") ?? "circle";
let text = this.textContent;
let color = this.getAttribute("color");
if (link !== null) {
this.root.setAttribute("onclick", `window.location.href = "${link}";`);
} else if (menuTarget !== null) {
this.root.setAttribute("onclick", `menuClick($('#${menuTarget}'))`);
}
if (color !== null) {
this.root.setAttribute("style", `background: ${color};`)
}
if (icon !== null) {
this.root.appendChild(E.icon(`${icon} box-icon`));
}
this.root.appendChild(E.create("span", "box-text", text));
this.shadow.appendChild(this.root);
}
}
class ThorPanel extends ThorElement {
constructor() {
super("div", "card");
let description = this.getAttribute("description") ?? "";
let body = E.create("div", "card-body", description);
this.root.appendChild(body);
let footer = E.create("div", "card-footer");
for (let node of this.childNodes) {
footer.appendChild(node.cloneNode(true));
}
this.root.appendChild(footer);
this.shadow.appendChild(this.root);
}
}
customElements.define("thor-button", ThorButton);
customElements.define("thor-panel", ThorPanel);
</script>
24 changes: 11 additions & 13 deletions app/res/views/menu.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,30 @@
{% set is_group = item.group is defined %}
{% if (item.authorization is defined and authorized(item.authorization)) or item.authorization is not defined %}
{% if not is_group %}
<li class="nav-item">
<a
href="#"
<button type="button"
id="btn-{{ item.route }}"
onclick="menuClick($(this));"
data-url="{% if item.route != '.' %}{{ url(item.route) }}{% else %}#{% endif %}"
data-item="{{ item.route }}"
title="{{ DICT.menu[item.label] ?? item.label ?? '' }}"
class="nav-link {% if server.currentRouteName == item.route %}active{% endif %}"
class="btn btn-light text-start m-1 w-100 {% if server.currentRouteName == item.route %}active{% endif %}"
>
{{ icon(item.icon, (item.icon_col ?? 'fas'), true) }}
<span class="menu-label" title="{{ item.key }}">
{{ DICT.menu[item.label] ?? item.label ?? '' }}
</span>
</a>
</li>
</button>
{% else %}
{% set subactive = false %}
{% for sub_item in item.group %}
{% if sub_item.route == server.currentRouteName %}{% set subactive = true %}{% endif %}
{% endfor %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle {% if subactive %}active{% endif %}" href="#" data-bs-toggle="dropdown">
<div class="dropdown">
<button type="button" class="btn btn-light text-start m-1 w-100 dropdown-toggle {% if subactive %}active{% endif %}" href="#" data-bs-toggle="dropdown">
{{ icon(item.icon, (item.icon_col ?? 'fas'), true) }}
{{ DICT.menu[item.label] ?? item.label ?? '' }}
</a>
<ul class="dropdown-menu">
</button>
<ul class="dropdown-menu w-100">
{% if item.route is defined %}
<li>
<a
Expand Down Expand Up @@ -81,7 +78,7 @@
{% endif %}
{% endfor %}
</ul>
</li>
</div>
{% endif %}
{% endif %}
{% endfor %}
Expand All @@ -95,11 +92,12 @@
let url = $elem.data("url");
loadPage(url, null, (response) => {
$elem.addClass("active");
unselect($("#menu ul li a"));
unselect($("#menu .btn, #menu a"));
if ($elem.hasClass("dropdown-item")) {
$elem.parent().parent().parent().find("a.dropdown-toggle").addClass("active");
$elem.parent().parent().parent().find("button.dropdown-toggle").addClass("active");
}
window.history.pushState({"html": response}, null, "?menuItem=" + $elem.data("item"));
$("#menu .btn-close").click();
});
}
</script>
Loading

0 comments on commit 08fe74f

Please sign in to comment.