automatic sorting for easy shoppin
This commit is contained in:
13
shop.py
13
shop.py
@@ -162,7 +162,8 @@ def show_shop(shopid):
|
|||||||
shared_to.append(get_username(row[1]))
|
shared_to.append(get_username(row[1]))
|
||||||
return render_template('show_shop.html', entries=entries, shop=shopname,
|
return render_template('show_shop.html', entries=entries, shop=shopname,
|
||||||
shopid=shopid, content=content,shares=shared_to,
|
shopid=shopid, content=content,shares=shared_to,
|
||||||
date=get_shop_date(shopid),date_bkp=get_shop_backup_date(shopid))
|
date=get_shop_date(shopid),date_bkp=get_shop_backup_date(shopid),
|
||||||
|
autosort=session['sort_view'])
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def list_shops():
|
def list_shops():
|
||||||
@@ -419,6 +420,14 @@ def remove_shop():
|
|||||||
flash('successfully deleted shop %s'%(shopname))
|
flash('successfully deleted shop %s'%(shopname))
|
||||||
return redirect(url_for('list_shops'))
|
return redirect(url_for('list_shops'))
|
||||||
|
|
||||||
|
@app.route('/sort_flip',methods=['POST'])
|
||||||
|
def sort_flip():
|
||||||
|
if not session.get('sort_view'):
|
||||||
|
session['sort_view']=True
|
||||||
|
else:
|
||||||
|
session['sort_view']=False
|
||||||
|
shopid=int(request.form['shopid'])
|
||||||
|
return redirect(url_for('show_shop',shopid=shopid))
|
||||||
|
|
||||||
@app.route('/login', methods=['GET', 'POST'])
|
@app.route('/login', methods=['GET', 'POST'])
|
||||||
def login():
|
def login():
|
||||||
@@ -481,8 +490,6 @@ def profile():
|
|||||||
return redirect(url_for('profile'))
|
return redirect(url_for('profile'))
|
||||||
return render_template('profile.html', error=error,user=user)
|
return render_template('profile.html', error=error,user=user)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/logout')
|
@app.route('/logout')
|
||||||
def logout():
|
def logout():
|
||||||
session.pop('logged_in', None)
|
session.pop('logged_in', None)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<p onclick="dropDown('shopAct')" class="dropbtn">☝☔</p>
|
<p onclick="dropDown('shopAct')" class="dropbtn">☝☔</p>
|
||||||
<div id="shopAct" class="dropdown-content">
|
<div id="shopAct" class="dropdown-content">
|
||||||
<a id="h2_add" onclick="hidetoggle('disp_add')" class=pointer>± Add/remove</a>
|
<a id="h2_add" onclick="hidetoggle('disp_add')" class=pointer>± Add/remove</a>
|
||||||
<a id="h2_sort" onclick="sortMarkdown()" class=pointer>↕ Sort view</a>
|
<a id="h2_sort" onclick="sortMarkdown()" class=pointer>↕ Sort once</a>
|
||||||
<a id="h2_edit" onclick="hidetoggle('disp_edit');growTextarea('edit_md');" class=pointer>✎ Edit items</a>
|
<a id="h2_edit" onclick="hidetoggle('disp_edit');growTextarea('edit_md');" class=pointer>✎ Edit items</a>
|
||||||
<a id="h2_share" onclick="hidetoggle('disp_share')" class=pointer>♟ Share shop</a>
|
<a id="h2_share" onclick="hidetoggle('disp_share')" class=pointer>♟ Share shop</a>
|
||||||
<a id="h2_restore" onclick="hidetoggle('disp_restore')" class=pointer>♻ Restore backup</a>
|
<a id="h2_restore" onclick="hidetoggle('disp_restore')" class=pointer>♻ Restore backup</a>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<span class=iconbox> </span>
|
<span class=iconbox> </span>
|
||||||
<span class=iconbox onclick="hidetoggle('disp_add')" title="Add/remove">±</span>
|
<span class=iconbox onclick="hidetoggle('disp_add')" title="Add/remove">±</span>
|
||||||
<span class=iconbox onclick="reload();" title="Reload">↻</span>
|
<span class=iconbox onclick="reload();" title="Reload">↻</span>
|
||||||
<span class=iconbox onclick="sortMarkdown()" title="Sort view">↕</span>
|
<span class=iconbox onclick="sortMarkdown()" title="Sort once">↕</span>
|
||||||
<span class=iconbox onclick="hidetoggle('disp_edit');growTextarea('edit_md');" title="Edit file">✎</span>
|
<span class=iconbox onclick="hidetoggle('disp_edit');growTextarea('edit_md');" title="Edit file">✎</span>
|
||||||
<span class=iconbox onclick="hidetoggle('disp_share')" title="Share">♟</span>
|
<span class=iconbox onclick="hidetoggle('disp_share')" title="Share">♟</span>
|
||||||
<span class=iconbox onclick="hidetoggle('disp_restore')" title="Restore">♻</span>
|
<span class=iconbox onclick="hidetoggle('disp_restore')" title="Restore">♻</span>
|
||||||
@@ -38,6 +38,15 @@
|
|||||||
<dl><input type=hidden name=shopid value="{{ shopid }}"><input class=submit type=submit name=toggleAll value="Invert selection">
|
<dl><input type=hidden name=shopid value="{{ shopid }}"><input class=submit type=submit name=toggleAll value="Invert selection">
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
|
<form action="{{ url_for('sort_flip') }}" method=post class=add-entry>
|
||||||
|
<dl><input type=hidden name=shopid value="{{ shopid }}">
|
||||||
|
{% if autosort %}
|
||||||
|
<input class=submit type=submit name=toggleAll value="Autosort mode: On">
|
||||||
|
{% else %}
|
||||||
|
<input class=submit type=submit name=toggleAll value="Autosort mode: Off">
|
||||||
|
{% endif %}
|
||||||
|
</dl>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<form id="disp_edit" class=hidden name="area_edit" action="{{ url_for('edit_md') }}" method=post class=add-entry>
|
<form id="disp_edit" class=hidden name="area_edit" action="{{ url_for('edit_md') }}" method=post class=add-entry>
|
||||||
<dl>Edit content file:
|
<dl>Edit content file:
|
||||||
@@ -69,5 +78,7 @@
|
|||||||
<dl>Delete shop permanently. Can not be restored.</dl>
|
<dl>Delete shop permanently. Can not be restored.</dl>
|
||||||
<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><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>
|
</dl></form>
|
||||||
|
{% if autosort %}
|
||||||
|
<script language=javascript>sortMarkdown();</script>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user