Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes #4138, implemented the dynamic gallery JS using SlideJS

Fixes #4139, implemented dynamic who uses gallery using SlideJS

Fixes #4348, added pagoda box logo to the footer of all site pages
  • Loading branch information...
commit c2b2365d6acfab460e3c41b385289fe62d9d62bb 1 parent 170550a
Sam de Freyssinet samsoir authored
3  .gitmodules
View
@@ -13,3 +13,6 @@
[submodule "modules/kostache"]
path = modules/kostache
url = https://github.com/zombor/KOstache.git
+[submodule "modules/gallery/vendor/slides"]
+ path = modules/gallery/vendor/slides
+ url = git://github.com/nathansearles/Slides.git
47 application/templates/home/gallery.mustache
View
@@ -1,15 +1,40 @@
<section id="gallery" class="medBkg inset">
<h2>Gallery</h2>
-<!--<ul class="sliderNav">
- <li class="active"><a href="#">1</a></li>
- <li><a href="#">2</a></li>
- <li><a href="#">3</a></li>
- </ul>-->
- <div class="sliderContent">
- <ul>
- <li><a href="http://kids-myshot.nationalgeographic.com/"><img src="{{base_url}}assets/img/gallery/thumb/national-geographic-kids.jpg" width="200" height="169" alt="Your shots: National Geographic Kids" /></a></li>
- <li><a href="http://www.sittercity.com/"><img src="{{base_url}}assets/img/gallery/thumb/sittercity.jpg" width="200" height="169" alt="Sittercity" /></a></li>
- <li><a href="http://mukuru.com/"><img src="{{base_url}}assets/img/gallery/thumb/mukuru.jpg" width="200" height="169" alt="Mukuru.com" /></a></li>
- </ul>
+ <div class="sliderContent" id="galleryContainer">
+ <div>
+ <div class="information">
+ <h3>Sittercity</h3>
+ <a href="http://www.sittercity.com">www.sittercity.com</a>
+ </div>
+ <img src="/assets/img/gallery/sittercity.jpg" alt="sittercity" />
+ </div>
+ <div>
+ <div class="information">
+ <h3>Couch Surfing</h3>
+ <a href="http://www.couchsurfing.org">www.couchsurfing.org</a>
+ </div>
+ <img src="/assets/img/gallery/couchsurfing.jpg" alt="Couch Surfing web site" />
+ </div>
+ <div>
+ <div class="information">
+ <h3>We Pay</h3>
+ <a href="http://www.wepay.com">www.wepay.com</a>
+ </div>
+ <img src="/assets/img/gallery/wepay.jpg" alt="We Pay website" />
+ </div>
+ <div>
+ <div class="information">
+ <h3>Mukuru</h3>
+ <a href="http://www.mukuru.com">www.mukuru.com</a>
+ </div>
+ <img src="/assets/img/gallery/mukuru.jpg" alt="Mukuru website" />
+ </div>
+ <div>
+ <div class="information">
+ <h3>National Geographic Kids</h3>
+ <a href="http://kids-myshot.nationalgeographic.com/">http://kids-myshot.nationalgeographic.com/</a>
+ </div>
+ <img src="/assets/img/gallery/nationalgeographic.jpg" alt="National Geographic Kids My-Shot website" />
+ </div>
</div>
</section> <!-- END section#gallery -->
13 application/templates/home/whouses.mustache
View
@@ -1,10 +1,11 @@
<section id="who" class="darkBkg inset">
<h2>Who uses Kohana?</h2>
- <ul>
- <li><img src="{{base_url}}assets/img/whoSittercity.png" width="110" height="33" alt="Sittercity" /></li>
- <li><img src="{{base_url}}assets/img/whoKohort.png" width="110" height="28" alt="Kohort" /></li>
- <li><img src="{{base_url}}assets/img/whoNationalGeographic.png" width="110" height="33" alt="National Geographic" /></li>
- <li><img src="{{base_url}}assets/img/whoMukuru.png" width="110" height="23" alt="Mukuru.com" /></li>
- </ul>
+ <div id="whoGallery">
+ <img src="{{base_url}}assets/img/gallery/logos/sittercity.png" width="280" height="100" alt="Sittercity" />
+ <img src="{{base_url}}assets/img/gallery/logos/couchsurfing.png" width="280" height="100" alt="Couch Surfing" />
+ <img src="{{base_url}}assets/img/gallery/logos/wepay.png" width="280" height="100" alt="We Pay" />
+ <img src="{{base_url}}assets/img/gallery/logos/mukuru.png" width="280" height="100" alt="Mukuru" />
+ <img src="{{base_url}}assets/img/gallery/logos/nationalgeographic.png" width="280" height="100" alt="National Geographic" />
+ </div>
<p>These are some of the people already using Kohana. <a href="http://forum.kohanaframework.org">See more on the Forums.</a></p>
</section> <!-- END section#who -->
6 application/templates/layout.mustache
View
@@ -47,6 +47,10 @@
</div> <!-- END div.container -->
+ <div id="pagodabox">
+ <a href="http://www.pagodabox.com">Powered by Pagoda Box, PHP as a Service</a>
+ </div>
+
</div> <!-- END div.wrapper -->
<!-- Javascript at the bottom for fast page loading -->
@@ -54,7 +58,9 @@
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/lib/jquery-1.6.2.js"%3E%3C/script%3E'))</script>
+<script src="{{base_url}}assets/js/lib/slides.js"></script>
<script src="{{base_url}}assets/js/global.js"></script>
+<script src="{{base_url}}assets/js/gallery.js"></script>
<!--[if lt IE 7 ]>
<script src="{{base_url}}assets/js/lib/dd_belatedpng.js"></script>
2  application/templates/partials/footer.mustache
View
@@ -3,4 +3,4 @@
<a href="{{team_url}}">Kohana Team</a>. Kohana is
<a href="{{license_url}}">licensed</a> under the BSD License.
<small>Powered by Kohana v{{kohana_version}} "{{kohana_codename}}"</small>
-</p>
+</p>
130 modules/gallery/classes/controller/gallery.php
View
@@ -0,0 +1,130 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+class Controller_Gallery extends Controller {
+
+ /**
+ * @var array
+ */
+ protected $_accept_format = 'application/json';
+
+ /**
+ * @var array
+ */
+ protected $_acceptable = array(
+ 'text/html',
+ 'application/json'
+ );
+
+ /**
+ * @var array
+ */
+ protected $_data = array();
+
+ /**
+ * @var integer
+ */
+ protected $_limit = NULL;
+
+ /**
+ * @var integer
+ */
+ protected $_offset = NULL;
+
+ /**
+ * Ensures the request is valid
+ *
+ * @return void
+ */
+ public function before()
+ {
+ if ($this->request->method() !== HTTP_Request::GET)
+ {
+ throw new HTTP_Exception_405;
+ }
+
+ $this->_accept_format =
+ $this->request
+ ->headers()
+ ->preferred_accept($this->_acceptable);
+
+ }
+
+ /**
+ * Returns the gallery images.
+ *
+ * @return void
+ */
+ public function action_index()
+ {
+ $this->_limit = $this->request->query('limit', NULL);
+ $this->_offset = $this->request->query('offset', NULL);
+
+ $this->_data = new Model_Gallery;
+ }
+
+ /**
+ * Renders the output in the correct format
+ *
+ * @return void
+ */
+ public function after()
+ {
+ $data = $this->_data->get_exhibits($limit, $offset);
+
+ if ($this->_accept_format === 'application/json')
+ {
+ $total = $this->_data->count();
+
+ $this->response->body(
+ $this->_create_json_response(
+ 'exhibit',
+ $data,
+ $this->_limit,
+ $this->_offset,
+ $total
+ )
+ )
+ }
+ else
+ {
+ $view =
+ }
+
+ $this->response->headers('content-type', $this->_accept_format);
+ }
+
+ /**
+ * Takes the entity and data and returns a json response
+ *
+ * @param string $entity Entity to encode
+ * @param array $data Data to encode with entity
+ * @param integer $limit Limit applied to result
+ * @param integer $offset Offset applied to result
+ * @param integer $total Total number of results of limit/offset omitted
+ * @return string
+ */
+ protected function _create_json_response(
+ $entity,
+ array $data,
+ $limit = NULL,
+ $offset = NULL,
+ $total = NULL
+ )
+ {
+ if ($total === NULL)
+ {
+ $total = count($data);
+ }
+
+ $json = new stdClass;
+ $json->entity = $entity;
+ $json->total = $total;
+ $json->offset = $offset;
+ $json->limit = $limit;
+ $json->results = count($data);
+ $json->payload = $data;
+
+ return json_encode($json, JSON_NUMERIC_CHECK);
+ }
+
+} // Controller_Gallery
94 modules/gallery/classes/model/gallery.php
View
@@ -0,0 +1,94 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+/**
+ * The Kohana_HTTP_Header class provides an Object-Orientated interface
+ * to HTTP headers. This can parse header arrays returned from the
+ * PHP functions `apache_request_headers()` or the `http_parse_headers()`
+ * function available within the PECL HTTP library.
+ *
+ * @package Kohana Website
+ * @category Gallery
+ * @author Kohana Team
+ * @copyright (c) 2008-2011 Kohana Team
+ * @license http://kohanaframework.org/license
+ */
+class Model_Gallery implements Countable {
+
+ /**
+ * @var array exhibits for the gallery
+ */
+ protected $_gallery_exhibits = array();
+
+ /**
+ * Constructor to allow injection of data
+ *
+ * @param array $exhibits Exhibits to set to the model
+ */
+ public function __construct(array $exhibits = NULL)
+ {
+ if ($exhibits !== NULL)
+ {
+ $this->set_exhibits($exhibits)
+ }
+ else
+ {
+ $this->set_exhibits(Kohana::$config->load('gallery'));
+ }
+ }
+
+ /**
+ * Implements the Countable interface
+ *
+ * @return integer
+ */
+ public function count()
+ {
+ return count($this->get_exhibits());
+ }
+
+ /**
+ * Set exhibits to this model.
+ *
+ * @param array $exhibits Exhibits to set
+ * @param string $replace Replace all exhibits with the array
+ * @return void
+ */
+ public function set_exhibits(array $exhibits, $replace = FALSE)
+ {
+ if ($replace === TRUE)
+ {
+ $this->_gallery_exhibits = $exhibits;
+ }
+ else
+ {
+ $this->_gallery_exhibits =
+ Arr::merge($this->get_exhibits(), $exhibits);
+ }
+ }
+
+ /**
+ * Returns the exhibits, either all or limited and offsetted.
+ *
+ * @return array
+ */
+ public function get_exhibits($limit = NULL, $offset = NULL)
+ {
+ if ($limit === NULL AND $offset === NULL)
+ {
+ return $this->_gallery_exhibits;
+ }
+
+ $result = $this->_gallery_exhibits;
+
+ if ($offset !== NULL)
+ {
+ $result = array_slice($result, (int) $offset, $limit, TRUE);
+ }
+ elseif ($limit !== NULL)
+ {
+ $result = array_slice($result, 0, (int) $limit, TRUE);
+ }
+
+ return $result;
+ }
+
+} // End Model_Gallery
20 modules/gallery/config/gallery.php
View
@@ -0,0 +1,20 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+return array(
+ array(
+ 'title' => 'Your shots: National Geographic Kids',
+ 'url' => 'http://kids-myshot.nationalgeographic.com',
+ 'src' => 'national-geographic-kids.jpg'
+ ),
+ array(
+ 'title' => 'Sittercity',
+ 'url' => 'http://www.sittercity.com',
+ 'src' => 'sittercity.jpg'
+ ),
+ array(
+ 'title' => 'Mukuru.com',
+ 'url' => 'http://mukuru.com',
+ 'src' => 'mukuru.jpg'
+ ),
+ // And many more to come
+)
1  modules/gallery/vendor/slides
@@ -0,0 +1 @@
+Subproject commit f90289a98c7d63654ce3edd0ca6dc62d3130e50e
39 public/assets/css/style.css
View
@@ -131,9 +131,8 @@ footer { padding:17px 20px; }
.container>section:first-child { min-height:320px; }
/* Homepage boxes */
-#who, #gallery { height:220px; }
-#who { width:280px; float:left; }
-#gallery { width:620px; float:right; position:relative; }
+#who { height: 220px; width:280px; float:left; }
+#gallery { height:254px; width:660px; float:right; position:relative; overflow: hidden; }
#social { clear:both; }
#community { width:700px; float:left; }
#giving { width:200px; float:right; }
@@ -277,15 +276,21 @@ Lists: Features (Homepage)
/*
Lists: Who (Homepage)
*/
-#who ul { margin:0; overflow:hidden; }
-#who li { list-style:none; display:inline; margin:0 9px; }
-#who img { vertical-align:middle; margin-bottom:17px; }
+#who div#whoGallery { margin:0; overflow:hidden; width: 280px; height: 100px }
+#who img { vertical-align:middle; padding-bottom:40px; }
+#who p { margin-top: 20px }
#who a:link, #who a:visited { color:#e7da49; }
/*
Lists: Gallery (Homepage)
*/
+#gallery { padding: 0px; margin: 0px; }
+#gallery h2 { display: block; overflow: hidden; height: 0; width: 0; padding: 0; margin: 0 }
+#gallery div.information { position: absolute; display: block; background: rgba(20,40,20,0.6); width: 635px; top: 255px; height: 50px; padding-left: 25px; padding-top: 25px; padding-bottom: 0px; }
+#gallery .information h3 { padding: 0; margin: 0; font-size: 25px; float: left }
+#gallery .information a { color: rgb(210, 220, 190); float: left; margin: 10px; font:italic 14px Georgia, "Times New Roman", Times, serif; font-weight: 100; }
+#gallery .information a:hover { text-decoration: none;}
.sliderContent ul { margin:0; }
.sliderContent li { float:left; width:200px; height:168px; /* When tweaking the height to accommodate taller screengrabs, make sure to also edit the height of both #who and #gallery containers */ overflow:hidden; list-style:none; -moz-box-shadow:0 3px 2px rgba(0,0,0,.3); margin-right:10px; }
.sliderContent li:last-child { margin-right:0; }
@@ -482,4 +487,26 @@ div.notice-success {
}
/*
* END Notices
+ */
+
+/*
+ * Pagodabox
+ */
+div#pagodabox {
+ height: 100px;
+}
+
+div#pagodabox a {
+ display: block;
+ overflow: hidden;
+ background: url(../img/pagodaFloat.png) no-repeat;
+ width: 104px;
+ height: 0px;
+ padding-top: 54px;
+ margin-top: 25px;
+ float: right;
+}
+
+/*
+ * END Pagodabox
*/
BIN  public/assets/img/gallery/couchsurfing.jpg
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/gallery/logos/couchsurfing.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/gallery/logos/mukuru.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/gallery/logos/nationalgeographic.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/gallery/logos/sittercity.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/gallery/logos/wepay.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/gallery/mukuru.jpg
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/gallery/nationalgeographic.jpg
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/gallery/sittercity.jpg
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/gallery/wepay.jpg
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/assets/img/pagodaFloat.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 public/assets/js/gallery.js
View
@@ -0,0 +1,50 @@
+// Document javascript
+
+$(document).ready(function() {
+
+ $("#galleryContainer").mouseenter(function(event) {
+
+ var text = $(event.target).parent().closest();
+
+ $(text).animate({
+ top: "180px"
+ }, 300);;
+
+ $("#gallery div.information").animate({
+ top: "180px"
+ }, 300);
+ });
+
+ $("#galleryContainer").mouseleave(function() {
+ $("#gallery div.information").animate({
+ top: "255px"
+ }, 300);
+ });
+
+ $("#galleryContainer").slides({
+ playInterval: 10000,
+ effect: 'slide',
+ navigation: false,
+ pagination: false,
+ slide: {
+ browserWindow: false,
+ interval: 600
+ },
+ container: "sliderContent"
+ });
+
+ $("#whoGallery").slides({
+ playInterval: 10000,
+ effect: 'slide',
+ navigation: false,
+ pagination: false,
+ slide: {
+ browserWindow: false,
+ interval: 600
+ }
+ });
+
+ $("#galleryContainer").slides("play");
+ $("#whoGallery").slides("play");
+
+});
1  public/assets/js/lib/slides.js
View
Please sign in to comment.
Something went wrong with that request. Please try again.