24ce70aa9934

Added support for photos to the projects app.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 19 Jan 2009 01:15:01 -0500
parents ed09fa884762
children 22afaf43eb5e
branches/tags (none)
files site-media/scripts/stevelosh-gallery.js site-media/style/gallery.css templates/feeds/comments_title.html templates/projects/base.html templates/projects/project.html

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/site-media/scripts/stevelosh-gallery.js	Mon Jan 19 01:15:01 2009 -0500
@@ -0,0 +1,29 @@
+$(function() {
+    $('div.gallery').each(function () {
+        $(this).contents().filter(function() {
+            return this.nodeType == Node.TEXT_NODE;
+        }).remove();
+        
+        var cols = 4;
+        var padding = 10;
+        var total_width = $(this).width();
+        var width = (total_width / cols) - 2 * padding;
+        $(this).find('img').css({width: width, margin: padding});
+        
+        $(this).before('<div class="gallery-pane"></div>');
+        $(this).find('img:first').clone()
+                                 .addClass('gallery-display')
+                                 .css({width: '', margin: ''})
+                                 .appendTo('div.gallery-pane');
+    });
+
+    $('div.gallery img').click(function() {
+        var new_image = $(this).clone()
+                               .addClass('gallery-display')
+                               .css({width: '', margin: '', display: 'none'});
+        $('img.gallery-display').fadeOut('fast', function() {
+            $(this).remove();
+            new_image.appendTo('div.gallery-pane').fadeIn('slow');
+        });
+    });
+});
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/site-media/style/gallery.css	Mon Jan 19 01:15:01 2009 -0500
@@ -0,0 +1,1 @@
+div.gallery-pane { text-align: center; margin-bottom: 10px; }
\ No newline at end of file
--- a/templates/feeds/comments_title.html	Fri Jan 16 18:11:37 2009 -0500
+++ b/templates/feeds/comments_title.html	Mon Jan 19 01:15:01 2009 -0500
@@ -1,1 +1,1 @@
-Comment on {% if obj.entry.title %}{{ obj.entry.title }}{% else %}{{ obj.project.name }}{% endif %} by {{ obj.name }}.
\ No newline at end of file
+Comment on {% if obj.entry.title %}{{ obj.entry.title }}{% else %}{{ obj.project.name }}{% endif %} by {{ obj.name }}
\ No newline at end of file
--- a/templates/projects/base.html	Fri Jan 16 18:11:37 2009 -0500
+++ b/templates/projects/base.html	Mon Jan 19 01:15:01 2009 -0500
@@ -5,6 +5,8 @@
 {% block style %}
 	<link rel="stylesheet" href="/site-media/style/projects.css" 
 		  type="text/css"/>
+	<link rel="stylesheet" href="/site-media/style/gallery.css" 
+		  type="text/css"/>
 	<link rel="stylesheet" href="/site-media/style/code.css" 
 		  type="text/css"/>
 {% endblock %}
--- a/templates/projects/project.html	Fri Jan 16 18:11:37 2009 -0500
+++ b/templates/projects/project.html	Mon Jan 19 01:15:01 2009 -0500
@@ -10,6 +10,9 @@
 	<script type="text/javascript"
 	        src="/site-media/scripts/validate-comment-form.js">
 	</script>
+	<script type="text/javascript"
+	        src="/site-media/scripts/stevelosh-gallery.js">
+	</script>
 {% endblock %}
 
 {% block content %}