css - moved left menu up
This commit is contained in:
parent
1d02bddbac
commit
2e4605071e
|
@ -7,5 +7,6 @@ urlpatterns = patterns('',
|
|||
#(r'^search/', include('solango.urls')),
|
||||
(r'^$', views.home),
|
||||
(r'^subscribe/$', views.subscribe),
|
||||
(r'^search/$', views.search),
|
||||
(r'^postfeedback/$', views.postfeedback)
|
||||
)
|
||||
|
|
|
@ -5,6 +5,8 @@ from settings import ERANG_SUBSCRIBE_URL
|
|||
import urllib2
|
||||
from django.http import HttpResponse
|
||||
from django.core.mail import send_mail
|
||||
from django.db.models import Q
|
||||
from oxdjango.shortcuts import render_to_json_response
|
||||
|
||||
def home(request):
|
||||
all_issues = Issue.objects.all().order_by('-date')
|
||||
|
@ -26,6 +28,20 @@ def subscribe(request):
|
|||
re = urllib2.urlopen(url).read()
|
||||
return HttpResponse(re)
|
||||
|
||||
def search(request):
|
||||
terms = request.GET['search']
|
||||
words = terms.split(" ")
|
||||
qset = Issue.objects.all()
|
||||
issues = []
|
||||
for w in words:
|
||||
qset = qset.filter(Q(title__icontains=w) | Q(summary__icontains=w))
|
||||
for issue in qset:
|
||||
issues.append({
|
||||
'id': issue.id,
|
||||
'title': issue.title,
|
||||
'summary': issue.summary,
|
||||
})
|
||||
return render_to_json_response(issues)
|
||||
|
||||
def postfeedback(request):
|
||||
p = request.POST
|
||||
|
|
|
@ -5,6 +5,8 @@ from os.path import join
|
|||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
JSON_DEBUG = DEBUG
|
||||
|
||||
LOCAL_DEVELOPMENT = True
|
||||
LOGGING_INTERCEPT_REDIRECTS = True
|
||||
LOGGING_LOG_SQL = True
|
||||
|
|
|
@ -29,7 +29,14 @@ $(document).ready(function() {
|
|||
$(document).ready(function() {
|
||||
$('#subscribeForm').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var email = $('#email').val();
|
||||
$('.validation').slideUp("fast");
|
||||
var $email = $('#email');
|
||||
var email = $email.val();
|
||||
if (!isRFC822ValidEmail(email)) {
|
||||
$('<div />').addClass('validation').html("Invalid Email Address").hide().insertAfter($email).slideDown("slow");
|
||||
// $email.append(html);
|
||||
return false;
|
||||
}
|
||||
$('#subscribeBtn').attr("disabled", "disabled").text("Subscribing...");
|
||||
$.post("/erang/subscribe/", {
|
||||
'email': email
|
||||
|
@ -59,6 +66,33 @@ $(document).ready(function() {
|
|||
});
|
||||
});
|
||||
|
||||
//from: http://rosskendall.com/blog/web/javascript-function-to-check-an-email-address-conforms-to-rfc822
|
||||
|
||||
function isRFC822ValidEmail(sEmail) {
|
||||
|
||||
var sQtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
|
||||
var sDtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
|
||||
var sAtom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';
|
||||
var sQuotedPair = '\\x5c[\\x00-\\x7f]';
|
||||
var sDomainLiteral = '\\x5b(' + sDtext + '|' + sQuotedPair + ')*\\x5d';
|
||||
var sQuotedString = '\\x22(' + sQtext + '|' + sQuotedPair + ')*\\x22';
|
||||
var sDomain_ref = sAtom;
|
||||
var sSubDomain = '(' + sDomain_ref + '|' + sDomainLiteral + ')';
|
||||
var sWord = '(' + sAtom + '|' + sQuotedString + ')';
|
||||
var sDomain = sSubDomain + '(\\x2e' + sSubDomain + ')*';
|
||||
var sLocalPart = sWord + '(\\x2e' + sWord + ')*';
|
||||
var sAddrSpec = sLocalPart + '\\x40' + sDomain; // complete RFC822 email address spec
|
||||
var sValidEmail = '^' + sAddrSpec + '$'; // as whole string
|
||||
|
||||
var reValidEmail = new RegExp(sValidEmail);
|
||||
|
||||
if (reValidEmail.test(sEmail)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
body {
|
||||
|
@ -68,7 +102,12 @@ $(document).ready(function() {
|
|||
#leftMenu {
|
||||
float: left;
|
||||
width: 200px;
|
||||
margin-top: 250px;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.validation {
|
||||
font-size: 12px;
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
|
|
Loading…
Reference in New Issue
Block a user