Improve setting page

This commit is contained in:
Sebastien 2019-06-16 18:34:40 +02:00
parent fd90df0559
commit b05401777c
2 changed files with 71 additions and 60 deletions

View File

@ -137,7 +137,6 @@ public class GeneralWebView {
addGuildAndRedirect(model, token, guildId, user.getMutualGuilds()); addGuildAndRedirect(model, token, guildId, user.getMutualGuilds());
Guild guild = MainBot.jda.getGuildById(guildId); Guild guild = MainBot.jda.getGuildById(guildId);
model.addAttribute("settings", SettingsUtils.getInstance().extractSettings(guild)); model.addAttribute("settings", SettingsUtils.getInstance().extractSettings(guild));
model.addAttribute("isAdmin", SettingsUtils.getInstance().checkPermission(token, guildId));
} catch (UnknownTokenException e) { } catch (UnknownTokenException e) {
throw new ForbiddenException(); throw new ForbiddenException();
} }

View File

@ -3,7 +3,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
<title>Claptrap Bot</title> <title>Bot Settings - Claptrap Bot</title>
<link rel="icon" <link rel="icon"
type="image/x-icon" type="image/x-icon"
href="/favicon.png"/> href="/favicon.png"/>
@ -31,11 +31,25 @@
<main> <main>
<div class="section no-pad-bot main" id="index-banner"> <div class="section no-pad-bot main container" id="index-banner">
<h2 class="center" th:text="${guild_name}"></h2>
<div class="row">
<div class="card-panel col s12 m12 l10 offset-l1" style="border-radius: 10px">
<div class="row">
<h2 class="center col s12" style="margin-bottom: 0">Bot Settings</h2>
</div>
<div class="row">
<div class="divider col s12"></div>
<div class="divider col s12"></div>
<h4 class="center col s12" th:text="${guild_name}"></h4>
<div class="divider col s12"></div>
<div class="divider col s12"></div>
</div>
<div th:each="setting : ${settings}"> <div th:each="setting : ${settings}">
<div class="section row"> <div class="row">
<div class="col l6 offset-l3 m10 offset-m1 s10 offset-s1"> <div class="col l10 offset-l1 m10 offset-m1 s10 offset-s1">
<h5 th:text="${setting.name}" style="font-weight: bold"></h5> <h5 th:text="${setting.name}" style="font-weight: bold"></h5>
<div class="switch" th:if="${setting.type.toString() == 'BOOL'}"> <div class="switch" th:if="${setting.type.toString() == 'BOOL'}">
<label> <label>
@ -50,8 +64,7 @@
<div th:id="${setting.id}" class="input-field col l12 m12 s12 collect-select" <div th:id="${setting.id}" class="input-field col l12 m12 s12 collect-select"
th:if="${setting.type.toString() == 'LIST'}"> th:if="${setting.type.toString() == 'LIST'}">
<select> <select>
<option disabled="disabled" th:selected="${setting.current} == ' '" value="">Choose your <option disabled="disabled" th:selected="${setting.current} == ' '" value="">Choose your option
option
</option> </option>
<option th:each="val : ${setting.values}" th:value="${val.id}" <option th:each="val : ${setting.values}" th:value="${val.id}"
th:text="${#strings.capitalize(val.name)}" th:text="${#strings.capitalize(val.name)}"
@ -63,8 +76,7 @@
<div th:id="${setting.id}" class="input-field col l12 m12 s12 collect-select-multiple" <div th:id="${setting.id}" class="input-field col l12 m12 s12 collect-select-multiple"
th:if="${setting.type.toString() == 'SELECT_LIST'}"> th:if="${setting.type.toString() == 'SELECT_LIST'}">
<select multiple="multiple"> <select multiple="multiple">
<option disabled="disabled" value="">Choose your <option disabled="disabled" value="">Choose your option
option
</option> </option>
<option th:each="val : ${setting.values}" th:value="${val.id}" <option th:each="val : ${setting.values}" th:value="${val.id}"
th:text="${#strings.capitalize(val.name)}" th:text="${#strings.capitalize(val.name)}"
@ -83,7 +95,7 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="divider col l6 offset-l3"></div> <div class="divider col s12"></div>
</div> </div>
@ -95,8 +107,8 @@
class="material-icons left">save</i></a> class="material-icons left">save</i></a>
</div> </div>
</div> </div>
</div>
</div>
</div> </div>
<div id="modal_loading" class="modal valign-wrapper"> <div id="modal_loading" class="modal valign-wrapper">