From 54cc93a813db813a89169f96fe1a1e4ab16c96d6 Mon Sep 17 00:00:00 2001 From: Alec Perkins Date: Fri, 7 Sep 2012 16:09:28 -0400 Subject: [PATCH] Rework nav to use Bootstrap's Navbar. --- .../static/djangorestframework/css/style.css | 3 + .../templates/djangorestframework/base.html | 244 +++++++++--------- 2 files changed, 130 insertions(+), 117 deletions(-) diff --git a/djangorestframework/static/djangorestframework/css/style.css b/djangorestframework/static/djangorestframework/css/style.css index e69de29bb..3d2f86e4d 100644 --- a/djangorestframework/static/djangorestframework/css/style.css +++ b/djangorestframework/static/djangorestframework/css/style.css @@ -0,0 +1,3 @@ +body { + padding-top: 1em; +} \ No newline at end of file diff --git a/djangorestframework/templates/djangorestframework/base.html b/djangorestframework/templates/djangorestframework/base.html index 2e1b7fff1..026a20dee 100644 --- a/djangorestframework/templates/djangorestframework/base.html +++ b/djangorestframework/templates/djangorestframework/base.html @@ -20,139 +20,149 @@ - -
+ - + - + {% block nav-global %}{% endblock %} - -
- {% if 'OPTIONS' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %} -
- {% csrf_token %} - - -
- {% endif %} + -
-

{{ name }}

-

{{ description }}

-
-
HTTP {{ response.status_code }} {{ response.status_text }}{% autoescape off %}
+    
+    
+ + {% if 'OPTIONS' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %} +
+ {% csrf_token %} + + +
+ {% endif %} + +
+

{{ name }}

+

{{ description }}

+
+
HTTP {{ response.status_code }} {{ response.status_text }}{% autoescape off %}
 {% for key, val in response.items %}{{ key }}: {{ val|urlize_quoted_links }}
 {% endfor %}
 {{ content|urlize_quoted_links }}
{% endautoescape %}
- {% if 'GET' in allowed_methods %} -
-
-

GET {{ name }}

-
- GET - {% for format in available_formats %} - {% with FORMAT_PARAM|add:"="|add:format as param %} - [{{ format }}] - {% endwith %} - {% endfor %} -
-
-
- {% endif %} + {% if 'GET' in allowed_methods %} +
+
+

GET {{ name }}

+
+ GET + {% for format in available_formats %} + {% with FORMAT_PARAM|add:"="|add:format as param %} + [{{ format }}] + {% endwith %} + {% endfor %} +
+
+
+ {% endif %} - {% comment %} - DROP POST/PUT/DELETE until the forms are working with REST framework 2 + {% comment %} + DROP POST/PUT/DELETE until the forms are working with REST framework 2 - {# Only display the POST/PUT/DELETE forms if method tunneling via POST forms is enabled and the user has permissions on this view. #} - {% if response.status_code != 403 %} + {# Only display the POST/PUT/DELETE forms if method tunneling via POST forms is enabled and the user has permissions on this view. #} + {% if response.status_code != 403 %} - {% if 'POST' in allowed_methods %} -
-
-

POST {{ name }}

- {% csrf_token %} - {{ post_form.non_field_errors }} - {% for field in post_form %} -
- {{ field.label_tag }} - {{ field }} - {{ field.help_text }} - {{ field.errors }} -
- {% endfor %} -
- -
-
-
- {% endif %} + {% if 'POST' in allowed_methods %} +
+
+

POST {{ name }}

+ {% csrf_token %} + {{ post_form.non_field_errors }} + {% for field in post_form %} +
+ {{ field.label_tag }} + {{ field }} + {{ field.help_text }} + {{ field.errors }} +
+ {% endfor %} +
+ +
+
+
+ {% endif %} - {% if 'PUT' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %} -
-
-

PUT {{ name }}

- - {% csrf_token %} - {{ put_form.non_field_errors }} - {% for field in put_form %} -
- {{ field.label_tag }} - {{ field }} - {{ field.help_text }} - {{ field.errors }} -
- {% endfor %} -
- -
-
-
- {% endif %} + {% if 'PUT' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %} +
+
+

PUT {{ name }}

+ + {% csrf_token %} + {{ put_form.non_field_errors }} + {% for field in put_form %} +
+ {{ field.label_tag }} + {{ field }} + {{ field.help_text }} + {{ field.errors }} +
+ {% endfor %} +
+ +
+
+
+ {% endif %} - {% if 'DELETE' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %} -
-
-

DELETE {{ name }}

- {% csrf_token %} - -
- -
-
-
- {% endif %} + {% if 'DELETE' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %} +
+
+

DELETE {{ name }}

+ {% csrf_token %} + +
+ +
+
+
+ {% endif %} - {% endif %} - {% endcomment %} -
- + {% endif %} + {% endcomment %} +
+ -
- +
+ {% block footer %}{% endblock %}