Couple small improvement in templates and models
+ Updated README.md + Moved links property to the Location Model for every location type + Updated templates + Added footerdoc_update
parent
35de6f9316
commit
03f4080bbe
|
@ -1,4 +1,4 @@
|
|||
# Geoffrey: A Discord Bot for Minecraft Servers
|
||||
# Geoffrey: A Location Database for Minecraft Servers
|
||||
Geoffrey was created to be an information source for base and shop locations on Minecraft severs. The bot mainly tracks
|
||||
base, shop, and tunnel locations. This allows for users to quickly find each other's builds and find shops selling
|
||||
goods.
|
||||
|
|
44
models.py
44
models.py
|
@ -83,6 +83,8 @@ class Player(models.Model):
|
|||
|
||||
|
||||
class Location(models.Model):
|
||||
info_page = None
|
||||
|
||||
"""Model of a Location"""
|
||||
|
||||
DIMENSIONS = (
|
||||
|
@ -194,8 +196,10 @@ class Location(models.Model):
|
|||
"""
|
||||
child = self.loc_child_obj
|
||||
|
||||
if child != self:
|
||||
return self.loc_child_obj.link
|
||||
if child is not self:
|
||||
return reverse(child.info_page, kwargs={"id": child.id})
|
||||
else:
|
||||
return reverse(self.info_page, kwargs={"id": self.id})
|
||||
|
||||
@property
|
||||
def loc_child_obj(self):
|
||||
|
@ -233,30 +237,22 @@ class Location(models.Model):
|
|||
|
||||
|
||||
class Shop(Location):
|
||||
info_page = "GeoffreyShopInfo"
|
||||
|
||||
def __str__(self):
|
||||
return "Shop: %s" % self.name
|
||||
|
||||
@property
|
||||
def link(self):
|
||||
"""
|
||||
Link to the shop's page
|
||||
"""
|
||||
return reverse("GeoffreyShopInfo", kwargs={"id": self.id})
|
||||
|
||||
|
||||
class Base(Location):
|
||||
info_page = "GeoffreyBaseInfo"
|
||||
|
||||
def __str__(self):
|
||||
return "Base: %s" % self.name
|
||||
|
||||
@property
|
||||
def link(self):
|
||||
"""
|
||||
Link to the base's page
|
||||
"""
|
||||
return reverse("GeoffreyBaseInfo", kwargs={"id": self.id})
|
||||
|
||||
|
||||
class Town(Location):
|
||||
info_page = "GeoffreyTownInfo"
|
||||
|
||||
residents = models.ManyToManyField(Player)
|
||||
"""
|
||||
Players who are members of the town
|
||||
|
@ -301,21 +297,13 @@ class Town(Location):
|
|||
|
||||
return json
|
||||
|
||||
@property
|
||||
def link(self):
|
||||
"""
|
||||
Link to the town's page
|
||||
"""
|
||||
return reverse("GeoffreyTownInfo", kwargs={"id": self.id})
|
||||
|
||||
class Market(Location):
|
||||
info_page = "GeoffreyMarketInfo"
|
||||
|
||||
|
||||
class PublicFarm(Location):
|
||||
@property
|
||||
def link(self):
|
||||
"""
|
||||
Link to the Farms's page
|
||||
"""
|
||||
return reverse("GeoffreyPublicFarmInfo", kwargs={"id": self.id})
|
||||
info_page = "GeoffreyPublicFarmInfo"
|
||||
|
||||
|
||||
class Resource(models.Model):
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
|
@ -26,6 +26,8 @@
|
|||
<script type="text/javascript" language="javascript"
|
||||
src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
|
||||
|
||||
<link href="{% static 'GeoffreyApp/css/geoffrey.css' %}" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -54,5 +56,13 @@
|
|||
<h1>{% block header %}{% endblock %}</h1>
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<footer class="footer navbar navbar-expand-lg navbar-dark bg-dark ">
|
||||
<div class="container">
|
||||
<span class="text-muted">
|
||||
Made with :sed: by <a href="https://www.zerohighdef.com/" class="text-info">ZeroHD</a>
|
||||
</span>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -27,6 +27,4 @@
|
|||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
{% endblock %}
|
|
@ -17,7 +17,7 @@
|
|||
</p>
|
||||
|
||||
{% endif %}
|
||||
<p>Location: {{ loc.location }}</p>
|
||||
<p>Location: {{ loc.position }}</p>
|
||||
<hr class="my-4">
|
||||
{% block info %}{% endblock %}
|
||||
<iframe src="{{ loc.dynmap_url }}" width="100%" height="500">
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<h2>Locations</h2>
|
||||
<table id="loc_table" class="table table-hover link-table">
|
||||
<thead class="bg-dark">
|
||||
<tr>
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
{{ player.name }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<h2>Locations</h2>
|
||||
{% include "GeoffreyApp/location_table.html" with loc_list=loc_list %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue