From 1e2bd1294e6a9ec877f624922b49368a18c228d0 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 22 Aug 2014 09:53:03 +0200 Subject: [PATCH 1/4] Fixed the issue with the non-draggable horizontal scrollbar --- .../rest_framework/css/bootstrap-tweaks.css | 119 ++--- .../static/rest_framework/css/default.css | 40 +- .../templates/rest_framework/base.html | 474 ++++++++++-------- 3 files changed, 343 insertions(+), 290 deletions(-) diff --git a/rest_framework/static/rest_framework/css/bootstrap-tweaks.css b/rest_framework/static/rest_framework/css/bootstrap-tweaks.css index 6bfb778cc..e5cc65ab7 100644 --- a/rest_framework/static/rest_framework/css/bootstrap-tweaks.css +++ b/rest_framework/static/rest_framework/css/bootstrap-tweaks.css @@ -6,30 +6,30 @@ a single block in the template. */ - .form-actions { - background: transparent; - border-top-color: transparent; - padding-top: 0; + background: transparent; + border-top-color: transparent; + padding-top: 0; } .navbar-inverse .brand a { - color: #999; + color: #999999; } .navbar-inverse .brand:hover a { - color: white; - text-decoration: none; + color: white; + text-decoration: none; } /* custom navigation styles */ -.wrapper .navbar{ +.navbar { width: 100%; - position: absolute; + position: fixed; left: 0; top: 0; + z-index: 3; } -.navbar .navbar-inner{ +.navbar .navbar-inner { background: #2C2C2C; color: white; border: none; @@ -37,7 +37,7 @@ a single block in the template. border-radius: 0px; } -.navbar .navbar-inner .nav li, .navbar .navbar-inner .nav li a, .navbar .navbar-inner .brand:hover{ +.navbar .navbar-inner .nav li, .navbar .navbar-inner .nav li a, .navbar .navbar-inner .brand:hover { color: white; } @@ -45,17 +45,18 @@ a single block in the template. background: #2c2c2c; } -.navbar .navbar-inner .dropdown-menu li a, .navbar .navbar-inner .dropdown-menu li{ - color: #A30000; +.navbar .navbar-inner .dropdown-menu li a, .navbar .navbar-inner .dropdown-menu li { + color: #A30000; } -.navbar .navbar-inner .dropdown-menu li a:hover{ + +.navbar .navbar-inner .dropdown-menu li a:hover { background: #eeeeee; color: #c20000; } /*=== dabapps bootstrap styles ====*/ -html{ +html { width:100%; background: none; } @@ -65,121 +66,127 @@ body, .navbar .navbar-inner .container-fluid { margin: 0 auto; } -body{ +body { background: url("../img/grid.png") repeat-x; background-attachment: fixed; } -#content{ - margin: 0; +#content { + margin: 0; + padding-bottom: 60px; } /* sticky footer and footer */ html, body { height: 100%; } + .wrapper { + position: relative; + top: 0; + left: 0; + padding-top: 60px; + margin: -60px 0; min-height: 100%; - height: auto !important; - height: 100%; - margin: 0 auto -60px; } .form-switcher { - margin-bottom: 0; + margin-bottom: 0; } .well { - -webkit-box-shadow: none; - -moz-box-shadow: none; - box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; } .well .form-actions { - padding-bottom: 0; - margin-bottom: 0; + padding-bottom: 0; + margin-bottom: 0; } .well form { - margin-bottom: 0; + margin-bottom: 0; } .well form .help-block { - color: #999; + color: #999999; } .nav-tabs { - border: 0; + border: 0; } .nav-tabs > li { - float: right; + float: right; } .nav-tabs li a { - margin-right: 0; + margin-right: 0; } .nav-tabs > .active > a { - background: #f5f5f5; + background: #F5F5F5; } .nav-tabs > .active > a:hover { - background: #f5f5f5; + background: #F5F5F5; } -.tabbable.first-tab-active .tab-content -{ - border-top-right-radius: 0; +.tabbable.first-tab-active .tab-content { + border-top-right-radius: 0; } -#footer, #push { - height: 60px; /* .push must be the same height as .footer */ +footer { + position: absolute; + bottom: 0; + left: 0; + clear: both; + z-index: 10; + height: 60px; + width: 95%; + margin: 0 2.5%; } -#footer{ - text-align: right; -} - -#footer p { +footer p { text-align: center; color: gray; border-top: 1px solid #DDD; padding-top: 10px; } -#footer a { - color: gray; +footer a { + color: gray !important; font-weight: bold; } -#footer a:hover { +footer a:hover { color: gray; } .page-header { - border-bottom: none; - padding-bottom: 0px; - margin-bottom: 20px; + border-bottom: none; + padding-bottom: 0px; + margin-bottom: 20px; } /* custom general page styles */ -.hero-unit h2, .hero-unit h1{ +.hero-unit h1, .hero-unit h2 { color: #A30000; } -body a, body a{ +body a { color: #A30000; } -body a:hover{ +body a:hover { color: #c20000; } -#content a span{ - text-decoration: underline; +#content a span { + text-decoration: underline; } .request-info { - clear:both; + clear:both; } diff --git a/rest_framework/static/rest_framework/css/default.css b/rest_framework/static/rest_framework/css/default.css index 0261a3038..461cdfe5c 100644 --- a/rest_framework/static/rest_framework/css/default.css +++ b/rest_framework/static/rest_framework/css/default.css @@ -3,20 +3,20 @@ content running up underneath it. */ h1 { - font-weight: 500; + font-weight: 500; } h2, h3 { - font-weight: 300; + font-weight: 300; } .resource-description, .response-info { - margin-bottom: 2em; + margin-bottom: 2em; } .version:before { - content: "v"; - opacity: 0.6; - padding-right: 0.25em; + content: "v"; + opacity: 0.6; + padding-right: 0.25em; } .version { @@ -24,16 +24,16 @@ h2, h3 { } .format-option { - font-family: Menlo, Consolas, "Andale Mono", "Lucida Console", monospace; + font-family: Menlo, Consolas, "Andale Mono", "Lucida Console", monospace; } .button-form { - float: right; - margin-right: 1em; + float: right; + margin-right: 1em; } ul.breadcrumb { - margin: 58px 0 0 0; + margin: 80px 0 0 0; } form select, form input, form textarea { @@ -43,17 +43,18 @@ form select, form input, form textarea { form select[multiple] { height: 150px; } + /* To allow tooltips to work on disabled elements */ .disabled-tooltip-shield { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; } .errorlist { - margin-top: 0.5em; + margin-top: 0.5em; } pre { @@ -64,8 +65,7 @@ pre { } .page-header { - border-bottom: none; - padding-bottom: 0px; - margin-bottom: 20px; + border-bottom: none; + padding-bottom: 0px; + margin-bottom: 20px; } - diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index e96fa8ec5..2f4e060b0 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -3,231 +3,277 @@ - {% block head %} - - {% block meta %} - - + {% block head %} + + {% block meta %} + + + {% endblock %} + + {% block title %}Django REST framework{% endblock %} + + {% block style %} + {% block bootstrap_theme %} + + + {% endblock %} + + + {% endblock %} + {% endblock %} - - {% block title %}Django REST framework{% endblock %} - - {% block style %} - {% block bootstrap_theme %} - - - {% endblock %} - - - {% endblock %} - - {% endblock %} - + -
+
- {% block navbar %} - - {% endblock %} - - {% block breadcrumbs %} - - {% endblock %} - - -
- - {% if 'GET' in allowed_methods %} -
-
-
- GET - - - + {% block navbar %} +
-
- {% endif %} - - {% if options_form %} -
- {% csrf_token %} - - -
- {% endif %} - - {% if delete_form %} -
- {% csrf_token %} - - -
- {% endif %} - -
- - {% block description %} - {{ description }} +
{% endblock %} -
-
{{ request.method }} {{ request.get_full_path }}
-
-
-
HTTP {{ response.status_code }} {{ response.status_text }}{% autoescape off %} + + {% block breadcrumbs %} + + {% endblock %} + + +
+ + {% if 'GET' in allowed_methods %} +
+
+
+ + GET + + + + +
+
+
+ {% endif %} + + {% if options_form %} +
+ {% csrf_token %} + + +
+ {% endif %} + + {% if delete_form %} +
+ {% csrf_token %} + + +
+ {% endif %} + +
+ + {% block description %} + {{ description }} + {% endblock %} +
+
{{ request.method }} {{ request.get_full_path }}
+
+
+
HTTP {{ response.status_code }} {{ response.status_text }}{% autoescape off %} {% for key, val in response_headers.items %}{{ key }}: {{ val|break_long_headers|urlize_quoted_links }} {% endfor %}
{{ content|urlize_quoted_links }}
{% endautoescape %} +
+
+ + {% if display_edit_forms %} + + {% if post_form or raw_data_post_form %} +
+ {% if post_form %} + + {% endif %} +
+ {% if post_form %} +
+ {% with form=post_form %} +
+
+ {{ post_form }} +
+ +
+
+
+ {% endwith %} +
+ {% endif %} +
+ {% with form=raw_data_post_form %} +
+
+ {% include "rest_framework/raw_data_form.html" %} +
+ +
+
+
+ {% endwith %} +
+
+
+ {% endif %} + + {% if put_form or raw_data_put_form or raw_data_patch_form %} +
+ {% if put_form %} + + {% endif %} +
+ {% if put_form %} +
+
+
+ {{ put_form }} +
+ +
+
+
+
+ {% endif %} +
+ {% with form=raw_data_put_or_patch_form %} +
+
+ {% include "rest_framework/raw_data_form.html" %} +
+ {% if raw_data_put_form %} + + {% endif %} + {% if raw_data_patch_form %} + + {% endif %} +
+
+
+ {% endwith %} +
+
+
+ {% endif %} + {% endif %}
-
+ + +
+ {% block footer %} +

Sponsored by DabApps.

+ {% endblock %} +
- {% if display_edit_forms %} +
- {% if post_form or raw_data_post_form %} -
- {% if post_form %} - - {% endif %} -
- {% if post_form %} -
- {% with form=post_form %} -
-
- {{ post_form }} -
- -
-
-
- {% endwith %} -
- {% endif %} -
- {% with form=raw_data_post_form %} -
-
- {% include "rest_framework/raw_data_form.html" %} -
- -
-
-
- {% endwith %} -
-
-
- {% endif %} - - {% if put_form or raw_data_put_form or raw_data_patch_form %} -
- {% if put_form %} - - {% endif %} -
- {% if put_form %} -
-
-
- {{ put_form }} -
- -
-
-
-
- {% endif %} -
- {% with form=raw_data_put_or_patch_form %} -
-
- {% include "rest_framework/raw_data_form.html" %} -
- {% if raw_data_put_form %} - - {% endif %} - {% if raw_data_patch_form %} - - {% endif %} -
-
-
- {% endwith %} -
-
-
- {% endif %} - {% endif %} - -
- - -
- - -
- -
- - - - {% block footer %} - {% endblock %} - - {% block script %} - - - - - {% endblock %} - + {% block script %} + + + + + {% endblock %} + From 4d582fd9ffcb6ec28247e95b63134c00cc131780 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 22 Aug 2014 10:12:52 +0200 Subject: [PATCH 2/4] Made all color declarations in bootstrap-tweaks.css consistent --- .../static/rest_framework/css/bootstrap-tweaks.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rest_framework/static/rest_framework/css/bootstrap-tweaks.css b/rest_framework/static/rest_framework/css/bootstrap-tweaks.css index e5cc65ab7..6fa1e6cb5 100644 --- a/rest_framework/static/rest_framework/css/bootstrap-tweaks.css +++ b/rest_framework/static/rest_framework/css/bootstrap-tweaks.css @@ -42,7 +42,7 @@ a single block in the template. } .nav-list > .active > a, .nav-list > .active > a:hover { - background: #2c2c2c; + background: #2C2C2C; } .navbar .navbar-inner .dropdown-menu li a, .navbar .navbar-inner .dropdown-menu li { @@ -50,8 +50,8 @@ a single block in the template. } .navbar .navbar-inner .dropdown-menu li a:hover { - background: #eeeeee; - color: #c20000; + background: #EEEEEE; + color: #C20000; } /*=== dabapps bootstrap styles ====*/ @@ -151,7 +151,7 @@ footer { footer p { text-align: center; color: gray; - border-top: 1px solid #DDD; + border-top: 1px solid #DDDDDD; padding-top: 10px; } From e5d88a80a97e6575c8b2a2ac40cffca6abdf1227 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Wed, 27 Aug 2014 09:41:33 +0200 Subject: [PATCH 3/4] Put all TextNodes (method names) back to same line with parent element --- .../templates/rest_framework/base.html | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index a19101e39..980cee0c5 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -83,9 +83,7 @@
- GET - + rel="nofollow" title="Make a GET request on the {{ name }} resource">GET + title="Make an OPTIONS request on the {{ name }} resource">OPTIONS {% endif %} @@ -124,9 +120,7 @@ {% csrf_token %} + title="Make a DELETE request on the {{ name }} resource">DELETE {% endif %} @@ -172,9 +166,7 @@ {{ post_form }}
+ title="Make a POST request on the {{ name }} resource">POST
@@ -188,9 +180,7 @@ {% include "rest_framework/raw_data_form.html" %}
+ title="Make a POST request on the {{ name }} resource">POST
@@ -222,9 +212,7 @@
+ value="PUT" title="Make a PUT request on the {{ name }} resource">PUT
@@ -239,16 +227,12 @@ {% if raw_data_put_form %} + value="PUT" title="Make a PUT request on the {{ name }} resource">PUT {% endif %} {% if raw_data_patch_form %} + value="PATCH" title="Make a PATCH request on the {{ name }} resource">PATCH {% endif %} From 53808892752f7bc0ff4735a8160e9975baf2a56c Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Thu, 28 Aug 2014 10:39:01 +0200 Subject: [PATCH 4/4] Validation errors in the rendered HTML fixed --- rest_framework/templates/rest_framework/base.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index 980cee0c5..cee9724d5 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -33,7 +33,7 @@