Skip to content

Commit

Permalink
added new form_base.html template so we include all form related code
Browse files Browse the repository at this point in the history
  • Loading branch information
wm3ndez committed Oct 6, 2014
1 parent fe3a5af commit de70bed
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 66 deletions.
1 change: 0 additions & 1 deletion realestate/templates/dashboard/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
<h1>
{% block content-header %}{% endblock %}
</h1>
{% include 'dashboard/includes/breadcrumb.html' %}
</section>

<!-- Main content -->
Expand Down
3 changes: 1 addition & 2 deletions realestate/templates/dashboard/create-agent.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{% extends "dashboard/base.html" %}
{% extends "dashboard/form_base.html" %}
{% load i18n static %}
{% block extra_css %}
<link href="{% static 'admin/css/editForms.css" rel="stylesheet" type="text/css' %}"/>
{% endblock %}
{% block content-header %}
<h1>{% trans "Create Agent" %} </h1>
Expand Down
49 changes: 6 additions & 43 deletions realestate/templates/dashboard/create-listing-step1.html
Original file line number Diff line number Diff line change
@@ -1,52 +1,15 @@
{% extends "dashboard/base.html" %}
{% extends "dashboard/form_base.html" %}
{% load i18n static widget_tweaks %}

{% block content-header %}
<h1>{% trans "Create Listing" %} </h1>
{% endblock %}
{% block extra_css %}
<style>
.empty-form {
display: none
}

.box-body .row {
margin-bottom: 15px;
}

.plus-row {
padding-top: 30px;
}
</style>
<link href="{% static 'bower_components/bootstrap-modal/css/bootstrap-modal-bs3patch.css' %}" rel="stylesheet"
type="text/css"/>
<link href="{% static 'bower_components/bootstrap-modal/css/bootstrap-modal.css' %}" rel="stylesheet"
type="text/css"/>
{% endblock %}
{% block extra_metadata %}
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script src="{% static 'admin/js/listing-map.js' %}" type="text/javascript"></script>
{% endblock %}
{% block extra_js %}
<script src="{% static 'bower_components/bootstrap-modal/js/bootstrap-modalmanager.js' %}"
type="text/javascript"></script>
<script src="{% static 'bower_components/bootstrap-modal/js/bootstrap-modal.js' %}" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var $modal = $('#ajax-modal');
$('.add-modal').on('click', function (e) {
e.preventDefault();
var url = $(this).attr("href");
// create the backdrop and wait for next modal to be triggered
$('body').modalmanager('loading');
setTimeout(function () {
$modal.load(url + ' #create-form', '', function () {
$modal.modal();
});
}, 1000);
});
});
</script>
{% endblock %}

{% block content %}
<form role="form" action="" method="post">
<div class="row">
Expand Down Expand Up @@ -76,7 +39,7 @@ <h3 class="box-title">{% trans "Listing Information" %}</h3>
<div class="row">
<div class="col-xs-6 {% if form.location.errors %}has-error{% endif %}">
{{ form.location.errors }}
{{ form.location.label_tag }} {% render_field form.location class+="form-control" %}
{{ form.location.label_tag }} {% render_field form.location class+="form-control chosen-select" %}
</div>
<div class="col-xs-1 plus-row">
<a href="{% url 'add-sector' %}" class="add-modal">
Expand Down Expand Up @@ -136,7 +99,7 @@ <h3 class="box-title">{% trans "Listing Information" %}</h3>
<div class="row">
<div class="col-xs-7 {% if form.agent.errors %}has-error{% endif %}">
{{ form.agent.errors }}
{{ form.agent.label_tag }} {% render_field form.agent class+="form-control" %}
{{ form.agent.label_tag }} {% render_field form.agent class+="form-control chosen-select" %}
</div>
<div class="col-xs-1 plus-row">
<a href="{% url 'add-agent' %}"><i class="fa fa-fw fa-plus"></i></a>
Expand All @@ -145,7 +108,7 @@ <h3 class="box-title">{% trans "Listing Information" %}</h3>
<div class="row">
<div class="col-xs-7 {% if form.contact.errors %}has-error{% endif %}">
{{ form.contact.errors }}
{{ form.contact.label_tag }} {% render_field form.contact class+="form-control" %}
{{ form.contact.label_tag }} {% render_field form.contact class+="form-control chosen-select" %}
</div>
<div class="col-xs-1 plus-row">
<a href="{% url 'add-contact' %}"><i class="fa fa-fw fa-plus"></i></a>
Expand Down
18 changes: 2 additions & 16 deletions realestate/templates/dashboard/create-listing-step2.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
{% extends "dashboard/base.html" %}
{% extends "dashboard/form_base.html" %}
{% load i18n static widget_tweaks %}
{% block content-header %}
<h1>{% trans "Create Listing " %} </h1>
{% endblock %}
{% block extra_css %}
<style>
.empty-form {
display: none
}

.box-body .row {
margin-bottom: 15px;
}

.plus-row {
padding-top: 30px;
}
</style>
{% endblock %}

{% block extra_js %}
{{ block.super }}
<script src="{% static 'bower_components/django-superformset/django-superformset.js' %}" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
Expand Down
46 changes: 46 additions & 0 deletions realestate/templates/dashboard/form_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{% extends "dashboard/base.html" %}
{% load i18n static %}
{% block extra_css %}
<style>
.empty-form {
display: none
}

.box-body .row {
margin-bottom: 15px;
}

.plus-row {
padding-top: 30px;
}
</style>
<link href="{% static 'bower_components/bootstrap-modal/css/bootstrap-modal-bs3patch.css' %}" rel="stylesheet" type="text/css"/>
<link href="{% static 'bower_components/bootstrap-modal/css/bootstrap-modal.css' %}" rel="stylesheet" type="text/css"/>
<link href="{% static 'bower_components/chosen/chosen.min.css' %}" rel="stylesheet" />
<link href="{% static 'admin/css/editForms.css" rel="stylesheet" type="text/css' %}"/>
{% endblock %}
{% block extra_js %}
<script src="{% static 'bower_components/bootstrap-modal/js/bootstrap-modalmanager.js' %}" type="text/javascript"></script>
<script src="{% static 'bower_components/bootstrap-modal/js/bootstrap-modal.js' %}" type="text/javascript"></script>
<script type="text/javascript" src="{% static 'bower_components/chosen/chosen.jquery.min.js' %}"></script>
<script type="text/javascript">
$(document).ready(function () {
// Chosen
$('.chosen-select').chosen();

var $modal = $('#ajax-modal');
$('.add-modal').on('click', function (e) {
e.preventDefault();
var url = $(this).attr("href");
// create the backdrop and wait for next modal to be triggered
$('body').modalmanager('loading');
setTimeout(function () {
$modal.load(url + ' #create-form', '', function () {
$modal.modal();
});
}, 1000);
});

});
</script>
{% endblock %}
4 changes: 0 additions & 4 deletions realestate/templates/dashboard/includes/breadcrumb.html

This file was deleted.

0 comments on commit de70bed

Please sign in to comment.