Properly theme and design the Drilldown page
This commit is contained in:
parent
d0ecc92169
commit
7c02e8fe89
|
@ -47,7 +47,6 @@ p {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
letter-spacing: -0.154px;
|
letter-spacing: -0.154px;
|
||||||
color: #242d60;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
|
@ -123,3 +122,11 @@ h5 {
|
||||||
align-items: left;
|
align-items: left;
|
||||||
justify-content: left;
|
justify-content: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
color: #dddddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-bar {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<script src="https://js.stripe.com/v3/"></script>
|
<script src="https://js.stripe.com/v3/"></script>
|
||||||
</head>
|
</head>
|
||||||
<div class="product-container">
|
<div class="product-container">
|
||||||
<a href="order?product=drilldown">
|
<a href="order?product=drilldown">
|
||||||
<div class="product">
|
<div class="product">
|
||||||
<img src="{{ url_for('static', filename='weekly.jpg') }}" alt="Data image"/>
|
<img src="{% static 'logo.weekly.jpg' %}" alt="Data image"/>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<h3>Drilldown</h3>
|
<h3>Drilldown</h3>
|
||||||
<h5>200.00</h5>
|
<h5>200.00</h5>
|
||||||
|
@ -13,7 +15,7 @@
|
||||||
</a>
|
</a>
|
||||||
<a href="order?product=sentiment">
|
<a href="order?product=sentiment">
|
||||||
<div class="product">
|
<div class="product">
|
||||||
<img src="{{ url_for('static', filename='weekly.jpg') }}" alt="Data image"/>
|
<img src="{% static 'logo.weekly.jpg' %}" alt="Data image"/>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<h3>Sentiment</h3>
|
<h3>Sentiment</h3>
|
||||||
<h5>45.00</h5>
|
<h5>45.00</h5>
|
||||||
|
|
|
@ -3,12 +3,5 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1 class="title">Access denied</h1>
|
<h1 class="title">Access denied</h1>
|
||||||
<h2 class="subtitle">Sorry, you do not have the necessary permissions to view this page.</h2>
|
<h2 class="subtitle">Sorry, you do not have the necessary permissions to view this page.</h2>
|
||||||
<div class="col">
|
|
||||||
{% if user.subscription_active %}
|
|
||||||
{% include 'checkout.html' %}
|
|
||||||
{% else %}
|
|
||||||
<h2> Please setup a payment mandate in the profile page to view products </h2>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -4,30 +4,56 @@
|
||||||
<h1 class="title">Welcome to search, {{ user.first_name }}!</h1>
|
<h1 class="title">Welcome to search, {{ user.first_name }}!</h1>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row vertical-offset-100">
|
<div class="row">
|
||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="col-lg-4">
|
||||||
<div class="panel panel-default">
|
<form method="POST">
|
||||||
<div class="panel-heading">
|
{% csrf_token %}
|
||||||
{% if query is not None %}
|
<div class="input-group search-bar">
|
||||||
<h3 class="panel-title">Searching for {{ query }}</h3>
|
<input name="query" type="text" class="form-control" placeholder="Search" id="txtSearch"/>
|
||||||
{% else %}
|
<div class="input-group-btn">
|
||||||
<h3 class="panel-title">Search our database</h3>
|
<button class="btn btn-primary" type="submit">
|
||||||
{% endif %}
|
<span class="glyphicon glyphicon-search"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
</form>
|
||||||
{% if query is None %}
|
</div>
|
||||||
<form method="POST">
|
</div>
|
||||||
<fieldset>
|
{% if results is not None %}
|
||||||
{% csrf_token %}
|
<div class="row">
|
||||||
<input class="textinput textInput form-control" type="text" name="query">
|
<div class="col-lg-12">
|
||||||
<input class="btn btn-lg btn-dark btn-block" type="submit" value="Search">
|
<div class="panel panel-default">
|
||||||
</fieldset>
|
<div class="panel-heading">Results</div>
|
||||||
</form>
|
<div class="panel-body">
|
||||||
{% endif %}
|
<p>Searching for {{ query }}</p>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered table-light">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>TS</th>
|
||||||
|
<th>msg</th>
|
||||||
|
<th>host</th>
|
||||||
|
<th>nick</th>
|
||||||
|
<th>channel</th>
|
||||||
|
<th>net</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
{% for item in results %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ item.ts }}</td>
|
||||||
|
<td>{{ item.msg }}</td>
|
||||||
|
<td>{{ item.host }}</td>
|
||||||
|
<td>{{ item.nick }}</td>
|
||||||
|
<td>{{ item.channel }}</td>
|
||||||
|
<td>{{ item.net }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -9,20 +9,29 @@ client = initialise_opensearch()
|
||||||
|
|
||||||
class Drilldown(LoginRequiredMixin, View):
|
class Drilldown(LoginRequiredMixin, View):
|
||||||
template_name = "ui/drilldown.html"
|
template_name = "ui/drilldown.html"
|
||||||
|
plan_name = "drilldown"
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
if not request.user.has_plan("drilldown"):
|
if not request.user.has_plan(self.plan_name):
|
||||||
return render(request, "denied.html")
|
return render(request, "denied.html")
|
||||||
return render(request, self.template_name)
|
return render(request, self.template_name)
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
if not request.user.has_plan("drilldown"):
|
print("POST")
|
||||||
|
if not request.user.has_plan(self.plan_name):
|
||||||
return render(request, "denied.html")
|
return render(request, "denied.html")
|
||||||
if "query" in request.POST:
|
if "query" in request.POST:
|
||||||
query = request.POST["query"]
|
query = request.POST["query"]
|
||||||
results = run_main_query(client, query)
|
results = run_main_query(client, query)
|
||||||
print("RESULTS", results)
|
results_parsed = []
|
||||||
context = {"query": query}
|
if "hits" in results.keys():
|
||||||
|
print("hits in results")
|
||||||
|
if "hits" in results["hits"]:
|
||||||
|
print("hits in hits")
|
||||||
|
for item in results["hits"]["hits"]:
|
||||||
|
print("ITER", item)
|
||||||
|
results_parsed.append(item["_source"])
|
||||||
|
context = {"query": query, "results": results_parsed}
|
||||||
print("CONTEXT", context)
|
print("CONTEXT", context)
|
||||||
return render(request, self.template_name, context)
|
return render(request, self.template_name, context)
|
||||||
return render(request, self.template_name)
|
return render(request, self.template_name)
|
||||||
|
|
Loading…
Reference in New Issue