Commit ea2e8205 authored by OzzieIsaacs's avatar OzzieIsaacs

Added code for rearranging shelfs #73

parent 490f8ef5
document.ontouchmove = function(e){
return true;
};
Sortable.create(sortTrue, { Sortable.create(sortTrue, {
group: "sorting", group: "sorting",
sort: true sort: true
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<script src="{{ url_for('static', filename='js/context.js') }}"></script> <script src="{{ url_for('static', filename='js/context.js') }}"></script>
<script src="{{ url_for('static', filename='js/plugins.js') }}"></script> <script src="{{ url_for('static', filename='js/plugins.js') }}"></script>
<script src="{{ url_for('static', filename='js/main.js') }}"></script> <script src="{{ url_for('static', filename='js/main.js') }}"></script>
<script src="{{ url_for('static', filename='js/Sortable.min.js') }}"></script>
{% block header %}{% endblock %} {% block header %}{% endblock %}
</head> </head>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{% if g.user.is_authenticated %} {% if g.user.is_authenticated %}
<a href="{{ url_for('delete_shelf', shelf_id=shelf.id) }}" class="btn btn-danger">{{ _('Delete this Shelf') }} </a> <a href="{{ url_for('delete_shelf', shelf_id=shelf.id) }}" class="btn btn-danger">{{ _('Delete this Shelf') }} </a>
<a href="{{ url_for('edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf name') }} </a> <a href="{{ url_for('edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf name') }} </a>
<a href="{{ url_for('order_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('change order') }} </a> <a href="{{ url_for('order_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Change order') }} </a>
{% endif %} {% endif %}
<div class="row"> <div class="row">
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
{% block body %} {% block body %}
<div class="col-sm-6 col-lg-6 col-xs-6"> <div class="col-sm-6 col-lg-6 col-xs-6">
<h2>{{title}}</h2> <h2>{{title}}</h2>
<div>{{_('Drag \'n drop to rearrange order')}}</div>
<div id="sortTrue" class="list-group"> <div id="sortTrue" class="list-group">
{% for entry in entries %} {% for entry in entries %}
<div id="{{entry.id}}" class="list-group-item">{{entry.title}}</div> <div id="{{entry.id}}" class="list-group-item">{{entry.title}}</div>
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
{% endblock %} {% endblock %}
{% block js %} {% block js %}
<script src="{{ url_for('static', filename='js/Sortable.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/shelforder.js') }}"></script> <script src="{{ url_for('static', filename='js/shelforder.js') }}"></script>
{% endblock %} {% endblock %}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -1375,7 +1375,7 @@ def order_shelf(shelf_id): ...@@ -1375,7 +1375,7 @@ def order_shelf(shelf_id):
for book in books_in_shelf2: for book in books_in_shelf2:
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first() cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first()
result.append(cur_book) result.append(cur_book)
return render_template('order_shelf.html', entries=result, title=_(u"Change order of Shelf: '%(name)s'", name=shelf.name), shelf=shelf) return render_template('shelf_order.html', entries=result, title=_(u"Change order of Shelf: '%(name)s'", name=shelf.name), shelf=shelf)
@app.route("/me", methods=["GET", "POST"]) @app.route("/me", methods=["GET", "POST"])
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment