Skip to content

Commit f1e2135

Browse files
committed
Restyle horizontal checkbox. Closes #2783.
1 parent 798cd1a commit f1e2135

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

rest_framework/static/rest_framework/css/bootstrap-tweaks.css

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
3-
This CSS file contains some tweaks specific to the included Bootstrap theme.
3+
This CSS file contains some tweaks specific to the included Bootstrap theme.
44
It's separate from `style.css` so that it can be easily overridden by replacing
55
a single block in the template.
66
@@ -213,3 +213,17 @@ body a:hover {
213213
.request-info {
214214
clear:both;
215215
}
216+
217+
.horizontal-checkbox label {
218+
padding-top: 0;
219+
}
220+
221+
.horizontal-checkbox label {
222+
padding-top: 0 !important;
223+
}
224+
225+
.horizontal-checkbox input {
226+
float: left;
227+
width: 20px;
228+
margin-top: 3px;
229+
}

rest_framework/templates/rest_framework/horizontal/checkbox.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<div class="form-group {% if field.errors %}has-error{% endif %}">
2-
<div class="col-sm-offset-2 col-sm-10">
3-
<div class="checkbox">
4-
<label>
5-
<input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}>
6-
{% if field.label %}{{ field.label }}{% endif %}
7-
</label>
8-
</div>
1+
<div class="form-group horizontal-checkbox {% if field.errors %}has-error{% endif %}">
2+
{% if field.label %}
3+
<label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">
4+
{{ field.label }}
5+
</label>
6+
{% endif %}
7+
8+
<div class="col-sm-10">
9+
<input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}>
910

1011
{% if field.errors %}
1112
{% for error in field.errors %}

0 commit comments

Comments
 (0)