Permalink
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...
samsoir committed Nov 29, 2011
1 parent 170550a commit c2b2365d6acfab460e3c41b385289fe62d9d62bb
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
@@ -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 -->
@@ -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 -->
@@ -47,14 +47,20 @@
</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 -->
<!-- Grab Google CDN's jQuery. fall back to local if necessary -->
<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>
@@ -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>
@@ -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
@@ -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
@@ -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
+)
Submodule slides added at f90289
Oops, something went wrong.

0 comments on commit c2b2365

Please sign in to comment.