Skip to content
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

Style forms using django-bootstrap-form 3.4 #614

Merged
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
1 change: 1 addition & 0 deletions cabot/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
'dal',
'dal_select2',
'django.contrib.admin',
'bootstrapform',
)

AUTH_USER_MODEL = 'auth.User'
Expand Down
11 changes: 4 additions & 7 deletions cabot/templates/cabotapp/_base_form.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% load bootstrap %}

<div class="form-group">
<div class="col-xs-10 col-xs-offset-2">
{{ form.non_field_errors }}
Expand All @@ -9,10 +11,10 @@
<div class="col-xs-12">
<label class="col-xs-2 control-label">{{ field.label_tag }}</label>
{% if field.errors %}
<div class="col-xs-7">{{ field }}</div>
<div class="col-xs-7">{{ field|bootstrap_inline }}</div>
<div class="col-xs-3 alert alert-danger">{{ field.errors }}</div>
{% else %}
<div class="col-xs-10">{{ field }}</div>
<div class="col-xs-10">{{ field|bootstrap_inline }}</div>
{% endif %}
</div>
{% if field.name == 'metric' %}
Expand All @@ -24,10 +26,5 @@
</div>
{% else %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still necessary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like that was an existing issue not created by this PR, so i think i'm just going to merge

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough

{% endif %}
{% if field.help_text %}
<div class="col-xs-12">
<div class="col-xs-7 col-xs-offset-2"><p class="help-block">{{ field.help_text }}</p></div>
</div>
{% endif %}
</div>
{% endfor %}
4 changes: 3 additions & 1 deletion cabot/templates/cabotapp/alertpluginuserdata_form.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends 'base.html' %}

{% load bootstrap %}

{% block content %}
<div class="container-fluid">
<div class="row">
Expand All @@ -18,7 +20,7 @@ <h1 class="page-header">User Profile</h1>
{% for field in form %}
<div class="form-group">
<label class="col-xs-2 control-label">{{ field.label_tag }}</label>
<div class="col-xs-10">{{ field }}</div>
<div class="col-xs-10">{{ field|bootstrap_inline }}</div>
</div>
{% endfor %}
<div class="form-group">
Expand Down
8 changes: 5 additions & 3 deletions cabot/templates/cabotapp/plugin_settings_form.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends 'base.html' %}

{% load bootstrap %}

{% block content %}
<div class="container-fluid">
<div class="row">
Expand All @@ -21,7 +23,7 @@ <h1 class="page-header">{{ plugin_name|title }} Settings</h1>
{% for field in form %}
<div class="form-group">
<label class="col-xs-2 control-label">{{ field.label_tag }}</label>
<div class="col-xs-6">{{ field }}</div>
<div class="col-xs-6">{{ field|bootstrap_inline }}</div>
</div>
{% endfor %}
<div class="form-group">
Expand All @@ -36,12 +38,12 @@ <h2 class="page-header">Alert Test</h2>
<form class="form-horizontal" action="{{ alert_test_form.action }}" method="post" role="form">
{% csrf_token %}
{% for field in alert_test_form.hidden_fields %}
{{ field }}
{{ field|bootstrap_inline }}
{% endfor %}
{% for field in alert_test_form.visible_fields %}
<div class="form-group">
<label class="col-xs-2 control-label">{{ field.label_tag }}</label>
<div class="col-xs-6">{{ field }}</div>
<div class="col-xs-6">{{ field|bootstrap_inline }}</div>
</div>
{% endfor %}
<div class="form-group">
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Django==1.11.11
django-appconf==1.0.2
django-auth-ldap==1.2.16
django-autocomplete-light==3.2.10
django-bootstrap-form==3.4
django-compressor==2.2
django-filter==1.0.4
django-jsonify==0.3.0
Expand Down