From 2ff2b6e9f0c177fff1cc0c0bb6d034524f2be479 Mon Sep 17 00:00:00 2001 From: Alice Date: Tue, 5 Jun 2018 12:22:09 +0200 Subject: [PATCH] added delete stack --- app/static/css/style.css | 6 +++--- app/templates/about.html | 9 ++++++++- app/templates/add_stack.html | 4 ++-- app/templates/show_stack_detail.html | 5 ++++- app/templates/show_stacks.html | 8 +++++--- app/views.py | 10 ++++++++-- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/app/static/css/style.css b/app/static/css/style.css index e91c4a7..36c021f 100755 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -183,12 +183,12 @@ font-family:'Courier New'; font-size: 12px; } -.ui-tabs-vertical { width: 55em; } +.ui-tabs-vertical { width: 100em; border-top: 0;} .ui-tabs-vertical .ui-tabs-nav { padding: .2em .2em .2em .2em; float: left; width: 12em; } .ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 0 !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; } .ui-tabs-vertical .ui-tabs-nav li a { display:block; } -.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 0; background-color: #EEC2C2} -.ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: left; width: 40em; font-size: 12px;} +.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 0; background-color: #A9A9A9} +.ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: left; width: 50em; font-size: 12px;} #draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; } #droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; } diff --git a/app/templates/about.html b/app/templates/about.html index 657081d..802a4dc 100755 --- a/app/templates/about.html +++ b/app/templates/about.html @@ -2,5 +2,12 @@ {% block main %}

About

-

This an interface to the XPUB Library.

+

+XPPL is a project aimed at people who are studying the field of media culture, or as we like to call them: knowledge comrades. +
+This digital library gathers all the books and articles floating around on PZI shelves and our hard drives and memory sticks, so that they can be shared. +
+ Its web interface hosts a curated catalogue of books and articles, and its distributed architecture provides instances for uploading and downloading. +
+ It starts at XPUB, but can go anywhere we want it to.

{% endblock %} diff --git a/app/templates/add_stack.html b/app/templates/add_stack.html index 9638f91..0fe1e5f 100644 --- a/app/templates/add_stack.html +++ b/app/templates/add_stack.html @@ -3,7 +3,7 @@ {% block main %}
- + {% endwith %}
{{form.hidden_tag()}} diff --git a/app/templates/show_stack_detail.html b/app/templates/show_stack_detail.html index 1fc8779..01551de 100644 --- a/app/templates/show_stack_detail.html +++ b/app/templates/show_stack_detail.html @@ -6,7 +6,7 @@

{{ stack.stack_name }}

-

Stack description: {{ stack.stack_description }}

+

{{ stack.stack_description }}

Books in this stack: {% for book in stack.books %}

  • {{book.title}}
  • @@ -16,6 +16,9 @@

    +

    + Delete

    +

    Go back to stacks

    diff --git a/app/templates/show_stacks.html b/app/templates/show_stacks.html index 898fa10..27fd207 100644 --- a/app/templates/show_stacks.html +++ b/app/templates/show_stacks.html @@ -21,10 +21,12 @@

    -

    Build a stack

    -

    Add Stack

    +

    Add Stack

    + + + {% endblock %} diff --git a/app/views.py b/app/views.py index 39ea8e6..3ff00d6 100755 --- a/app/views.py +++ b/app/views.py @@ -268,7 +268,7 @@ def add_stack(): form = StackForm() stacks = db.session.query(Stack).all() - if request.method == 'POST': + if form.validate_on_submit(): stack_name = form.stack_name.data stack_description = form.stack_description.data stack = Stack(stack_name, stack_description) @@ -276,7 +276,7 @@ def add_stack(): stack = Stack(stack_name, stack_description) db.session.add(stack) stacks = db.session.query(Stack).all() - + return redirect(url_for('show_stacks')) flash("%s stack created" % (stack_name)) return render_template('add_stack.html', stacks=stacks, form=form) @@ -297,6 +297,12 @@ def show_stack_by_id(id, is_tab=False): else: return render_template('show_stack_detail_tab.html', stack=stack) +@app.route('/stacks//delete', methods=['POST', 'GET']) +def remove_stack_by_id(id): + Stack.query.filter_by(id=id).delete() + db.session.commit() + return redirect(url_for('show_stacks')) + ## search ## search