bootstrap talkgroups and new

This commit is contained in:
KF7EEL 2021-08-07 11:28:36 -07:00
parent 95c71f7c87
commit 38375688f2
5 changed files with 98 additions and 76 deletions

View File

@ -658,19 +658,21 @@ def create_app():
try: try:
l_news = News.query.order_by(News.time.desc()).first() l_news = News.query.order_by(News.time.desc()).first()
content = ''' content = '''
<table style="width: 600px; margin-left: auto; margin-right: auto;" border="1" cellpadding="5">
<tr> <div class="well well-sm" style="text-align: center;"><h3>''' + l_news.subject + '''</h3>
<td style="text-align: center;"> <hr />
<h3>''' + l_news.subject + '''</h3> <p>&nbsp;</p>
</td> <strong>''' + l_news.date + '''</strong> - <a href="/news/''' + str(l_news.id) + '''"><button type="button" class="btn btn-primary">Link</button></a>
</tr> <p>&nbsp;</p>
<tr>
<td style="text-align: center;"><strong>''' + l_news.date + '''</strong></td> <hr />
</tr> <div class="well well-sm" style="max-width:900px; word-wrap:break-word;">
<tr> ''' + l_news.text + '''
<td><br />''' + l_news.text + '''<br /><br /></td> </div>
</tr> </div>
</tbody></table>'''
</div>
'''
except: except:
content = '' content = ''
return render_template('index.html', news = Markup(content)) return render_template('index.html', news = Markup(content))
@ -1679,29 +1681,29 @@ def create_app():
## view_news = News.query.order_by(News.time.desc()).paginate(page=page, per_page=1) ## view_news = News.query.order_by(News.time.desc()).paginate(page=page, per_page=1)
#content = '''<table style="width: 600px; margin-left: auto; margin-right: auto;" border="1"><tbody>''' #content = '''<table style="width: 600px; margin-left: auto; margin-right: auto;" border="1"><tbody>'''
content = ''' <p style="text-align: center;"><a href="news?all_news=true"><strong>View All News</strong></a></p>''' news_content = ''
art_count = 0 art_count = 0
for article in view_news: for article in view_news:
if request.args.get('all_news'): if request.args.get('all_news'):
art_count = 1 art_count = 1
if art_count < 16: if art_count < 16:
content = content + ''' news_content = news_content + '''
<table style="width: 600px; margin-left: auto; margin-right: auto;" border="1" cellpadding="5"> <div class="well well-sm" style="text-align: center;"><h3>''' + article.subject + '''</h3>
<tr> <hr />
<td style="text-align: center;"> <p style="text-align: center;">&nbsp;</p>
<h3>''' + article.subject + '''</h3> <strong>''' + article.date + '''</strong> - <a href="news/''' + str(article.id) + '''"><button type="button" class="btn btn-primary">Link</button></a>
</td> <p style="text-align: center;">&nbsp;</p>
</tr> <hr />
<tr> <div class="well well-sm" style="max-width:900px; word-wrap:break-word;">
<td style="text-align: center;"><strong>''' + article.date + '''</strong> - <a href="news/''' + str(article.id) + '''">Link</a></td> ''' + article.text + '''
</tr> </div>
<tr> </div>
<td>''' + article.text + '''</td>
</tr>
</tbody></table><p>&nbsp;</p>''' '''
art_count = art_count + 1 art_count = art_count + 1
#content = content + '''</tbody></table><p>&nbsp;</p>''' #content = content + '''</tbody></table><p>&nbsp;</p>'''
return render_template('flask_user_layout.html', markup_content = Markup(content)) return render_template('news.html', markup_content = Markup(news_content))
@app.route('/news/<article>') #, methods=['POST', 'GET']) @app.route('/news/<article>') #, methods=['POST', 'GET'])
def view_arts(article): def view_arts(article):
@ -1709,20 +1711,20 @@ def create_app():
view_arti = News.query.filter_by(id=article).first() view_arti = News.query.filter_by(id=article).first()
content = ''' content = '''
<table style="width: 600px; margin-left: auto; margin-right: auto;" border="1" cellpadding="5"> <div class="well well-sm" style="text-align: center;"><h3>''' + view_arti.subject + '''</h3>
<tr> <hr />
<td style="text-align: center;"> <p>&nbsp;</p>
<h3>''' + view_arti.subject + '''</h3> <strong>''' + view_arti.date + '''</strong>
</td> <p>&nbsp;</p>
</tr> <hr />
<tr> <div class="well well-sm" style="max-width:900px; word-wrap:break-word;">
<td style="text-align: center;"><strong>''' + view_arti.date + '''</strong></td> ''' + view_arti.text + '''
</tr> </div>
<tr> </div>
<td>''' + view_arti.text + '''</td>
</tr>
</tbody></table><p>&nbsp;</p>''' '''
return render_template('flask_user_layout.html', markup_content = Markup(content)) return render_template('news.html', markup_content = Markup(content))
@ -1783,7 +1785,7 @@ def create_app():
else: else:
content = ''' content = '''
<p>&nbsp;</p> <p>&nbsp;</p>
<p style="text-align: center;"><a href="add_news"><strong>Add News Article</strong></a></p> <p style="text-align: center;"><a href="add_news"><strong><button type="button" class="btn btn-success">Add News Article</button></strong></a></p>
<p>&nbsp;</p> <p>&nbsp;</p>
<table style="width: 500px; margin-left: auto; margin-right: auto;" border="1"> <table style="width: 500px; margin-left: auto; margin-right: auto;" border="1">
@ -1798,7 +1800,7 @@ def create_app():
content = content + ''' content = content + '''
<tr> <tr>
<td><a href="news/''' + str(a.id) + '''">''' + a.subject + '''</a> | <a href="manage_news?delete=''' + str(a.id )+ '''">Delete</a></td> <td><a href="news/''' + str(a.id) + '''">''' + a.subject + '''</a> | <a href="manage_news?delete=''' + str(a.id )+ '''"><button type="button" class="btn btn-danger">Delete</button></a></td>
<td>''' + a.date + '''</td> <td>''' + a.date + '''</td>
<td>''' + str(a.id) + '''</td> <td>''' + str(a.id) + '''</td>
@ -1991,23 +1993,21 @@ def create_app():
## @login_required ## @login_required
def tg_details(name): def tg_details(name):
tg_d = BridgeList.query.filter_by(bridge_name=name).first() tg_d = BridgeList.query.filter_by(bridge_name=name).first()
content = ''' <table style="width: 500px; margin-left: auto; margin-right: auto;" border="1"> content = '''
<tbody>
<tr> <div class="row">
<td style="text-align: center;"> <div class="well well-sm" style="text-align: center;"><h2>''' + tg_d.bridge_name + '''</h2>
<h2>''' + tg_d.bridge_name + '''</h2> <hr />
</td> TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
</tr> <hr />
<tr> <div class="well well-sm" style="max-width:900px; word-wrap:break-word;">
<td style="text-align: center;">TG #:<strong> ''' + str(tg_d.tg) + '''</strong></td> ''' + tg_d.description + '''
</tr> </div>
<tr> </div>
<td>&nbsp;''' + tg_d.description + '''</td>
</tr> </div>
</tbody> '''
</table> return render_template('tg.html', markup_content = Markup(content))
<p>&nbsp;</p>'''
return render_template('flask_user_layout.html', markup_content = Markup(content))
@app.route('/hbnet_tg.csv') @app.route('/hbnet_tg.csv')
## @login_required ## @login_required
@ -2039,24 +2039,28 @@ def create_app():
<p>&nbsp;</p> <p>&nbsp;</p>
<p style="text-align: center;"><strong>Note:</strong> Talkgroups listed here may not be available on all servers. See <a href="/generate_passphrase">Passphrase(s)</a> for complete list of talkgroup availability per server.</p> <p style="text-align: center;"><strong>Note:</strong> Talkgroups listed here may not be available on all servers. See <a href="/generate_passphrase">Passphrase(s)</a> for complete list of talkgroup availability per server.</p>
<p style="text-align: center;"><a href="hbnet_tg.csv"><strong>Download talkgroup CSV</strong></a> | <a href="hbnet_tg_anytone.csv"><strong>Download talkgroup CSV (Anytone format)</strong></a></p> <p style="text-align: center;"><a href="hbnet_tg.csv"><strong>Download talkgroup CSV</strong></a> | <a href="hbnet_tg_anytone.csv"><strong>Download talkgroup CSV (Anytone format)</strong></a></p>
<table style="width: 600px; margin-left: auto; margin-right: auto;" border="1"> <div class="container">
<tbody> <table class="table table-striped table-bordered">
<tr> <thead>
<td style="width: 146.1px; text-align: center;"><strong>&nbsp;Name</strong></td> <tr>
<td style="width: 89.9px; text-align: center;"><strong>&nbsp;TG</strong></td> <th style="width: 146.1px; text-align: center;">Name</th>
<td style="width: 339px; text-align: center;"><strong>&nbsp;Description</strong></td> <th style="width: 89.9px; text-align: center;">TG</th>
</tr> ''' <th style="width: 339px; text-align: center;">Description</th>
</tr>
</thead>
<tbody> '''
for i in cbl: for i in cbl:
print(str(re.sub('<[^>]*>', '', i.description))[:50]) print(str(re.sub('<[^>]*>', '', i.description))[:50])
content = content + ''' content = content + '''
<tr> <tr>
<td>&nbsp;<a href="/tg/''' + i.bridge_name + '''">''' + i.bridge_name + '''</a></td> <td>&nbsp;<a href="/tg/''' + i.bridge_name + '''"><button type="button" class="btn btn-info">''' + i.bridge_name + '''</button></a></td>
<td style="width: 89.9px;">&nbsp;''' + str(i.tg) + '''</td> <td style="width: 89.9px;">&nbsp;''' + str(i.tg) + '''</td>
<td style="width: 339px;">&nbsp;''' + str(re.sub('<[^>]*>|\s\s+', ' ', i.description))[:50] + '''...</td> <td style="width: 339px;">&nbsp;''' + str(re.sub('<[^>]*>|\s\s+', ' ', i.description))[:50] + '''...</td>
</tr>''' </tr>'''
content = content + ''' content = content + '''
</tbody> </tbody>
</table> </table>
</div>
''' '''
return render_template('flask_user_layout.html', markup_content = Markup(content)) return render_template('flask_user_layout.html', markup_content = Markup(content))

View File

@ -122,7 +122,6 @@
{{markup_content}} {{markup_content}}
{% endblock %} {% endblock %}
{% endblock %} {% endblock %}
</div> </div>

9
web/templates/news.html Normal file
View File

@ -0,0 +1,9 @@
{% extends 'flask_user/_public_base.html' %}
{% block content %}
<p style="text-align: center;"><a href="/news?all_news=true"><strong><button type="button" class="btn btn-primary">View All News</button></strong></a></p>
<div class="row">
<div class="col-lg-12">{{markup_content}}</div>
</div>
<p>&nbsp;</p>
{% endblock %}

9
web/templates/tg.html Normal file
View File

@ -0,0 +1,9 @@
{% extends 'flask_user/_public_base.html' %}
{% block content %}
<p style="text-align: center;"><a href="/talkgroups"><strong><button type="button" class="btn btn-primary">All Talkgroups</button></strong></a></p>
<div class="row">
<div class="col-lg-12">{{markup_content}}</div>
</div>
<p>&nbsp;</p>
{% endblock %}

View File

@ -1,6 +1,7 @@
{% extends 'flask_user/_public_base.html' %} {% extends 'flask_user/_public_base.html' %}
{% block content %} {% block content %}
<p>&nbsp;</p><h4 style="text-align: center;"><a href="/generate_passphrase/pi-star">Click here</a> for automated Pi-Star script.</h4><p>&nbsp;</p> <p>&nbsp;</p>
<div class="well"><h4 style="text-align: center;"><a href="/generate_passphrase/pi-star"><button type="button" class="btn btn-warning">Click here</button></a> for automated Pi-Star script.</h4></div>
<div class="row"> <div class="row">
<div class="col-xs-6">{{server_content}}</div> <div class="col-xs-6">{{server_content}}</div>