Permalink
Browse files

PermaBank #186 feedback

Add django_basic_feedback based feedback widget
(The css and js aren't supposed to be copied, but the site doesn't seem to be set up to do it the 'right way' with 'manage.py collectstatic')

XMLify some stuff in base.html
  • Loading branch information...
1 parent b9fd083 commit 7500fc90f78bcc96019b2c94561809bfac03bc0a @djudd djudd committed Feb 2, 2012
Showing with 110 additions and 12 deletions.
  1. +1 −0 admin_site.py
  2. +1 −0 requirements.txt
  3. +1 −0 settings/base.py
  4. +45 −0 static/feedback/feedback.css
  5. +42 −0 static/feedback/feedback.js
  6. +17 −12 templates/base.html
  7. +3 −0 urls.py
View
@@ -5,6 +5,7 @@
import profiles.admin
import records.admin
import snippets.admin
+import django_basic_feedback.admin
# wysiwyg editor for flatpages
from django.contrib import admin
View
@@ -6,6 +6,7 @@ django-grappelli
django-redis-cache
django-tinymce
django-taggit
+django-basic-feedback
epio
fabric
pil
View
@@ -126,6 +126,7 @@
'tinymce',
'haystack',
'taggit',
+ 'django_basic_feedback',
)
INSTALLED_APPS = EXTERNAL_APPS + PROJECT_APPS
@@ -0,0 +1,45 @@
+#feedback_widget
+{
+ position: fixed;
+ left: 0;
+ top: 10px;
+ z-index: 100;
+}
+#feedback_tab
+{
+ display: block;
+ width: 115px;
+ height: 115px;
+ transform: rotate(-90deg);
+ -webkit-transform: rotate(-90deg);
+ -moz-transform: rotate(-90deg);
+ -o-transform: rotate(-90deg);
+ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
+}
+#feedback_tab button
+{
+ height: 30px;
+ width: 95px;
+ padding-top: 3px;
+ padding-bottom: 8px;
+ padding-right: 10px;
+ padding-left: 10px;
+ border: 3px solid #333333;
+ font-weight: bold;
+ cursor: pointer;
+ background-color: #cccccc;
+}
+#feedback_tab button:hover
+{
+ background-color: #888888;
+}
+
+#feedback_panel
+{
+ display: none;
+ background-color: #cccccc;
+ padding: 10px;
+}
+#feedback_panel p label, #feedback_panel p textarea{
+ vertical-align: top;
+}
@@ -0,0 +1,42 @@
+var feedbackToggle;
+
+(function($){
+
+feedbackToggle = function(){
+ $('#feedback_tab, #feedback_panel').toggle();
+}
+
+$(document).ready(function(){
+ $('#feedback_tab button, #feedback_panel button').click(feedbackToggle);
+
+ $('#feedback_form').submit(function(e){
+ e.preventDefault();
+ var action = this.action;
+ //TODO: disable submit button until submit succeeds
+ $.ajax(action, {
+ 'type': 'POST',
+ 'data': $(this).serialize(),
+ 'success': function(data, textStatus, jqXHR){
+ alert("Your feedback has been successfully submitted, thank you.");
+ $("#feedback_panel form textarea").val("");
+ feedbackToggle();
+ },
+ 'error': function(jqXHR, textStatus, errorThrown){
+ if (jqXHR.status == 400)
+ {
+ var errors = "The following field error(s) ocurred: \n";
+ errors += jqXHR.responseText;
+ alert(errors);
+ }
+ else if(jqXHR.responseText != ''){
+ alert("The following error ocurred: \n"+jqXHR.responseText);
+ }
+ else{
+ alert('An unknown error occurred.');
+ }
+ }
+ });
+ });
+});
+
+})(jQuery);
View
@@ -2,6 +2,7 @@
{% load gravatar %}
{% load snippet %}
{% load inbox %}
+{% load feedback_widget %}
<!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="ie ie7 no-js" lang="en"> <![endif]-->
@@ -11,28 +12,30 @@
<!-- the "no-js" class is for Modernizr. -->
<head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>{% block title %}permabank{% endblock %}</title>
- <meta name="title" content="Permabank.cc">
- <meta name="description" content="@TODO">
- <meta name="author" content="Permabank">
- <meta name="copyright" content="@TODO">
+ <meta name="title" content="Permabank.cc" />
+ <meta name="description" content="@TODO" />
+ <meta name="author" content="Permabank" />
+ <meta name="copyright" content="@TODO" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta property="og:url" content="http://permabank.ep.io" />
<meta property="og:image" itemprop="image" content="@TODO" />
<meta property="og:site_name" content="Permabank.ep.io" />
<meta property="og:description" content="@TODO" />
- <link rel="apple-touch-icon" href="@TODO"> <!-- 114px x 114px for iPhone4's retina display. Name it apple-touch-icon-precomposed.png -->
- <link rel="canonical" href="http://permabank.ep.io">
+ <link rel="apple-touch-icon" href="@TODO" /> <!-- 114px x 114px for iPhone4's retina display. Name it apple-touch-icon-precomposed.png -->
+ <link rel="canonical" href="http://permabank.ep.io" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
- <link rel="stylesheet" href="/static/css/index.css">
+ <link rel="stylesheet" type="text/css" href="/static/css/index.css" />
+ <link rel="stylesheet" type="text/css" href="/static/feedback/feedback.css" />
{% block extracss %}{% endblock %}
- <script src="/static/js/jquery.js"></script>
- <script src="/static/js/nycga_ui.js"></script>
- <script src="/static/js/site.js"></script>
+ <script src="/static/js/jquery.js" type="text/javascript"></script>
+ <script src="/static/feedback/feedback.js" type="text/javascript"></script>
+ <script src="/static/js/nycga_ui.js" type="text/javascript"></script>
+ <script src="/static/js/site.js" type="text/javascript"></script>
{% block extrajs %}{% endblock %}
</head>
@@ -124,6 +127,8 @@ <h3 class="inline mll"><a href="/about/">Learn more</a></h3> {# todo: this is a
{% block footer %}
<footer class="grid_16 clearfix mtx">
+
+ {% feedback_widget %}
<p>&nbsp;</p>
View
@@ -40,6 +40,9 @@
# notification
#(r'^notification/', include('notification.urls')),
+ # feedback
+ (r'^feedback/', include('django_basic_feedback.urls')),
+
# records
url(r'', include('records.urls')),
)

0 comments on commit 7500fc9

Please sign in to comment.