From d7a2684972d9d02619cbd5f7075233b4d8c0b5e2 Mon Sep 17 00:00:00 2001 From: Annie Cain Date: Fri, 6 Nov 2015 13:59:55 -0500 Subject: [PATCH] streamlined shelf creation, responsive layout --- django/awesome/models.py | 2 +- .../templates/control-create-shelf.html | 53 --------- .../awesome/templates/control-new-shelf.html | 62 ++++++++++ django/awesome/templates/scan-shelf.html | 34 ++---- django/awesome/templates/shelf.html | 2 +- django/awesome/urls.py | 2 +- django/awesome/views/control.py | 15 ++- django/static/css/shelf.css | 106 +++++++++++++----- django/static/js/scan-shelf.js | 4 +- 9 files changed, 165 insertions(+), 115 deletions(-) delete mode 100644 django/awesome/templates/control-create-shelf.html create mode 100644 django/awesome/templates/control-new-shelf.html diff --git a/django/awesome/models.py b/django/awesome/models.py index 3f48d8c..d5bfcb0 100644 --- a/django/awesome/models.py +++ b/django/awesome/models.py @@ -107,7 +107,7 @@ def __unicode__(self): class Shelf(models.Model): organization = models.ForeignKey(Organization) title = models.CharField(max_length=400) - description = models.TextField(max_length=4000) + description = models.TextField(max_length=4000, null=True, blank=True) slug = models.SlugField() date_created = models.DateTimeField(auto_now=True, null=True) diff --git a/django/awesome/templates/control-create-shelf.html b/django/awesome/templates/control-create-shelf.html deleted file mode 100644 index 28c5d18..0000000 --- a/django/awesome/templates/control-create-shelf.html +++ /dev/null @@ -1,53 +0,0 @@ -{% extends "layouts/base.html" %} -{% load static subdomain_link %} -{% get_static_prefix as STATIC_PREFIX %} - -{% block title %}Controls | Awesome Box at the {{organization.name}}{% endblock title %} - -{% block styles %} - - -{% endblock styles %} - -{% block content %} - -
- {% include "partials/control-header.html" %} -
- -
-
-

Create New Display Shelf

-
-
- {% csrf_token %} -
- {{ form.non_field_errors }} - {% for field in form %} - - {{ field }} - {% if field.errors %}
- {% for error in field.errors %}{{ error }}{% endfor %} - {%elif field.help_text %} - {{ field.help_text }} - {% endif %} - {% endfor %} -
-
- -
-
-
-
-{% endblock content %} - -{% block scripts %} - - - - - - -{% endblock scripts %} \ No newline at end of file diff --git a/django/awesome/templates/control-new-shelf.html b/django/awesome/templates/control-new-shelf.html new file mode 100644 index 0000000..3301f6f --- /dev/null +++ b/django/awesome/templates/control-new-shelf.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + +{% load static isbn_converter placeholder %} +{% get_static_prefix as STATIC_PREFIX %} + +Scan | Awesome Box at the {{organization.name}} + + + + + + + + +
+
+
+

New shelf

+
+
+
+
+
+ {% csrf_token %} + {% if form.errors %} +
    +
  • Please fix the error(s) below.
  • +
+ {% endif %} +

{{ form.title|placeholder:"Title" }}{{ form.title.errors }}

+ +

{{ form.description|placeholder:"Optional description" }}{{ form.description.errors }}

+
+
+
Shelf Details
+

Your shelf's title, link and description

+ + {% if messages %} + {% for message in messages %} +

{% if 'safe' in message.tags %}{{ message|safe }}{% else %}{{ message }}{% endif %}

+ {% endfor %} + {% endif %} +
+
+ +
+ \ No newline at end of file diff --git a/django/awesome/templates/scan-shelf.html b/django/awesome/templates/scan-shelf.html index 3546598..e17f2b6 100644 --- a/django/awesome/templates/scan-shelf.html +++ b/django/awesome/templates/scan-shelf.html @@ -27,7 +27,7 @@ -
+

Build your shelf

@@ -35,32 +35,31 @@

Build your shelf

+
+
Scan New Items Here
+ new blank item +
-

-

-
-
-
Scan New Items Here
- Manually add new item +

-
+
{% csrf_token %} - {% if add_item_form.errors %} + {% if form.errors %}
  • Please fix the error(s) below.
{% endif %} -

{{ form.title }}{{ form.title.errors }}

+

{{ form.title|placeholder:"Title" }}{{ form.title.errors }}

-

{{ form.description }}{{ form.description.errors }}

+

{{ form.description|placeholder:"Optional description" }}{{ form.description.errors }}

{{ formset.management_form }}
-
+
Shelf Details

Your shelf's title, link and description

@@ -137,17 +136,6 @@
Shelf Details
{% verbatim %} -