Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: nateabele/photoblog
base: master
...
head fork: gwoo/photoblog
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 18 files changed
  • 0 commit comments
  • 1 contributor
View
2  .gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+resources
View
9 .gitmodules
@@ -0,0 +1,9 @@
+[submodule "libraries/li3_geo"]
+ path = libraries/li3_geo
+ url = https://github.com/nateabele/li3_geo.git
+[submodule "libraries/lithium"]
+ path = libraries/lithium
+ url = https://github.com/UnionOfRAD/lithium.git
+[submodule "libraries/li3_behaviors"]
+ path = libraries/li3_behaviors
+ url = https://github.com/nateabele/li3_behaviors.git
View
16 config/bootstrap.php
@@ -7,14 +7,6 @@
*/
/**
- * This is the path to the class libraries used by your application, and must contain a copy of the
- * Lithium core. By default, this directory is named 'libraries', and resides in the same
- * directory as your application. If you use the same libraries in multiple applications, you can
- * set this to a shared path on your server.
- */
-define('LITHIUM_LIBRARY_PATH', dirname(dirname(__DIR__)) . '/libraries');
-
-/**
* This is the path to your application's directory. It contains all the sub-folders for your
* application's classes and files. You don't need to change this unless your webroot folder is
* stored outside of your app folder.
@@ -22,6 +14,14 @@
define('LITHIUM_APP_PATH', dirname(__DIR__));
/**
+ * This is the path to the class libraries used by your application, and must contain a copy of the
+ * Lithium core. By default, this directory is named 'libraries', and resides in the same
+ * directory as your application. If you use the same libraries in multiple applications, you can
+ * set this to a shared path on your server.
+ */
+define('LITHIUM_LIBRARY_PATH', LITHIUM_APP_PATH . '/libraries');
+
+/**
* Locate and load Lithium core library files. Throws a fatal error if the core can't be found.
* If your Lithium core directory is named something other than 'lithium', change the string below.
*/
View
1  config/bootstrap/libraries.php
@@ -24,5 +24,6 @@
* Add some plugins
*/
Libraries::add('li3_geo');
+Libraries::add('li3_behaviors');
?>
View
19 config/bootstrap/media.php
@@ -34,27 +34,8 @@
* plugin's `webroot` directory into your main application's `webroot` directory, or adding routing
* rules in your web server's configuration.
*/
-use lithium\action\Dispatcher;
-use lithium\core\Libraries;
use lithium\net\http\Media;
-Dispatcher::applyFilter('_callable', function($self, $params, $chain) {
- list($plugin, $asset) = explode('/', $params['request']->url, 2) + array("", "");
- if ($asset && $library = Libraries::get($plugin)) {
- $asset = "{$library['path']}/webroot/{$asset}";
-
- if (file_exists($asset)) {
- return function () use ($asset) {
- $info = pathinfo($asset);
- $type = Media::type($info['extension']);
- header("Content-type: {$type['content']}");
- return file_get_contents($asset);
- };
- }
- }
- return $chain->next($self, $params, $chain);
-});
-
Media::type('jpg', 'image/jpeg', array('cast' => false, 'encode' => function($data) {
return $data['photo']->file->getBytes();
}));
View
6 config/routes.php
@@ -9,12 +9,12 @@
use lithium\net\http\Router;
use lithium\core\Environment;
use lithium\action\Response;
-use photoblog\models\Photo;
+use photoblog\models\Photos;
-Router::connect('/photos/view/{:id:[0-9a-f]{24}}.jpg', array(), function($request) {
+Router::connect('/photos/view/{:id:[0-9a-f]{24}}.jpe', array(), function($request) {
return new Response(array(
'headers' => array('Content-type' => 'image/jpeg'),
- 'body' => Photo::first($request->id)->file->getBytes()
+ 'body' => Photos::first($request->id)->file->getBytes()
));
});
View
12 controllers/PhotosController.php
@@ -2,19 +2,19 @@
namespace photoblog\controllers;
-use photoblog\models\Photo;
+use photoblog\models\Photos;
use li3_geo\extensions\Geocoder;
class PhotosController extends \lithium\action\Controller {
public function index($tags = null) {
$conditions = $tags ? compact('tags') : array();
- $photos = Photo::all(compact('conditions'));
+ $photos = Photos::all(compact('conditions'));
return compact('photos');
}
public function view() {
- $photo = Photo::first($this->request->id);
+ $photo = Photos::first($this->request->id);
return compact('photo');
}
@@ -22,12 +22,12 @@ public function near($place = null) {
$this->_render['template'] = 'index';
$coords = Geocoder::find('google', $place);
- $photos = Photo::within(array($coords, $coords), array('limit' => 1));
+ $photos = Photos::within(array($coords, $coords), array('limit' => 1));
return compact('photos');
}
public function add() {
- $photo = Photo::create();
+ $photo = Photos::create();
if (($this->request->data) && $photo->save($this->request->data)) {
$this->redirect(array('Photos::view', 'id' => $photo->_id));
@@ -37,7 +37,7 @@ public function add() {
}
public function edit() {
- $photo = Photo::find($this->request->id);
+ $photo = Photos::find($this->request->id);
if (!$photo) {
$this->redirect('Photos::index');
1  libraries/li3_behaviors
@@ -0,0 +1 @@
+Subproject commit 659b347b6e171b44cb015d40fabad95c48bd9680
1  libraries/li3_geo
@@ -0,0 +1 @@
+Subproject commit 108e29c3088248b89b22bae8aaff3f9df4072d6a
1  libraries/lithium
@@ -0,0 +1 @@
+Subproject commit a0e3f7d6dc4932bb78091daca8caca3adf61847d
View
7 models/Photo.php → models/Photos.php
@@ -3,17 +3,14 @@
namespace photoblog\models;
use li3_geo\extensions\Geocoder;
-use li3_geo\extensions\data\behavior\Locatable;
-class Photo extends \li3_behaviors\extensions\Model {
+class Photos extends \li3_behaviors\extensions\Model {
public $validates = array();
protected $_meta = array('source' => 'fs.files');
- protected $_actsAs = array(
- 'Locatable' => array('fields' => array('location.latitude', 'location.longitude'))
- );
+ protected $_actsAs = array();
public function save($entity, $data = null, array $options = array()) {
if ($data) {
View
0  models/empty
No changes.
View
0  tests/cases/controllers/empty
No changes.
View
0  tests/cases/models/empty
No changes.
View
8 views/layouts/default.html.php
@@ -10,17 +10,17 @@
<html>
<head>
<?php echo $this->html->charset();?>
- <title>Application > <?php echo $this->title(); ?></title>
- <?php echo $this->html->style(array('debug', 'lithium')); ?>
+ <title>Photoblog > <?php echo $this->title(); ?></title>
+ <?php echo $this->html->style(array('debug', 'lithium', 'photoblog')); ?>
<?php echo $this->scripts(); ?>
<?php echo $this->html->link('Icon', null, array('type' => 'icon')); ?>
</head>
<body class="app">
<div id="container">
<div id="header">
- <h1>Application</h1>
+ <h1>Photoblog</h1>
<h2>
- Powered by <?php echo $this->html->link('Lithium', 'http://li3.rad-dev.org'); ?>.
+ Powered by <?php echo $this->html->link('Lithium', 'http://lithify.me'); ?>.
</h2>
</div>
<div id="content">
View
5 views/photos/index.html.php
@@ -1,8 +1,11 @@
+<?php $this->title('index')?>
<?php if (!count($photos)): ?>
<em>No photos</em>. <?=$this->html->link('Add one', 'Photos::add'); ?>.
<?php endif ?>
<?php foreach ($photos as $photo): ?>
- <?=$this->html->image("/photos/view/{$photo->_id}.jpg", array('width'=> 100)); ?>
+<div class="photo" style="width:120px;text-align:center;float:left">
+ <?=$this->html->image("/photos/view/{$photo->_id}.jpe", array('width'=> 100)); ?>
<?=$this->html->link($photo->title, array('Photos::view', 'id' => $photo->_id)); ?>
+</div>
<?php endforeach ?>
View
14 views/photos/view.html.php
@@ -1,9 +1,13 @@
-<h1><?=$photo->title; ?></h1>
+<h1>
+ <?=$this->title($photo->title); ?>
+ <em>[ <?=$this->html->link('edit', array('Photos::edit', 'id' => $photo->_id)); ?> ]</em>
+</h1>
<p><?=$photo->description; ?></p>
-<p><?=$this->html->link('Edit', array('Photos::edit', 'id' => $photo->_id)); ?></p>
-<?php foreach ($photo->tags as $tag): ?>
+<?php if ($photo->tags): echo 'tags:'; foreach ($photo->tags as $tag): ?>
<?=$this->html->link($tag, array('Photos::index', 'args' => array($tag))); ?>
-<?php endforeach ?>
+<?php endforeach; endif; ?>
-<?=$this->html->image("/photos/view/{$photo->_id}.jpg", array('alt' => $photo->title)); ?>
+<?=$this->html->image("/photos/view/{$photo->_id}.jpe", array(
+ 'alt' => $photo->title, 'width' => "100%"
+)); ?>
View
2  webroot/css/photoblog.css
@@ -0,0 +1,2 @@
+em {font-size: 12px;}
+.photo img {box-shadow: 4px 4px 8px #666; padding: 4px;margin: 4px;}

No commit comments for this range

Something went wrong with that request. Please try again.