kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Basic tag browse buttons
rodzic
016937d5de
commit
b6e9bb12fb
|
@ -79,15 +79,23 @@ def _jinja2_filter_datetimestamp(timestamp, format="%Y-%m-%d %H:%M:%S"):
|
|||
def main_page():
|
||||
global messages
|
||||
|
||||
limit_tag = request.args.get('tag')
|
||||
|
||||
# Sort by last_changed and add the uuid which is usually the key..
|
||||
sorted_watches=[]
|
||||
sorted_watches = []
|
||||
for uuid, watch in datastore.data['watching'].items():
|
||||
watch['uuid']=uuid
|
||||
sorted_watches.append(watch)
|
||||
if limit_tag != None:
|
||||
if watch['tag'] == limit_tag:
|
||||
watch['uuid'] = uuid
|
||||
sorted_watches.append(watch)
|
||||
else:
|
||||
watch['uuid'] = uuid
|
||||
sorted_watches.append(watch)
|
||||
|
||||
sorted_watches.sort(key=lambda x: x['last_changed'], reverse=True)
|
||||
|
||||
output = render_template("watch-overview.html", watches=sorted_watches, messages=messages)
|
||||
existing_tags = datastore.get_all_tags()
|
||||
output = render_template("watch-overview.html", watches=sorted_watches, messages=messages, tags=existing_tags)
|
||||
|
||||
# Show messages but once.
|
||||
messages = []
|
||||
|
|
|
@ -138,6 +138,13 @@ body:after, body:before {
|
|||
/* this is a green */
|
||||
}
|
||||
|
||||
.button-tag {
|
||||
background: rgb(99, 99, 99);
|
||||
/* this is a green */
|
||||
color: #fff;
|
||||
font-size: 65%;
|
||||
}
|
||||
|
||||
.button-error {
|
||||
background: rgb(202, 60, 60);
|
||||
/* this is a maroon */
|
||||
|
|
|
@ -52,8 +52,15 @@ class ChangeDetectionStore:
|
|||
self.data['watching'][uuid].update({val: var})
|
||||
self.sync_to_json()
|
||||
|
||||
def get_all_tags(self):
|
||||
tags=[]
|
||||
for uuid, watch in self.data['watching'].items():
|
||||
if not watch['tag'] in tags:
|
||||
tags.append(watch['tag'])
|
||||
|
||||
|
||||
return tags
|
||||
|
||||
def delete(self, uuid):
|
||||
# Probably their should be dict...
|
||||
del(self.data['watching'][uuid])
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="box">
|
||||
|
||||
<form class="pure-form" action="/api/add" method="POST">
|
||||
|
@ -13,7 +14,15 @@
|
|||
<!-- add extra stuff, like do a http POST and send headers -->
|
||||
<!-- user/pass r = requests.get('https://api.github.com/user', auth=('user', 'pass')) -->
|
||||
</form>
|
||||
|
||||
<div>
|
||||
{% for tag in tags %}
|
||||
{% if tag == "" %}
|
||||
<a href="/" class="pure-button button-tag ">All</a>
|
||||
{% else %}
|
||||
<a href="/?tag={{ tag}}" class="pure-button button-tag ">{{ tag }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div id="watch-table-wrapper">
|
||||
<table class="pure-table pure-table-striped watch-table">
|
||||
|
|
Ładowanie…
Reference in New Issue