Skip to content

Commit fb117e2

Browse files
author
Emmanouil Konstantinidis
committed
Move CSS to LESS
1 parent 44580bd commit fb117e2

File tree

4 files changed

+32
-15
lines changed

4 files changed

+32
-15
lines changed

drfdocs/api_endpoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ class ApiEndpoint(object):
66
def __init__(self, pattern, parent_pattern=None):
77
self.pattern = pattern
88
self.callback = pattern.callback
9-
self.name = pattern.name
9+
# self.name = pattern.name
1010
self.name_parent = simplify_regex(parent_pattern.regex.pattern).replace('/', '') if parent_pattern else None
1111
self.path = self.__get_path__(parent_pattern)
1212
self.allowed_methods = self.__get_allowed_methods__()
13-
self.view_name = pattern.callback.__name__
13+
# self.view_name = pattern.callback.__name__
1414
self.fields = self.__get_serializer_fields__()
1515

1616
def __get_path__(self, parent_pattern):

drfdocs/static/css/style.css renamed to drfdocs/static/less/style.less

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,23 @@ body {
2525
word-wrap: break-word;
2626
}
2727

28+
.endpoint .methods {
29+
margin-bottom: 0;
30+
}
31+
2832
.endpoint .methods .method {
29-
border: 1px solid #2c3e50;
30-
padding: 3px 8px;
33+
padding: 4px 8px;
34+
margin-top: 10.5px;
35+
color: #FFF;
3136
}
3237

38+
.endpoint .methods .method.get { background-color: #18bc9c; }
39+
.endpoint .methods .method.post { background-color: #f39c12; }
40+
.endpoint .methods .method.put { background-color: #028d94; }
41+
.endpoint .methods .method.patch { background-color: #028d94; }
42+
.endpoint .methods .method.delete { background-color: #e74c3c; }
43+
.endpoint .methods .method.options { background-color: #3498db; }
44+
3345
/* @end Endpoint */
3446

3547

drfdocs/templates/drfdocs/base.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
<!-- Font Awesome -->
1717
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
1818
<!-- Custom Style -->
19-
<link href="{% static "css/style.css" %}" rel="stylesheet">
19+
<link rel="stylesheet/less" type="text/css" href="{% static "less/style.less" %}" />
20+
21+
<!-- LESS CSS -->
22+
<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.5.3/less.min.js"></script>
2023
</head>
2124

2225
<body>

drfdocs/templates/drfdocs/home.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ <h1>{{group.grouper}}</h1>
1010

1111
{% for endpoint in group.list %}
1212
<div class="endpoint">
13-
<h4 class="title">{{ endpoint.path }}</h4>
14-
15-
<ul class="list-inline methods">
16-
{% for method in endpoint.allowed_methods %}
17-
<li class="method">{{ method }}</li>
18-
{% endfor %}
19-
</ul>
20-
21-
<p>View Name: {{ endpoint.view_name }}</p>
22-
<p>URL Name: {{ endpoint.name }}</p>
13+
<div class="row">
14+
<div class="col-md-7">
15+
<h4 class="title">{{ endpoint.path }}</h4>
16+
</div>
17+
<div class="col-md-5 text-right">
18+
<ul class="list-inline methods">
19+
{% for method in endpoint.allowed_methods %}
20+
<li class="method {{ method|lower }}">{{ method }}</li>
21+
{% endfor %}
22+
</ul>
23+
</div>
24+
</div>
2325

2426
{% if endpoint.fields %}
2527
<p>Fields:</p>

0 commit comments

Comments
 (0)