fixed bugs

This commit is contained in:
q
2016-07-05 12:51:17 +03:00
parent 9813cf6263
commit ba05dd9c74
3 changed files with 21 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ SECRET_KEY = 'development key'
USERNAME = 'admin'
PASSWORD = 'default'
URLFINDER = re.compile("((news|telnet|nttp|file|http|ftp|https)://[^ ]+)")
URLPARSER = re.compile(r'(\[)([^\]]+)(\])\(([^\)]+)\)')
# create our little application :)
app = Flask(__name__)
@@ -87,6 +88,8 @@ def scan_for_new_documents(id):
g.db.commit()
def urlify(s):
if URLPARSER.search(s):
return URLPARSER.sub(r'[<a href="\4" target="_blank">\2</a>]',s)
return URLFINDER.sub(r'<a href="\1" target="_blank">\1</a>', s)
@app.before_request
@@ -129,7 +132,10 @@ def show_shop(shopid):
continue
icon=" "
extra_class="noitem"
if "[ ]" in row or "[x]" in row:
if "[ ]" in row:
icon=u" "
extra_class=""
if "[x]" in row:
icon=u"\u2714"
extra_class=""
row=urlify(row).encode('ascii', 'xmlcharrefreplace')

View File

@@ -9,7 +9,7 @@ td { height: 1.75em; }
.tickbox { margin-right: 0.5em; }
.noitem { background-color: transparent; border-color:transparent; }
.page { border: 5px solid #ccc; padding: 0.5em;
background: white; overflow:hidden; min-height:16em;}
background: white; overflow:auto; min-height:16em;}
.entries { margin-top: 1em; margin-bottom: 1em; }
.entries input { margin-top: 0.125em; margin-bottom: 0.125em; }
.entries li { margin: 0.8em 1.2em; }
@@ -24,6 +24,11 @@ td { height: 1.75em; }
.hidden { display: none; }
.pointer { cursor: pointer; text-decoration: underline; }
.hspacer { width: 1em; display: inline-block;}
.notify { -webkit-animation: notifier 500ms alternate infinite;
-moz-animation: notifier 500ms alternate infinite;
-o-animation: notifier 500ms alternate infinite;
animation: notifier 500ms alternate infinite; }
#date { font-size: 0.75em; margin-top: 1.2em; }
/* dropdown */
@@ -69,3 +74,7 @@ td { height: 1.75em; }
/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
.show {display:block;}
@keyframes notifier {
0% { box-shadow: 0px 0px 4px 4px #fff; }
100% { box-shadow: 0px 0px 4px 4px #cee5F5; }
}

View File

@@ -26,7 +26,7 @@
<form id="disp_edit" class=hidden name="area_edit" action="{{ url_for('edit_md') }}" method=post class=add-entry>
<dl>Edit content file:
<dt><textarea cols=40 rows=5 id=edit_md name=edit_md onkeyup="growTextarea('edit_md')">{{ content }}</textarea><br>
<input type=hidden name=shopid value={{ shopid }}><input class=submit type=submit value=Save onclick="return confirm('Do you really want to replace content?');" >
<input type=hidden name=shopid value={{ shopid }}><input class="submit notify" type=submit value=Save onclick="return confirm('Do you really want to replace content?');" >
</dl>
</form>
<div class=hidden id=disp_share>
@@ -41,17 +41,17 @@
</form>
<form name="area_share" action="{{ url_for('add_share') }}" method=post class=add-entry>
<dl>
<dt><input class=submit type=text length=10 name=share><input type=hidden name=shopid value={{ shopid }}><input class=submit type=submit value=Share>
<dt><input class=submit type=text length=10 name=share><input type=hidden name=shopid value={{ shopid }}><input class="submit notify" type=submit value=Share>
</dl>
</form>
</div>
<form id="disp_restore" class=hidden action="{{ url_for('restore_md') }}" method=post class=add-entry>
<dl>Shop state is backed up with "Edit items" and "Remove ticked" actions.</dl>
<dl><input type=hidden name=shopid value={{ shopid }}><input class=submit type=submit value=Restore onclick="return confirm('Do you really want to restore previous version?');">
<dl><input type=hidden name=shopid value={{ shopid }}><input class="submit notify" type=submit value=Restore onclick="return confirm('Do you really want to restore previous version?');">
</dl></form>
<form id="disp_delete" class=hidden action="{{ url_for('remove_shop') }}" method=post class=add-entry>
<dl>Delete shop permanently. Can not be restored.</dl>
<dl><input type=hidden name=shopid value={{ shopid }}><input class=submit type=submit value=Delete onclick="return confirm('Do you really want to remove shop {{ shop }}?');">
<dl><input type=hidden name=shopid value={{ shopid }}><input class="submit notify" type=submit value=Delete onclick="return confirm('Do you really want to remove shop {{ shop }}?');">
</dl></form>
{% endblock %}