Added basic space selector, need to integrate it into the page
This commit is contained in:
parent
a1f97a09fb
commit
23c3aa97dd
@ -1,6 +1,7 @@
|
|||||||
from flask import Blueprint, render_template
|
from flask import Blueprint, render_template
|
||||||
from flask_login import login_required, current_user
|
from flask_login import login_required, current_user
|
||||||
from .models import Quote
|
from .models import Quote
|
||||||
|
from .chatbot import chat as bot
|
||||||
|
|
||||||
main = Blueprint('main', __name__)
|
main = Blueprint('main', __name__)
|
||||||
|
|
||||||
@ -24,5 +25,13 @@ def profile():
|
|||||||
@main.route('/quotes')
|
@main.route('/quotes')
|
||||||
@login_required
|
@login_required
|
||||||
def quotes():
|
def quotes():
|
||||||
quotes = [q.quote for q in Quote.query.all()]
|
spaces = bot.spaces().list().execute()['spaces']
|
||||||
return render_template("quotes.html", quotes=quotes)
|
space_list = list()
|
||||||
|
for space in spaces:
|
||||||
|
if space.get('singleUserBotDm'):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
space_list.append([space['name'].split('/')[1], space['displayName']])
|
||||||
|
|
||||||
|
quotes = [[q.quote, q.id] for q in Quote.query.all()]
|
||||||
|
return render_template("quotes.html", quotes=quotes, space_list=space_list)
|
||||||
@ -75,6 +75,6 @@ $box-background-color: $nexi-grey;
|
|||||||
$input-background-color: $nexi-darker-grey;
|
$input-background-color: $nexi-darker-grey;
|
||||||
$input-color: $nexi-black;
|
$input-color: $nexi-black;
|
||||||
|
|
||||||
$table-background-color: $nexi-black;
|
// $table-background-color: $primary;
|
||||||
$table-striped-row-even-background-color: $nexi-lighter-black;
|
// $table-striped-row-even-background-color: $nexi-lighter-black;
|
||||||
$table-color: $nexi-white;
|
// $table-color: $nexi-white;
|
||||||
@ -3137,8 +3137,8 @@ div.icon-text {
|
|||||||
background-position: -200% 0; } }
|
background-position: -200% 0; } }
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
background-color: #181818;
|
background-color: white;
|
||||||
color: #f8fafb; }
|
color: #363636; }
|
||||||
.table td,
|
.table td,
|
||||||
.table th {
|
.table th {
|
||||||
border: 1px solid #D2D2D2;
|
border: 1px solid #D2D2D2;
|
||||||
@ -3330,7 +3330,7 @@ div.icon-text {
|
|||||||
.table.is-narrow th {
|
.table.is-narrow th {
|
||||||
padding: 0.25em 0.5em; }
|
padding: 0.25em 0.5em; }
|
||||||
.table.is-striped tbody tr:not(.is-selected):nth-child(even) {
|
.table.is-striped tbody tr:not(.is-selected):nth-child(even) {
|
||||||
background-color: #353535; }
|
background-color: #fafafa; }
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
|
|||||||
@ -36,6 +36,16 @@
|
|||||||
<a href="{{ url_for('auth.logout') }}" class="navbar-item">
|
<a href="{{ url_for('auth.logout') }}" class="navbar-item">
|
||||||
Logout
|
Logout
|
||||||
</a>
|
</a>
|
||||||
|
{% if space_list is defined %}
|
||||||
|
<div class="select is-primary" >
|
||||||
|
<select name="space" id="space">
|
||||||
|
|
||||||
|
{% for i in space_list %}
|
||||||
|
<option value="{{ i[0] }}">{{ i[1] }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<script>
|
||||||
|
function sendquote(id) {
|
||||||
|
let space="AAAAi8Ave9c";
|
||||||
|
alert("{{ url_for('chatbot.send_quote', space='AAAAi8Ave9c', _external=True) }}");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<div >
|
<div >
|
||||||
<h3 class="title">Quotes</h3>
|
<h3 class="title">Quotes</h3>
|
||||||
<div >
|
<div >
|
||||||
@ -11,21 +17,18 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
<table class="table is-striped">
|
<table class="table">
|
||||||
{% for quote in quotes %}
|
{% for quote in quotes %}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: left">
|
<td class=" is-primary" style="text-align: left">
|
||||||
{{ quote }}
|
{{ quote[0] }}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="is-primary"><button class="is-primary button" onclick='sendquote({{ quote[1] }})' type="submit">Send</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<!-- <ul>
|
|
||||||
{% for quote in quotes %}
|
|
||||||
<li style="text-align: left">{{ quote }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user