-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from MicroPyramid/configurable_contact_us
added configurable contactus page settings issue #22
- Loading branch information
Showing
5 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
django_blog_it/django_blog_it/migrations/0009_contactussettings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.6 on 2016-06-01 08:34 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('django_blog_it', '0008_post_featured_image'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ContactUsSettings', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('from_email', models.EmailField(max_length=254)), | ||
('reply_to_email', models.EmailField(blank=True, max_length=254, null=True)), | ||
('email_admin', models.EmailField(max_length=254)), | ||
('subject', models.CharField(max_length=500)), | ||
('body_user', models.TextField()), | ||
('body_admin', models.TextField()), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
django_blog_it/django_blog_it/templates/dashboard/contact_us_settings.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{% extends 'dashboard/base.html' %} | ||
{% load staticfiles %} | ||
{% block title %} | ||
Configure Contact Us. | ||
{% endblock %} | ||
{% block extra_css %} | ||
{% endblock %} | ||
{% block content %} | ||
<div class="row" id="head_style"> | ||
<h3 id="page_title"></h3> | ||
</div> | ||
<div class="row"> | ||
<form action="" method="post" id="contact-us-configure-form" role="form"> | ||
{% csrf_token %} | ||
{% for field in form %} | ||
<div class="form-group"> | ||
<label>{{ field.label }} :</label> | ||
<div class="controls"> | ||
{{ field }} | ||
{% if field.help_text %} | ||
<p class="help-inline"><small>{{ field.help_text }}</small></p> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% endfor %} | ||
<div class="form-group"> | ||
<button class="btn btn-primary" type="submit">Submit</button> | ||
</div> | ||
</form> | ||
</div> | ||
<!-- end of add form div --> | ||
{% endblock %} | ||
{% block js_script %} | ||
|
||
<script type="text/javascript"> | ||
$(document).ready(function(){ | ||
|
||
// for form submission | ||
CKEDITOR.replace('body_user',{ | ||
filebrowserUploadUrl: '{% url "upload_photos" %}', | ||
filebrowserBrowseUrl: '{% url "recent_photos" %}' | ||
}); | ||
CKEDITOR.replace('body_admin',{ | ||
filebrowserUploadUrl: '{% url "upload_photos" %}', | ||
filebrowserBrowseUrl: '{% url "recent_photos" %}' | ||
}); | ||
}); | ||
|
||
$('#contact-us-configure-form').submit(function(event){ | ||
event.preventDefault(); | ||
$('#id_body_user').val(CKEDITOR.instances.id_body_user.getData()); | ||
$('#id_body_admin').val(CKEDITOR.instances.id_body_admin.getData()); | ||
$.post("",$('#contact-us-configure-form').serialize(), function(data){ | ||
if(data.error){ | ||
$('p.error_required').remove(); | ||
for (var key in data.response) { | ||
$('#id_' + key).after('<p class="error_required">* ' + data.response[key] + '</p>'); | ||
} | ||
}else{ | ||
//alert(data['response']); | ||
window.location='/dashboard/'; | ||
} | ||
}, 'json'); | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters