Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
3  footing.php
View
@@ -1,6 +1,7 @@
<footer>
<div class="footer clear">
- <?php bloginfo('name'); ?> is proudly powered by <a href="http://wordpress.org/">WordPress</a> <a href="<?php bloginfo('rss2_url'); ?>">RSS Feed</a>.
+ <!--
+ <?php bloginfo('name'); ?> is proudly powered by <a href="http://wordpress.org/">WordPress</a> <a href="<?php bloginfo('rss2_url'); ?>">RSS Feed</a>. -->
<?php if(current_user_can('level_10')) { echo get_num_queries(),' queries in ', timer_stop(0), ' seconds'; } ?>
</div>
</footer>
BIN  images/furley_bg.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 js/write.js
View
@@ -1,47 +1,63 @@
define(['jquery',
'route'
],
- function($, route, page){
+ function($, route) {
- function fetchGallery(options) {
- console.log('fetchGallery', options);
- // TODO: set loading here
- var data = {
- page: 1,
- per_page: 16
- };
- var url;
- if ('query' in options) {
- data.tags = options.query;
- url = '/photoSearch/';
- } else if ('user_id' in options) {
- data.user_id = options.user_id;
- url = '/photoSearchPeople/';
- } else {
- console.log('error');
- return false;
- }
+ var galleryData = {};
+ var galleryUrl = '';
+
+ function fetchAnotherGallery(step) {
+ galleryData.page += step;
$.ajax({
- url: url,
- data: data,
+ url: galleryUrl,
+ data: galleryData,
dataType: 'jsonp',
jsonp: 'jsoncallback',
- success: function (data) {
- console.log('success!', data);
- $('#gallery').empty();
- $.each(data.photos.photo, function (index, photo) {
+ success: function (result) {
+ console.log('success!', result);
+ var p = result.photos;
+ var g = $('#gallery');
+ if (galleryData.page > 1) {
+ g.css('height', g.height() + 'px');
+ } else {
+ g.css('height', 'auto');
+ }
+ g.empty();
+ $.each(p.photo, function (index, photo) {
var url = '/photo' + photo.farm + '/' + photo.server + '/' + photo.id + '_' + photo.secret;
$('<a rel="gallery"></a>')
.append($('<img>').prop('src', url + '_s.jpg').prop('class', 'myThumbnail'))
.prop('href', url + '.jpg')
.prop('title', photo.title)
-
- .appendTo('#gallery');
- $('#gallery a').addClass('no-ajaxy');
+ .appendTo(g);
+ g.find('a').addClass('no-ajaxy');
});
+ $('#gallery-back').button(p.page > 1 ? 'enable' : 'disable');
+ $('#gallery-more').button(p.page < p.pages ? 'enable' : 'disable');
+
//TODO: clear loading here
}
});
+ }
+
+ function fetchGallery(options) {
+ console.log('fetchGallery', options);
+ // TODO: set loading here
+ galleryData = {
+ page: 1,
+ per_page: 16
+ };
+ if ('query' in options) {
+ galleryData.tags = options.query;
+ galleryUrl = '/photoSearch/';
+ } else if ('user_id' in options) {
+ galleryData.user_id = options.user_id;
+ galleryUrl = '/photoSearchPeople/';
+ } else {
+ console.log('error');
+ return false;
+ }
+ fetchAnotherGallery(0);
}
function writeInit(url, query) {
@@ -53,20 +69,27 @@ define(['jquery',
$('<link>', {
rel: 'stylesheet',
type: 'text/css',
- href: 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/south-street/jquery-ui.css',
+ href: 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css',
id: 'theme'
}).appendTo('head');
require(['jquery-ui', 'jquery.image-gallery'],
function() {
// TODO: Clear loading here
+ // Initialize the accordian look
+ $('.accordion').each(function(index, item) {
+ $(item).accordion({
+ collapsible: true,
+ active: false,
+ clearStyle: true }); });
+
// Initialize the Image Gallery widget:
$('#gallery').imagegallery({
buttons: {
"Add to book": function() { $(this).dialog("close"); },
- "Go back to gallery": function() { $(this).dialog("close"); },
- "Next picture": function() { $('#gallery').imagegallery('next'); },
- "Previous picture": function() { $('#gallery').imagegallery('prev'); }
+ "Go back to search": function() { $(this).dialog("close"); },
+ "Previous picture": function() { $('#gallery').imagegallery('prev'); },
+ "Next picture": function() { $('#gallery').imagegallery('next'); }
}
});
var $form = $page.find('form');
@@ -81,6 +104,19 @@ define(['jquery',
}
return false;
});
+
+ $('.accordion a:first').click();
+ $('.button', '#writing-controls').button().button('disable');
+ $('#gallery-back').click(function() {
+ fetchAnotherGallery(-1);
+ return false;
+ });
+ $('#gallery-more').click(function() {
+ fetchAnotherGallery(+1);
+ return false;
+ });
+
+ $('#writing-controls').css('visibility', 'visible');
});
}
4 style.scss
View
@@ -617,4 +617,8 @@ and (orientation: landscape) {
#gallery {
margin-top: 1em;
}
+
+ h3 a.spacer {
+ padding-left: 6.4em;
+ }
}
46 templates/write.mustache
View
@@ -0,0 +1,46 @@
+<noscript>
+<p>_(You must have Javascript enabled in order to write a book.)</p>
+</noscript>
+{{^loggedIn}}
+<p>_(You must be logged in, to write a book.)<a href="/login/">_(Log In|link label)</a></p>
+{{/loggedIn}}
+<div id="writing-controls">
+ <div class="accordion">
+ <h3><a href="#">_(Step 1: Find pictures at Flickr)</a></h3>
+ <div>
+ <form method="get" class="no-ajaxy">
+ <label for="write-image-search">_(Enter words to search Flickr.)</label>
+ <input type="search" name="query" id="write-image-search" />
+ <input type="submit" value="_(Search)" />
+ </form>
+ <div id="gallery"></div>
+ <a href="#" class="button no-ajaxy" id="gallery-back">Go back</a><a href="#" class="button no-ajaxy" id="gallery-more">More like these</a>
+ </div>
+ <h3><a href="#" class="spacer">_(Or upload your own pictures)</a></h3>
+ <div>
+ <form method="post" action="/upload-image/" class="no-ajaxy">
+ <label for="write-file-upload">_(Enter a filename.)</label>
+ <input type="file" name="imagefile" id="write-file-upload" />
+ <input type="submit" value="_(Upload)" />
+ </form>
+ </div>
+ </div>
+ <div class="accordion">
+ <h3><a href="#">_(Step 2: Add text to each page)</a></h3>
+ <div>
+ <p>Show the book pages here.</p>
+ </div>
+ </div>
+ <div class="accordion">
+ <h3><a href="#">_(Step 3: Fill in the details)</a></h3>
+ <div>
+ <p>Book settings like title, author, classification, language go here.</p>
+ </div>
+ </div>
+ <div class="accordion">
+ <h3><a href="#">_(Step 4: Publish)</a></h3>
+ <div>
+ <p>Buttons to publish, along with any things that need to be fixed before it will be enabled.</p>
+ </div>
+ </div>
+</div>
17 write.php
View
@@ -10,17 +10,10 @@
// get the id if any
$ID = getGet('id', '', '/[0-9]+/');
-?>
-<h1>Write a book</h1>
-<noscript>
- <p>You must have Javascript enabled in order to write a book.</p>
-</noscript>
-<p>Check to be sure they are logged in too</p>
-
-<form method="get" class="no-ajaxy">
- <input type="search" name="query" />
- <input type="submit" value="Search" />
-</form>
-<div id="gallery"></div>
+$view = array();
+$view['ID'] = $ID;
+$view['loggedIn'] = true;
+echo template_render('write', $view);
+?>
<?php thr_footer(false, true); ?>

No commit comments for this range

Something went wrong with that request. Please try again.