From b33f70b34f206392b61c9805b55f39136e57c19f Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 7 Oct 2011 17:44:40 +0530 Subject: [PATCH] split projects.js to separate files, fix projects gallery --- urbstudio/static/js/projects.js | 54 +++++++++++++++++++++++++++++++ urbstudio/templates/projects.html | 43 +----------------------- 2 files changed, 55 insertions(+), 42 deletions(-) create mode 100644 urbstudio/static/js/projects.js diff --git a/urbstudio/static/js/projects.js b/urbstudio/static/js/projects.js new file mode 100644 index 0000000..3599e16 --- /dev/null +++ b/urbstudio/static/js/projects.js @@ -0,0 +1,54 @@ +$(function(){ + + + $('.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)); + if (data.extra_text == '') { + $('#projectExtraText').hide(); + $('#projectExtraText').next().hide(); + } else { + $('#projectExtraText').show().next().html(nl2br(data.extra_text)).show(); + } + $('.slidesInner').empty(); + for (var i=0; i').attr("href", "#"); + var $img = $('').attr("src", image.url).appendTo($a); + return $a; +} + +function activateSlides() { + $('#slidesDiv').slides({ + preload: true, + preloadImage: 'img/loading.gif', + pagination: false, //SANJ NOT WORKING + play: 5000, + pause: 4000, + hoverPause: true + }); +} + +function nl2br(str) { + return str.replace("\n", "
"); +} diff --git a/urbstudio/templates/projects.html b/urbstudio/templates/projects.html index 45158fe..d695538 100755 --- a/urbstudio/templates/projects.html +++ b/urbstudio/templates/projects.html @@ -15,48 +15,7 @@ - +