Skip to content

New docs layout (alt) #4879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Feb 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
393 changes: 174 additions & 219 deletions rest_framework/static/rest_framework/docs/css/base.css

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

7 changes: 7 additions & 0 deletions rest_framework/static/rest_framework/docs/js/bootstrap.min.js

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions rest_framework/templates/rest_framework/docs/document.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
{% load rest_framework %}
<div class="row">
<div class="col-md-6">
<h1 id="document-title">{{ document.title }}</h1>
<p>{% render_markdown document.description %}</p>
</div>
<div class="col-md-6"></div>
</div>

{% for section_key, section in document.data.items %}
<h1 id="{{ section_key }}" class="coredocs-section">{{ section_key }}</h1>
<h2 id="{{ section_key }}" class="coredocs-section"><i class="fa fa-angle-right"></i> {{ section_key }}</h2>
{% for link_key, link in section.links.items %}
{% include "rest_framework/docs/link.html" %}
{% endfor %}
{% endfor %}

{% for link_key, link in document.links.items %}
{% include "rest_framework/docs/llink.html" %}
{% include "rest_framework/docs/link.html" %}
{% endfor %}
28 changes: 13 additions & 15 deletions rest_framework/templates/rest_framework/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,37 @@

<title>{{ document.title }}</title>

<link href="{% static 'rest_framework/docs/css/bootstrap-custom.min.css' %}" rel="stylesheet">
<link href="{% static 'rest_framework/docs/css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'rest_framework/docs/css/bootstrap-theme.min.css' %}" rel="stylesheet">
<link href="{% static 'rest_framework/docs/css/font-awesome-4.0.3.css' %}" rel="stylesheet">
<link href="{% static 'rest_framework/docs/css/base.css' %}" rel="stylesheet">
<style>{{ code_style }}</style>
<style>
.highlight {background-color: #f7f7f9}
.coredocs-link {border-top: 1px solid lightgrey; margin-top: 20px}
.coredocs-section {border-top: 2px solid lightgrey; margin-top: 20px; padding-top: 20px}
.checkbox label.control-label {font-weight: bold}
@media (min-width: 768px) {
.navbar-nav.navbar-right:last-child {
margin-right: 0 !important;
}
}
</style>
<script src="https://unpkg.com/[email protected].17/dist/coreapi.js"></script>
<script src="https://unpkg.com/[email protected].18/dist/coreapi.js"></script>
</head>

<body>
<body data-spy="scroll" data-target="#sidebar-nav" data-offset="50">

{% include "rest_framework/docs/nav.html" %}
{% include "rest_framework/docs/sidebar.html" %}

<div class="container-fluid">
<div class="col-md-2">{% include "rest_framework/docs/toc.html" %}</div>
<div class="col-md-10" role="main">{% include "rest_framework/docs/document.html" %}</div>
<div class="container" id="main">
<div class="row">
<div class="col-md-12">
{% include "rest_framework/docs/document.html" %}
</div>
</div>
</div>

<script src="{% static 'rest_framework/docs/js/jquery-1.10.2.min.js' %}"></script>
<script src="{% static 'rest_framework/docs/js/bootstrap-3.0.3.min.js' %}"></script>
<script src="{% static 'rest_framework/docs/js/bootstrap.min.js' %}"></script>
<script>
function getCookie(name) {
var cookieValue = null;
Expand All @@ -61,8 +63,6 @@
const doc = codec.decode(schema)
const client = new coreapi.Client(null, null, csrf)

$('body').scrollspy({ target: '#toc' })

// Language Control
$('.language-control li a').click(function (event) {
event.preventDefault();
Expand All @@ -73,7 +73,7 @@
languageControls.not('[data-language="' + language +'"]').parent().removeClass("active")
languageControls.filter('[data-language="' + language +'"]').parent().addClass("active")

button.closest("li.dropdown").find('.dropdown-toggle span').text(language)
button.closest(".btn-group").find('.dropdown-toggle span').first().text(language)

var codeBlocks = $('pre.highlight')
codeBlocks.not('[data-language="' + language +'"]').addClass("hide")
Expand Down Expand Up @@ -121,8 +121,6 @@
}
})

console.log(params)

client.action(doc, key, params).then(function (data) {
var response = JSON.stringify(data, null, 2);
form.find(".response-data").text(response)
Expand Down
4 changes: 2 additions & 2 deletions rest_framework/templates/rest_framework/docs/link.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<div class="row coredocs-link">

<div class="col-md-6 docs-content">
<button class="btn btn-success" style="float: right; margin-top: 20px" data-toggle="modal" data-target="#{{ section_key }}_{{ link_key }}_modal">Interact</button>
<button class="btn btn-sm btn-success" style="float: right; margin-top: 20px" data-toggle="modal" data-target="#{{ section_key }}_{{ link_key }}_modal">Interact</button>

<h2 id="{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</h2>
<h3 id="{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</h3>
<p>
<span class="label label-primary">{{ link.action|upper }}</span> <code>{{ link.url }}</code>
</p>
Expand Down
34 changes: 0 additions & 34 deletions rest_framework/templates/rest_framework/docs/nav.html

This file was deleted.

33 changes: 33 additions & 0 deletions rest_framework/templates/rest_framework/docs/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<div class="sidebar">
<h3 class="brand">{{ document.title }}</h3>

<i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
<div class="menu-list">
<ul id="menu-content" class="menu-content collapse out">
{% for section_key, section in document.data.items %}
<li data-toggle="collapse" data-target="#{{ section_key }}-dropdown" class="collapsed">
<a href="#{{ section_key }}"><i class="fa fa-dot-circle-o fa-lg"></i> {{ section_key }} <span class="arrow"></span></a>
</li>
<ul class="sub-menu collapse in" id="{{ section_key }}-dropdown">
{% for link_key, link in section.links.items %}
<li><a href="#{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</a></li>
{% endfor %}
</ul>
{% endfor %}
</ul>

<div class="language-switcher">
<h6>Choose Language</h6>
<div class="btn-group">
<button type="button" class="btn btn-info btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span>shell</span> &nbsp;&nbsp;<span class="caret"></span>
</button>
<ul class="dropdown-menu language-control">
<li class="active"><a href="#" data-language="shell">shell</a></li>
<li><a href="#" data-language="javascript">javascript</a></li>
<li><a href="#" data-language="python">python</a></li>
</ul>
</div>
</div>
</div>
</div>
17 changes: 0 additions & 17 deletions rest_framework/templates/rest_framework/docs/toc.html

This file was deleted.