Few more tweaks to UI

doc_update
Joey Hines 2018-12-15 15:12:17 -06:00
parent efe12b5b21
commit a4d71858bf
5 changed files with 60 additions and 11 deletions

View File

@ -0,0 +1,25 @@
.sidebar-nav {
list-style-type: none;
margin: 0;
padding: 0;
width: 200px;
background-color: #f1f1f1;
}
.sidebar-option{
float: left;
}
.sidebar-option .sidebar-a {
display: block;
color: #000;
padding: 8px 16px;
text-decoration: none;
}
/* Change the link color on hover */
.sidebar-option .sidebar-a:hover {
background-color: #555;
color: white;
}

View File

@ -1,5 +0,0 @@
.sidebar-nav {
margin-top: 20px;
padding: 0;
list-style: none;
}

View File

@ -1,6 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
{% load static %}
<html lang="en"> <html lang="en">
<head> <head>
<link rel="shortcut icon" type="image/png" href="{% static 'GeoffreyApp/img/icon.png' %}"/>
<meta charset="UTF-8"> <meta charset="UTF-8">
{% block title %}<title>GeoffreyApp</title>{% endblock %} {% block title %}<title>GeoffreyApp</title>{% endblock %}
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
@ -8,20 +11,28 @@
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- Add additional CSS in static file --> <!-- Add additional CSS in static file -->
{% load static %} {% load static %}
<link rel="stylesheet" href="{% static 'css/styles.css' %}"> <link rel="stylesheet" href="{% static 'GeoffreyApp/css/style.css' %}">
</head> </head>
<body> <body>
<body> <body>
<nav class="navbar">
<div class="container-fluid">
<div class="navbar-header">
<a<img src="{% static 'GeoffreyApp/img/icon.png' %}" alt="Sed" height="100" width="100"/>
<a class="navbar-brand" style="color:inherit;cursor:default;">Geoffrey</a>
</div>
</div>
</nav>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-sm-2"> <div class="col-sm-2">
{% block sidebar %} {% block sidebar %}
<ul class="sidebar-nav"> <ul class="sidebar-nav">
<li><a href="{% url 'GeoffreyHome' %}">Home</a></li> <li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyHome' %}">Home</a></li>
<li><a href="{% url 'GeoffreyPlayers' %}">Players</a></li> <li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyPlayers' %}">Players</a></li>
<li><a href="{% url 'GeoffreyBases' %}">Bases</a></li> <li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyBases' %}">Bases</a></li>
<li><a href="{% url 'GeoffreyShops' %}">Shops</a></li> <li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyShops' %}">Shops</a></li>
<li><a href="{% url 'GeoffreyItems' %}">Items</a></li> <li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyItems' %}">Items</a></li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -2,6 +2,13 @@
{% block content %} {% block content %}
<h1>Shops</h1> <h1>Shops</h1>
<form id="searchform" action="{% url 'GeoffreyShops' %}" method="get" accept-charset="utf-8">
<button class="searchbutton" type="submit">
<i class="fa fa-search">Go</i>
</button>
<input class="searchfield" id="searchbox" name="q" type="text" placeholder="Search">
</form>
{% if shop_list %} {% if shop_list %}
<ul> <ul>
{% for shop in shop_list %} {% for shop in shop_list %}

View File

@ -2,6 +2,7 @@ from django.shortcuts import render
from django.views.generic import View from django.views.generic import View
from GeoffreyApp.models import * from GeoffreyApp.models import *
from django.views import generic from django.views import generic
from django.db.models import Q
# Create your views here. # Create your views here.
@ -31,6 +32,16 @@ class PlayerList(generic.ListView):
class ShopList(generic.ListView): class ShopList(generic.ListView):
model = Shop model = Shop
def get_queryset(self):
qs = Shop.objects.all()
search = self.request.GET.get('q')
if search:
qs = qs.filter(Q(name__icontains=search) | Q(owner__name__icontains=search))
return qs
class BaseList(generic.ListView): class BaseList(generic.ListView):
model = Base model = Base