Permalink
Browse files

Porting to bootstrap v2

  • Loading branch information...
pamelafox-coursera committed Aug 14, 2012
1 parent 7adc02b commit 4dbffacb1c65fc83b7921131cbe0f2dc410c23ad
@@ -1,7 +1,7 @@
{% load i18n %}
<div class="actions">
{% for field in action_form %}{% if field.label %}<label style="float: none;">{{ field.label }} {% endif %}{{ field }}{% if field.label %}</label>{% endif %}{% endfor %}
- <button type="submit" class="btn small" title="{% trans "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% trans "Go" %}</button>
+ <button type="submit" class="btn btn-small" title="{% trans "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% trans "Go" %}</button>
{% if actions_selection_counter %}
<script type="text/javascript">var _actions_icnt="{{ cl.result_list|length|default:"0" }}";</script>
<span class="action-counter">{{ selection_note }}</span>
@@ -30,19 +30,19 @@
<fieldset class="module aligned">
-<div class="clearfix {% if form.password1.errors %}error{% endif %}">
- <label for="id_password1"><strong>{% trans 'Password' %}:</strong></label>
- <div class="input">
+<div class="control-group {% if form.password1.errors %}error{% endif %}">
+ <label class="control-label" for="id_password1"><strong>{% trans 'Password' %}:</strong></label>
+ <div class="controls">
{{ form.password1 }}
{% for err in form.password1.errors %}
<span class="help-inline">{{err}}</span>
{% endfor %}
</div>
</div>
-<div class="clearfix {% if form.password2.errors %}error{% endif %}">
- <label for="id_password2"><strong>{% trans 'Password (again)' %}:</strong></label>
- <div class="input">
+<div class="control-group {% if form.password2.errors %}error{% endif %}">
+ <label class="control-label" for="id_password2"><strong>{% trans 'Password (again)' %}:</strong></label>
+ <div class="controls">
{{ form.password2 }}
{% for err in form.password2.errors %}
<span class="help-inline">{{err}}</span>
@@ -54,7 +54,7 @@
</fieldset>
<div class="submit-row">
-<input type="submit" value="{% trans 'Change password' %}" class="btn primary default" />
+<input type="submit" value="{% trans 'Change password' %}" class="btn btn-primary" />
</div>
<script type="text/javascript">document.getElementById("id_password1").focus();</script>
@@ -4,82 +4,99 @@
<html>
<head>
<title>{% block title %}{% endblock %}</title>
-<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
+<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
+{% block extrastyle %}{% endblock %}
<style>
-.sidebar {
- overflow: hidden;
+#changelist table tbody td:first-child, #changelist table tbody th:first-child {
+ border-left: 1px solid #ddd;
+}
+#changelist .actions {
+ margin-top: 10px;
+ border: 1px solid #DDD;
}
-.sidebar td {
- border: none;
+.object-tools {
+ float: right;
}
-.sidebar h6 {
- font-size: 10px;
- line-height: 12px;
+select + .btn {
+ margin-top: -10px;
+ margin-left: 5px;
}
-.object-tools {
- margin-bottom: 10px;
+.calendarbox {
+ border: 1px solid #ccc;
+}
+
+.row-fluid {
+ margin-left: auto;
+ margin-right: auto;
+ max-width: 1200px;
+}
+
+.page-header {
+ padding-bottom: 4px;
}
-form .clearfix {
- border-top: 1px solid #DDDDDD;
- padding-top: 8px;
- margin-bottom: 8px;
+body.popup .row-fluid {
+ max-width: 700px;
+ margin-left: 0;
+ margin-right: 0;
}
-form table .clearfix {
- border-top: 0px solid #DDDDDD;
+body.popup .vLargeTextField, body.popup .vXMLLargeTextField {
+ max-width: 400px;
}
-.help-block {
- color: #BFBFBF;
+.addlink {
+ background: url(/static/admin/img/icon_addlink.gif) 0 .2em no-repeat;
+ height: 16px;
+ width: 16px;
+ display: inline-block;
+ vertical-align: middle;
}
-#changelist table#result_list tbody td:first-child {
- border-left: 0 none;
- border-right: 0 none;
+.changelink {
+ background: url(/static/admin/img/icon_changelink.gif) 0 .2em no-repeat;
+ height: 16px;
+ width: 16px;
+ display: inline-block;
+ vertical-align: middle;
}
+.deletelink {
+ background: url(/static/admin/img/icon_deletelink.gif) 0 .25em no-repeat;
+ height: 16px;
+ width: 16px;
+ display: inline-block;
+ vertical-align: middle;
+}
</style>
-{% block extrastyle %}{% endblock %}
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
-<script src="http://twitter.github.com/bootstrap/1.4.0/bootstrap-dropdown.js"></script>
-<script src="http://twitter.github.com/bootstrap/1.4.0/bootstrap-alerts.js"></script>
<script>
- $(function() {
- $(".alert-message").each(function() { // add close function to all alerts
- var self = $(this)
- self.addClass('fade').addClass('in');
- self.alert();
- });
- });
+window.__admin_media_prefix__ = '/static/admin/';
</script>
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-alert.js"></script>
+<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script>
{% block extrahead %}{% endblock %}
{% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
</head>
-<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}" {% if not is_popup %}style="padding-top: 50px;"{% endif %}>
+<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}">
{% if not is_popup %}
<!-- Header -->
-<div class="topbar">
- <div class="topbar-inner">
- <div class="container">
+<div class="navbar">
+ <div class="navbar-inner">
+ <div class="container-fluid">
<span class="brand">{% block branding %}{% endblock %}</span>
- <!-- DropDown -->
- <script>
- $(function() {
- $('.topbar').dropdown();
- });
- </script>
- <ul class="nav secondary-nav">
+ <ul class="nav pull-right">
{% block userlinks %}
{% if user.is_active and user.is_staff %}
<li class="dropdown">
- <a href="#" class="dropdown-toggle">{% trans "Welcome" %}
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans "Welcome" %}
<strong>{% filter force_escape %}{% firstof user.first_name user.username %}{% endfilter %}</strong>.
+ <span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% url 'django-admindocs-docroot' as docsroot %}
@@ -111,6 +128,7 @@
</div>
<!-- END Header -->
+ <div class="container-fluid">
{% block breadcrumbs %}
<ul class="breadcrumb">
<li><a href="#">{% trans 'Home' %}</a> <span class="divider">/</span></li>
@@ -119,32 +137,39 @@
{% endif %}
</ul>
{% endblock %}
+</div>
+
{% endif %}
<!-- Container -->
-<div class="container-fluid" style="{% if is_popup %}min-width: 740px;{% endif %}">
+<div class="container-fluid">
{% if messages %}
{% for message in messages %}
- <div class="alert-message {{ message.tags }}">
- <a class="close" href="#">×</a>
+ <div class="alert alert-block {{ message.tags }}">
+ <a class="close" data-dismiss="alert" href="#">×</a>
<p>{{ message }}</p>
</div>
{% endfor %}
{% endif %}
{% block internal_content %}
- {% block sidebar %}{% endblock %}
-
- <!-- Content -->
- <div id="content" class="{% block coltype %}colM{% endblock %}">
- {% block pretitle %}{% endblock %}
- {% block content_title %}{% if title %}<h2>{{ title }}</h2>{% endif %}{% endblock %}
- {% block content %}
- {% block object-tools %}{% endblock %}
- {{ content }}
- {% endblock %}
- <br class="clear" />
+ <div class="row-fluid">
+
+ <div class="span12">
+ <div id="content" class="{% block coltype %}colM{% endblock %}">
+ {% block pretitle %}{% endblock %}
+ <div style="margin-bottom: 10px;">
+ {% block object-tools %}{% endblock %}
+ {% block content_title %}{% if title %}<h2 class="page-header">{{ title }}</h2>{% endif %}{% endblock %}
+ </div>
+
+ {% block content %}
+ {{ content }}
+ {% endblock %}
+ <br class="clear" />
+ </div>
+ </div>
</div>
{% endblock %}
<!-- END Content -->
@@ -26,23 +26,24 @@
{% endblock %}
{% endif %}
-{% block content %}<div id="content-main">
{% block object-tools %}
{% if change %}{% if not is_popup %}
<div class="object-tools">
{% block object-tools-items %}
- <a href="history/" class="historylink"><span class="label">{% trans "History" %}</span></a>
+ <a href="history/" class="btn btn-small historylink">{% trans "History" %}</span></a>
{% if has_absolute_url %}<a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink"><span class="label">{% trans "View on site" %}</span></a>{% endif%}
{% endblock %}
</div>
{% endif %}{% 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">{% 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 %}
{% if errors %}
-<div class="alert-message error">
+<div class="alert alert-error alert-block">
<p>
{% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
@@ -47,21 +47,21 @@
{% endblock %}
{% endif %}
+{% block object-tools %}
+ <div class="object-tools">
+ {% if has_add_permission %}
+ {% block object-tools-items %}
+ <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="btn btn-small btn-success">
+ <span class="addlink"></span>
+ {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
+ </a>
+ {% endblock %}
+ {% endif %}
+ </div>
+{% endblock %}
+
{% block content %}
<div id="content-main">
- {% block object-tools %}
- <div class="object-tools">
- {% if has_add_permission %}
- {% block object-tools-items %}
- <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
- <span class="label success">
- {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
- </span>
- </a>
- {% endblock %}
- {% endif %}
- </div>
- {% endblock %}
{% if cl.formset.errors %}
<p class="errornote">
{% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
@@ -81,7 +81,7 @@ <h6>{% trans 'Filter' %}</h6>
{% endif %}
{% endblock %}
- <form id="changelist-form" action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
+ <form id="changelist-form" class="form-inline" action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
{% if cl.formset %}
<div>{{ cl.formset.management_form }}</div>
{% endif %}
@@ -5,7 +5,7 @@
{% endif %}
{% if results %}
<div class="results">
-<table cellspacing="0" id="result_list" class="bordered-table zebra-striped">
+<table cellspacing="0" id="result_list" class="table table-bordered table-striped">
<thead>
<tr>
{% for header in result_headers %}<th scope="col"{{ header.class_attrib }}>
@@ -39,7 +39,7 @@
<form action="" method="post">{% csrf_token %}
<div>
<input type="hidden" name="post" value="yes" />
- <input type="submit" class="btn danger" value="{% trans "Yes, I'm sure" %}" />
+ <input type="submit" class="btn btn-danger" value="{% trans "Yes, I'm sure" %}" />
</div>
</form>
{% endif %}
@@ -45,7 +45,7 @@
{% endfor %}
<input type="hidden" name="action" value="delete_selected" />
<input type="hidden" name="post" value="yes" />
- <input type="submit" class="btn danger" value="{% trans "Yes, I'm sure" %}" />
+ <input type="submit" class="btn btn-danger" value="{% trans "Yes, I'm sure" %}" />
</div>
</form>
{% endif %}
@@ -5,7 +5,7 @@
<fieldset class="module" style="padding: 0;">
<h4>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h4>
{{ inline_admin_formset.formset.non_form_errors }}
- <table style="margin-bottom:0;">
+ <table class="table" style="margin-bottom:0;">
<thead><tr>
{% for field in inline_admin_formset.fields %}
{% if not field.widget.is_hidden %}
@@ -46,7 +46,7 @@ <h4>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h4>
{% if field.is_readonly %}
<p>{{ field.contents }}</p>
{% else %}
- <div class="clearfix {% if field.field.errors %}error{%endif%}">
+ <div class="control-group {% if field.field.errors %}error{%endif%}">
{{ field.field }}
{% for err in field.field.errors %}
<span class="help-block">{{ err }}</span>
@@ -1,21 +1,18 @@
<fieldset class="module aligned {{ fieldset.classes }}">
- {% if fieldset.name %}<h2 style="height: 31px">{{ fieldset.name }}</h2>{% endif %}
+ {% if fieldset.name %}<h3 style="height: 31px">{{ fieldset.name }}</h3>{% endif %}
{% if fieldset.description %}
<div class="description">{{ fieldset.description|safe }}</div>
{% endif %}
{% for line in fieldset %}
- <div class="clearfix {% if line.errors %}error{%endif%}">
+ <div class="control-group {% if line.errors %}error{%endif%}">
{% for field in line %}
{% if not field.is_checkbox %}
- <label for="{{ field.field.id_for_label }}">
- {% if field.field.field.required %}
- <strong>{{ field.field.label }}</strong>
- {% else %}
- {{ field.field.label }}
- {% endif %}:
+ <label class="control-label" for="{{ field.field.id_for_label }}">
+ {{ field.field.label }}
+ {% if field.field.field.required %}* {% endif %}
</label>
{% endif %}
- <div class="input">
+ <div class="controls">
{% if field.is_checkbox %}
{{ field.field }}{{ field.label_tag }}
{% else %}
Oops, something went wrong.

0 comments on commit 4dbffac

Please sign in to comment.