mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-26 06:10:58 +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.use(cors());
|
||||||
|
|
||||||
app.get("/", (request, response, next) => {
|
app.get("/", (request, response, next) => {
|
||||||
response.render("index.hbs", {
|
response.render("gather.hbs", {
|
||||||
redirect: config.ensl_url,
|
redirect: config.ensl_url,
|
||||||
bot_url: config.steam_bot_link,
|
bot_url: config.steam_bot_link,
|
||||||
rules_url: config.ensl_rules_url
|
rules_url: config.ensl_rules_url
|
||||||
|
@ -30,44 +30,41 @@ module.exports = app => {
|
||||||
response.status(200).json(gather.toJson());
|
response.status(200).json(gather.toJson());
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/messages", (request, response) => {
|
app.get("/api/messages", (request, response) => {
|
||||||
response.format({
|
const limit = parseInt(request.query.limit, 10) || 250;
|
||||||
json: function() {
|
const page = parseInt(request.query.page, 10) || 0;
|
||||||
const limit = parseInt(request.query.limit, 10) || 250;
|
let query = {};
|
||||||
const page = parseInt(request.query.page, 10) || 0;
|
let searchTerm = request.query.query;
|
||||||
let query = {};
|
if (searchTerm) {
|
||||||
let searchTerm = request.query.query;
|
query = {
|
||||||
if (searchTerm) {
|
$text: {
|
||||||
query = {
|
$search: searchTerm
|
||||||
$text: {
|
|
||||||
$search: searchTerm
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
Message
|
};
|
||||||
.find(query)
|
}
|
||||||
.limit(limit)
|
Message
|
||||||
.skip(page * limit)
|
.find(query)
|
||||||
.sort({createdAt: -1})
|
.limit(limit)
|
||||||
.exec((error, messages) => {
|
.skip(page * limit)
|
||||||
if (error) {
|
.sort({createdAt: -1})
|
||||||
winston.error(error);
|
.exec((error, messages) => {
|
||||||
return response.status(500).json({
|
if (error) {
|
||||||
message: "An error occurred",
|
winston.error(error);
|
||||||
error: JSON.stringify(error)
|
return response.status(500).json({
|
||||||
});
|
message: "An error occurred",
|
||||||
}
|
error: JSON.stringify(error)
|
||||||
response.status(200).json({
|
|
||||||
messages: messages,
|
|
||||||
page: page,
|
|
||||||
limit: limit
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
default: function() {
|
response.status(200).json({
|
||||||
response.render("messages.hbs");
|
messages: messages,
|
||||||
}
|
page: page,
|
||||||
})
|
limit: limit
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/messages", (request, response) => {
|
||||||
|
response.render("messages.hbs");
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("*", (request, response) => {
|
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