Slowly adding themes x10

This commit is contained in:
Michael Wain 2024-11-27 19:30:47 +03:00
parent 94ab1a6fe4
commit 635ffca883
3 changed files with 20 additions and 6 deletions

View File

@ -71,4 +71,5 @@ edditreq=Send request
scrireqq=Script requests
acceptbtnreq=Accept
themes=Themes
thmsel=Selected
thmsel=Selected
thmdes=Not used

View File

@ -282,4 +282,16 @@ function remove_synergy(obj) {
$.post("/api/remove_synergy", "synergy_id="+($(obj).attr("data-synergy-id")), function(data, status) {
window.location.reload();
});
}
}
$(function() {
$(".is-selected-theme").each(function() {
if( $(this).attr("data-selected") == "true" ) {
$(this).html($("#selected_button_texts").attr("data-selected"));
$(this).addClass("btn-success");
} else {
$(this).html($("#selected_button_texts").attr("data-notselected"));
$(this).addClass("btn-secondary");
}
});
});

View File

@ -4,6 +4,7 @@
<th:block th:insert="~{fragments/header}"></th:block>
<link rel="stylesheet" href="/static/css/util.css">
<link rel="stylesheet" href="/static/css/panel.css">
<div id="selected_button_texts" th:data-selected="#{thmsel}" th:data-notselected="#{thmdes}" style="display: none;"></div>
</head>
<body class="bg-body-tertiary">
<div th:replace="~{fragments/floating_button}"></div>
@ -91,8 +92,8 @@
</p>
<th:block th:unless="${section == 'script_request'}">
<a th:unless="${section == 'actions' OR section == 'themes'}" href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal_syn" onclick="" class="btn btn-primary" th:text="#{eddittsynn}"></a>
<a th:if="${section == 'themes'}" href="#" th:data-id="${cc.id}" th:data-selected="${cc.selected}" class="btn btn-success is-selected-theme" th:text="#{thmsel}"></a>
<a href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal" onclick="edit_entry(this)" class="btn btn-primary" th:text="#{edditbtn}"></a>
<a th:if="${section == 'themes'}" href="#" th:data-id="${cc.id}" th:data-selected="${cc.selected}" class="btn is-selected-theme"></a>
<a th:unless="${section == 'themes'}" href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal" onclick="edit_entry(this)" class="btn btn-primary" th:text="#{edditbtn}"></a>
<a href="#" th:data-id="${cc.id}" onclick="remove_entry(this)" class="btn btn-danger" th:text="#{remombtn}"></a>
</th:block>
<th:block th:if="${section == 'script_request'}">
@ -131,8 +132,8 @@
</p>
<th:block th:unless="${section == 'script_request'}">
<a th:unless="${section == 'actions' OR section == 'themes'}" href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal_syn" onclick="show_synergies_modal(this)" class="btn btn-primary" th:text="#{eddittsynn}"></a>
<a th:if="${section == 'themes'}" href="#" th:data-id="${cc.id}" th:data-selected="${cc.selected}" class="btn btn-success is-selected-theme" th:text="#{thmsel}"></a>
<a href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal" onclick="edit_entry(this)" class="btn btn-primary" th:text="#{edditbtn}"></a>
<a th:if="${section == 'themes'}" href="#" th:data-id="${cc.id}" th:data-selected="${cc.selected}" class="btn is-selected-theme"></a>
<a th:unless="${section == 'themes'}" href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal" onclick="edit_entry(this)" class="btn btn-primary" th:text="#{edditbtn}"></a>
<a href="#" th:data-id="${cc.id}" onclick="remove_entry(this)" class="btn btn-danger" th:text="#{remombtn}"></a>
</th:block>
<th:block th:if="${section == 'script_request'}">