salvator avatar salvator committed 6bb20e6

tabbable fieldsets in change form

Comments (0)

Files changed (6)

admintools_bootstrap/static/admintools_bootstrap/bootstrap/less/style.less

 	}
 	background-color: @grayLighter;
 }
+

admintools_bootstrap/templates/admin/base.html

         {% block messages %}
           {% if messages %}
               {% for message in messages %}
-                <div class="alert-message {{ message.tags }}" data-alert="alert"><a class="close" href="#">x</a>{{ message }}</div>
+                <div class="alert alert-{{ message.tags }}" data-alert="alert"><a class="close" href="#">&times;</a>{{ message }}</div>
               {% endfor %}
           {% endif %}
         {% endblock %}

admintools_bootstrap/templates/admin/edit_inline/tabular.html

 <fieldset class="module well">
    <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
    {{ inline_admin_formset.formset.non_form_errors }}
-   <table class="bordered-table zebra-striped tabular-inline">
+   <table class="table table-striped tabular-inline table-condensed table-bordered">
      <thead><tr>
      {% for field in inline_admin_formset.fields %}
        {% if not field.widget.is_hidden %}

admintools_bootstrap/templates/admin/includes/fieldset.html

                                     <span class="help-inline">{{ field.field.help_text|safe }}</span>
                                 {% endif %}
                               </div>
-
                   {% endfor %}
               </div>
           {% endfor %}
   </div>
 </div>
 {% else %}
-<fieldset class="module aligned {{ fieldset.classes }} well control-group">
+<fieldset class="module aligned {{ fieldset.classes }} well control-group"{% if fieldset.name %} id="{{ fieldset.name|slugify }}"{% endif %}>
     {% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
     {% if fieldset.description %}
         <div class="description">{{ fieldset.description|safe }}</div>
                                 {{ field.field }}
                                 {{ line.errors }}
                           {% endif %}
+                          {% if field.field.help_text %}
+                              <div class="help-inline">{{ field.field.help_text|safe }}</div>
+                          {% endif %}
                         </div>
 
-                    {% if field.field.help_text %}
-                        <div class="input help_text">{{ field.field.help_text|safe }}</div>
-                    {% endif %}
             {% endfor %}
         </div>
     {% endfor %}

admintools_bootstrap/templates/admin/login.html

 {% endif %}
 
 <div id="content-main">
-<form action="{{ app_path }}" method="post" id="login-form" class="">{% csrf_token %}
-  <div class="clearfix{% if form.username.errors %} error{% endif %}">
-    <label for="id_username" class="required">{% trans 'Username:' %}</label>
-    <div class="input">
+<form action="{{ app_path }}" method="post" id="login-form" class="form-horizontal">{% csrf_token %}
+  <div class="control-group{% if form.username.errors %} error{% endif %}">
+    <label for="id_username" class="required control-label">{% trans 'Username:' %}</label>
+    <div class="controls">
       {{ form.username }}
       {% if form.username.errors %}<span class="help-inline">{{ form.username.errors }}</span>{% endif %}
     </div>
   </div>
-  <div class="clearfix{% if form.password.errors %} error{% endif %}">
-    <label for="id_password" class="required">{% trans 'Password:' %}</label> 
-    <div class="input">
+  <div class="control-group{% if form.password.errors %} error{% endif %}">
+    <label for="id_password" class="required control-label">{% trans 'Password:' %}</label> 
+    <div class="controls">
       {{ form.password }}
       {% if form.password.errors %}<span class="help-inline">{{ form.password.errors }}</span>{% endif %}
     </div>
     <input type="hidden" name="this_is_the_login_form" value="1" />
     <input type="hidden" name="next" value="{{ next }}" />
   </div>
-  <div class="actions">
-    <input type="submit" value="{% trans 'Log in' %}" class="btn primary"/>
+  <div class="form-actions">
+    <input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary"/>
   </div>
 </form>
 

admintools_bootstrap/templates/admintools_bootstrap/tabbed_change_form.html

+{% extends "admin/base_site.html" %}
+{% load i18n admin_modify adminmedia %}
+{% load url from future %}
+
+{% block extrahead %}{{ block.super }}
+{% url 'admin:jsi18n' as jsi18nurl %}
+<script type="text/javascript" src="{{ jsi18nurl|default:"../../../jsi18n/" }}"></script>
+{{ media }}
+<script type="text/javascript" src="{{ STATIC_URL }}admintools_bootstrap/bootstrap/js/bootstrap-tab.js"></script>
+{% endblock %}
+
+{% block extrastyle %}{{ block.super }}{#<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />#}{% endblock %}
+
+{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}
+
+{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}
+
+{% block breadcrumbs %}
+{% if not is_popup %}
+../../../|{% trans "Home" %}
+../../|{{ app_label|capfirst|escape }}
+*{% if has_change_permission %}../|{{ opts.verbose_name_plural|capfirst }}{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %}
+*{% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}
+{% endif %}
+{% endblock %}
+
+{% block object-tools %}
+{% if change %}{% if not is_popup %}
+  <div class="pull-right">
+    {% block object-tools-items %}
+    <a href="history/" class="btn btn-info">{% trans "History" %}</a>
+    {% if has_absolute_url %}<a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="btn primary">{% trans "View on site" %}</a>{% endif%}
+    {% endblock %}
+  </div>
+{% endif %}{% endif %}
+{% endblock %}
+
+{% block messages %}
+  {{ block.super }}
+  {% if errors %}
+    <div class="alert alert-error{% if adminform.form.non_form_errors %} alert-block{% endif %}" data-alert="alert">
+      {% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
+      {{ adminform.form.non_field_errors }}
+    </div>
+  {% endif %}
+{% endblock %}
+
+{% block content %}<div id="content-main">
+<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form" class="form-horizontal">{% csrf_token %}{% block form_top %}{% endblock %}
+<div>
+{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
+{% if save_on_top %}{% submit_row %}{% endif %}
+
+<div class="tabbable">
+<ul class="nav nav-tabs">
+  {% for fieldset in adminform %}
+    <li{% if forloop.first %} class="active"{% endif %}><a href="#{{ fieldset.name|slugify }}" data-toggle="tab">{{ fieldset.name|default:"Fieldset name is required for this template!" }}</a></li>
+  {% endfor %}
+  {% for inline_admin_formset in inline_admin_formsets %}
+    <li><a href="#{{ inline_admin_formset.formset.prefix }}-group" data-toggle="tab">{{ inline_admin_formset.opts.verbose_name_plural|title }}</a></li>
+  {% endfor %}
+</ul>
+
+<div class="tab-content">
+{% for fieldset in adminform %}
+    {% include "admin/includes/fieldset.html" %}
+{% endfor %}
+
+{% block after_field_sets %}{% endblock %}
+
+{% for inline_admin_formset in inline_admin_formsets %}
+    {% include inline_admin_formset.opts.template %}
+{% endfor %}
+</div>
+
+</div>
+
+<script type="text/javascript">
+  $(function(){
+    $('.tabbable fieldset,.tabbable .inline-group').addClass('tab-pane');
+    $('.tabbable fieldset:first').addClass('active');
+    $('.tabbable fieldset h2, .tabbable inline-group h2').hide();
+  });
+</script>
+
+{% block after_related_objects %}{% endblock %}
+
+{% submit_row %}
+
+{% if adminform and add %}
+   <script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
+{% endif %}
+
+{# JavaScript for prepopulated fields #}
+{% prepopulated_fields_js %}
+
+</div>
+</form></div>
+{% endblock %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.