mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-22 12:41:11 +00:00
Rename gather template
This commit is contained in:
parent
6d75b29edc
commit
880649bdc0
2 changed files with 92 additions and 37 deletions
|
@ -12,7 +12,7 @@ module.exports = app => {
|
|||
app.use(cors());
|
||||
|
||||
app.get("/", (request, response, next) => {
|
||||
response.render("index.hbs", {
|
||||
response.render("gather.hbs", {
|
||||
redirect: config.ensl_url,
|
||||
bot_url: config.steam_bot_link,
|
||||
rules_url: config.ensl_rules_url
|
||||
|
@ -30,44 +30,41 @@ module.exports = app => {
|
|||
response.status(200).json(gather.toJson());
|
||||
});
|
||||
|
||||
app.get("/messages", (request, response) => {
|
||||
response.format({
|
||||
json: function() {
|
||||
const limit = parseInt(request.query.limit, 10) || 250;
|
||||
const page = parseInt(request.query.page, 10) || 0;
|
||||
let query = {};
|
||||
let searchTerm = request.query.query;
|
||||
if (searchTerm) {
|
||||
query = {
|
||||
$text: {
|
||||
$search: searchTerm
|
||||
}
|
||||
};
|
||||
app.get("/api/messages", (request, response) => {
|
||||
const limit = parseInt(request.query.limit, 10) || 250;
|
||||
const page = parseInt(request.query.page, 10) || 0;
|
||||
let query = {};
|
||||
let searchTerm = request.query.query;
|
||||
if (searchTerm) {
|
||||
query = {
|
||||
$text: {
|
||||
$search: searchTerm
|
||||
}
|
||||
Message
|
||||
.find(query)
|
||||
.limit(limit)
|
||||
.skip(page * limit)
|
||||
.sort({createdAt: -1})
|
||||
.exec((error, messages) => {
|
||||
if (error) {
|
||||
winston.error(error);
|
||||
return response.status(500).json({
|
||||
message: "An error occurred",
|
||||
error: JSON.stringify(error)
|
||||
});
|
||||
}
|
||||
response.status(200).json({
|
||||
messages: messages,
|
||||
page: page,
|
||||
limit: limit
|
||||
});
|
||||
};
|
||||
}
|
||||
Message
|
||||
.find(query)
|
||||
.limit(limit)
|
||||
.skip(page * limit)
|
||||
.sort({createdAt: -1})
|
||||
.exec((error, messages) => {
|
||||
if (error) {
|
||||
winston.error(error);
|
||||
return response.status(500).json({
|
||||
message: "An error occurred",
|
||||
error: JSON.stringify(error)
|
||||
});
|
||||
},
|
||||
default: function() {
|
||||
response.render("messages.hbs");
|
||||
}
|
||||
})
|
||||
}
|
||||
response.status(200).json({
|
||||
messages: messages,
|
||||
page: page,
|
||||
limit: limit
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/messages", (request, response) => {
|
||||
response.render("messages.hbs");
|
||||
});
|
||||
|
||||
app.get("*", (request, response) => {
|
||||
|
|
58
views/gather.hbs
Normal file
58
views/gather.hbs
Normal file
|
@ -0,0 +1,58 @@
|
|||
<div id="wrapper">
|
||||
{{>menu}}
|
||||
<div style="min-height: 750px;">
|
||||
<div class="container-fluid">
|
||||
<div class="row" id="authenticating">
|
||||
<div class="col-lg-6 col-lg-offset-3">
|
||||
<div class="add-top jumbotron jumbo-auth text-center">
|
||||
<div>
|
||||
<img src="/images/ensl_logo.png" class="jumbo-img" alt="ENSL Logo" />
|
||||
</div>
|
||||
<br />
|
||||
<h3>Authenticating your ENSL account</h3>
|
||||
<br />
|
||||
<div>
|
||||
<img src="/images/spinner.svg" class="spinner" alt="Loading" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="gather-banned" style="display:none;">
|
||||
<div class="col-lg-6 col-lg-offset-3">
|
||||
<div class="add-top jumbotron jumbo-auth text-center">
|
||||
<div>
|
||||
<img src="/images/ensl_logo.png" alt="ENSL Logo" />
|
||||
</div>
|
||||
<h3>You're currently barred from joining gathers</h3>
|
||||
<h3><small>Either wait for the ban to expire or talk to an admin to get it lifted</small></h3>
|
||||
<br />
|
||||
<p><a class="btn btn-primary btn-lg" href="{{ redirect }}" role="button">See the ban list</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="auth-required" style="display:none;">
|
||||
<div class="col-lg-6 col-lg-offset-3">
|
||||
<div class="add-top jumbotron jumbo-auth text-center">
|
||||
<div>
|
||||
<img src="/images/ensl_logo.png" alt="ENSL Logo" />
|
||||
</div>
|
||||
<h3>You need to be logged in to the ENSL website ({{ redirect }}) to access gathers</h3>
|
||||
<h3><small>If you are logged on, try visiting a few pages on ENSL.org so the server can update your cookies</small></h3>
|
||||
<h3><small>If this error persists please contact an admin to fix it</small></h3>
|
||||
<br />
|
||||
<p><a class="btn btn-primary btn-lg" href="{{ redirect }}" role="button">Go to website</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2 hidden-xs">
|
||||
<ul class="nav" id="side-menu"></ul>
|
||||
</div>
|
||||
<div class="col-md-4" id="chatroom"></div>
|
||||
<div class="col-md-6" id="gathers"></div>
|
||||
<div class="col-md-6 col-md-offset-6" id="archived-gathers"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{>foot}}
|
Loading…
Reference in a new issue