1
0
Fork 0
mirror of https://gitlab.com/niansa/discordlistforbots.git synced 2025-03-06 20:49:22 +01:00
discordlistforbots/views/botlist.csp
2021-06-11 19:07:35 +02:00

59 lines
2 KiB
Text

<%inc
/*
* discordlistforbots
* Copyright (C) 2021 niansa
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "controllers/views.h"
#include "config.h" %>
<%c++ auto modView = @@.get<bool>("modView");%>
<%c++ auto justMine = @@.get<bool>("justMine");%>
<%layout global_layout%>
<title>{%SHORT_NAME%}</title>
<div class="container text-center">
<img style="width:15%;height:15%;" src="/logo.png">
<p class="title">{%LONG_NAME%}</p>
<p>{%DESCRIPTION%}</p>
<%c++ if (@@.get<bool>("authed")) {%>
<%c++ if (justMine or modView) {%>
<a class="special-button" href="@all">All bots</a>
<%c++ } else {%>
<a class="special-button" href="@me">My bots</a>
<%c++ }%>
<a class="special-button" href="register">Register bot</a>
<%c++ }%>
<hr>
<br>
<%c++ for (const auto& [bot_id, bot] : @@.get<std::map<uint64_t, Bot>>("bots")) {%>
<a class="special-button tile" href="{%bot_id%}/detail" style="background-color:{%(bot.approved?"#222222":"red")%};color:white;">
<img src="{%bot.avatar_url%}" style="width:128px;height:128px;">
<center>
<div class="votesbox">
<p class="votestext">Votes: <b>{%bot.votes%}</b></p>
</div>
</center>
<p style="line-height:0px;font-size:20px;">{%bot.name%}</p>
<p>{%bot.short_description%}</p>
<%c++ if (not bot.approved) {%>
<i>Not yet approved</i>
<%c++ }%>
</a>
<hr class="tilespacer">
<%c++ }%>
</div>