From ab313d2967d6c22b5bf65ae062799d9de727ba73 Mon Sep 17 00:00:00 2001 From: Sanj Date: Wed, 5 Oct 2011 16:02:26 +0530 Subject: [PATCH] projects come from back-end --- urbstudio/settings.py | 2 ++ urbstudio/templates/projects.html | 50 ++++++++++++++++++++++++------- urbstudio/urb/models.py | 22 ++++++++++++++ urbstudio/urb/views.py | 15 ++++++++-- urbstudio/urls.py | 1 + 5 files changed, 78 insertions(+), 12 deletions(-) diff --git a/urbstudio/settings.py b/urbstudio/settings.py index f789976..052aec5 100644 --- a/urbstudio/settings.py +++ b/urbstudio/settings.py @@ -7,6 +7,7 @@ PROJECT_ROOT = os.path.dirname(__file__) LOCAL_DEVELOPMENT = True DEBUG = True TEMPLATE_DEBUG = DEBUG +JSON_DEBUG = True ADMINS = ( # ('Your Name', 'your_email@domain.com'), @@ -98,6 +99,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'urb', 'django_extensions', + 'sorl.thumbnail', # Uncomment the next line to enable the admin: # 'django.contrib.admin', # Uncomment the next line to enable admin documentation: diff --git a/urbstudio/templates/projects.html b/urbstudio/templates/projects.html index 0724ada..01c4e15 100644 --- a/urbstudio/templates/projects.html +++ b/urbstudio/templates/projects.html @@ -18,7 +18,31 @@ pause: 4000, hoverPause: true }); + + $('.projectThumb').click(function() { +// alert("hi"); + var $this = $(this); + if ($this.hasClass("selected")) { + return false; + } + $('.selected').removeClass("selected"); + $this.addClass("selected"); + var project_id = $this.attr("data-id"); + $.getJSON("project_json", {'id': project_id}, function(data) { + $('#projectTitle').next().text(data.title); + $('#projectSizeProgram').next().html(nl2br(data.size_program)); + $('#projectDesignStatement').next().html(nl2br(data.design_statement)); + $('#projectExtraText').next().html(nl2br(data.extra_text)); + }); + }); + }); + + + + function nl2br(str) { + return str.replace("\n", "
"); + }