Permalink
Browse files

Merge branch 'add_endpoint_full_description' of git://github.com/pjam…

…bet/Django-API-Playground into pjambet-add_endpoint_full_description

Conflicts:
	apiplayground/playground.py
  • Loading branch information...
2 parents 43aab89 + 48fa089 commit c5aca8804c79e896b8d903777c77174c65b196b4 @fatiherikli fatiherikli committed Mar 19, 2013
@@ -1,4 +1,5 @@
import json
+import markdown
from django.conf.urls import url
from django.http import HttpResponse, HttpResponseBadRequest
@@ -51,6 +52,7 @@ def browser_index(self, request):
"""
A view that returns api browser index.
"""
+ self.build_full_description()
return render_to_response(self.index_template, {
"schema": self.get_schema(),
"feedback_form_toggle": API_PLAYGROUND_FEEDBACK,
@@ -101,6 +103,14 @@ def get_urls(self):
url("^submit-feedback$", self.submit_feedback, name="api_playground_submit_feedback"),
]
+ def build_full_description(self):
+ schema = self.get_schema()
+ for resource in schema['resources']:
+ for endpoint in resource.get('endpoints', []):
+ if endpoint.get('full_description', ""):
+ endpoint['full_description'] = markdown.markdown(
+ endpoint['full_description'].strip())
+
@property
def urls(self):
"""
@@ -151,6 +151,22 @@ section.resource {
font-size: 14px;
}
+ section.resource ul li .full_description {
+ font-size: 16px;
+ font-weight: normal;
+ padding: 0 30px;
+ }
+ section.resource ul li .full_description ol li {
+ list-style-type: decimal;
+ }
+
+ section.resource ul li .full_description ul {
+ padding: 0 0 0 40px;
+ }
+ section.resource ul li .full_description ul li {
+ list-style-type: disc;
+ }
+
section.resource ul li form, section.resource ul li .result {
margin: 0 100px;
overflow: hidden;
@@ -275,4 +291,4 @@ section.resource li.endpoint a.give-feedback {
background-color: #fdffd1;
padding: 10px;
display: none;
- }
+ }
@@ -18,6 +18,9 @@
<i>{{ endpoint.description }}</i>
</a>
<section class="try-it">
+ {% if endpoint.full_description %}
+ <div class="full_description">{{ endpoint.full_description|safe }}</div>
+ {% endif %}
<form action="{{ endpoint.url }}" data-endpoint-url="{{ endpoint.url }}" method="{{ endpoint.method|upper }}">
{% spaceless %}
{% get_endpoint_forms endpoint as forms %}
@@ -73,4 +76,4 @@
new APIBrowser();
});
</script>
-{% endblock %}
+{% endblock %}
View
@@ -1,2 +1,3 @@
django==1.4.1
-django-tastypie==0.9.11
+django-tastypie==0.9.11
+Markdown==2.3
View
@@ -4,13 +4,14 @@
name='django-api-playground',
version='0.1.1',
packages=['apiplayground', 'apiplayground.templatetags'],
- zip_safe = False,
+ zip_safe=False,
include_package_data=True,
url='http://github.com/fatiherikli/django-api-playground',
license='BSD',
author='fatiherikli',
author_email='fatiherikli@gmail.com',
description='API Playground for RESTful APIs',
+ install_requires=['markdown'],
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: Web Environment",

0 comments on commit c5aca88

Please sign in to comment.