forked from dcbriccetti/bird-show
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a953a3
commit 49cf650
Showing
7 changed files
with
136 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package birdshow.snippet | ||
|
||
import xml.NodeSeq | ||
import net.liftweb.util.Helpers._ | ||
import birdshow.model.Flickr | ||
|
||
class Home { | ||
def home(content: NodeSeq) = bind("home", content, | ||
"randomUrl" -> <img src={Flickr.getRandomHomePhotoUrl}/>) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package birdshow.snippet | ||
|
||
import xml.{Node, NodeSeq} | ||
import net.liftweb.util.Helpers._ | ||
import birdshow.util.Group | ||
import birdshow.model.Flickr | ||
import birdshow.model.flickr.PictureIdAndSizes | ||
|
||
trait PhotoRows { | ||
type PicAndSizes = Tuple2[Node, PictureIdAndSizes] | ||
|
||
def bindPhotoRows[T](content: NodeSeq, photos: Seq[T], | ||
img: (Option[T]) => NodeSeq, title: (Option[T]) => String) = | ||
Group.group(photos).flatMap(g => | ||
bind("item", chooseTemplate("gal", "photoRows", content), | ||
"img1" -> img (g._1), | ||
"title1" -> title(g._1), | ||
"img2" -> img (g._2), | ||
"title2" -> title(g._2), | ||
"img3" -> img (g._3), | ||
"title3" -> title(g._3))) | ||
|
||
protected def pImg(photoAndSize: Option[PicAndSizes]): NodeSeq = photoAndSize match { | ||
case Some((photo, pictureIdAndSizes)) => | ||
<a href="#"> | ||
<img onclick={"BIRDSHOW.showBig('" + pictureIdAndSizes.getPreferredSizeUrl + "'); return false;"} | ||
src={pictureIdAndSizes.getSmallSizeUrl}/> | ||
</a> | ||
case None => <p/> | ||
} | ||
|
||
protected def pTitle(photoSet: Option[PicAndSizes]): String = photoSet match { | ||
case Some(ps) => (ps._1 \ "@title").text | ||
case None => "" | ||
} | ||
|
||
protected def psAnchor(photoSet: Option[Node]): NodeSeq = photoSet match { | ||
case Some(ps) => | ||
<a href={"?id=" + ((ps \ "@id").text)}><img src={Flickr.url(ps, "primary", "_m")}/></a> | ||
case None => <p/> | ||
} | ||
|
||
protected def psTitle(photoSet: Option[Node]): String = photoSet match { | ||
case Some(ps) => (ps \ "title").text | ||
case None => "" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package birdshow.snippet | ||
|
||
import net.liftweb.util.Helpers._ | ||
import xml.NodeSeq | ||
import birdshow.model.Flickr | ||
import birdshow.util.Loggable | ||
|
||
class Shows extends Loggable with PhotoRows { | ||
|
||
def showShowPictures(content: NodeSeq): NodeSeq = { | ||
def pImg(photoAndSize: Option[PicAndSizes]): NodeSeq = photoAndSize match { | ||
case Some((photo, pictureIdAndSizes)) => <img src={pictureIdAndSizes.getSmallSizeUrl}/> | ||
case None => <span/> | ||
} | ||
|
||
bind("gal", content, | ||
"photoRows" -> bindPhotoRows(content, Flickr.getSetPhotosAndSizes(Flickr.getUser.showSetId), | ||
pImg, pTitle)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
<lift:surround with="default" at="content"> | ||
|
||
<p>Eleanor’s slide presentations are always enthusiastically and warmly received by audiences. | ||
They are interesting, informative, and often infused with a touch of humor. | ||
Shows usually last about an hour, and the subjects are chosen from the following:</p> | ||
|
||
<lift:Pictures.showShowPictures> | ||
<lift:Shows.showShowPictures> | ||
<table class="photos"> | ||
<gal:galleries> | ||
<photo:list> | ||
<tr> | ||
<td> | ||
<item:img1/> | ||
<div class="title"> | ||
<item:title1/> | ||
</div> | ||
</td> | ||
<td> | ||
<item:img2/> | ||
<div class="title"> | ||
<item:title2/> | ||
</div> | ||
</td> | ||
<td> | ||
<item:img3/> | ||
<div class="title"> | ||
<item:title3/> | ||
</div> | ||
</td> | ||
</tr> | ||
</photo:list> | ||
</gal:galleries> | ||
<gal:photoRows> | ||
<tr> | ||
<td> | ||
<item:img1/> | ||
<div class="title"> | ||
<item:title1/> | ||
</div> | ||
</td> | ||
<td> | ||
<item:img2/> | ||
<div class="title"> | ||
<item:title2/> | ||
</div> | ||
</td> | ||
<td> | ||
<item:img3/> | ||
<div class="title"> | ||
<item:title3/> | ||
</div> | ||
</td> | ||
</tr> | ||
</gal:photoRows> | ||
</table> | ||
</lift:Pictures.showShowPictures> | ||
</lift:Shows.showShowPictures> | ||
|
||
<p>Additional shows include Birds & Bears of Churchill and The Adventures of a Wildlife Photographer. | ||
To schedule a program please email <a href="mailto:eb@briccettiphoto.com">eb@briccettiphoto.com</a>.</p> | ||
|
||
To schedule a program please email <a href="mailto:eb@briccettiphoto.com">eb@briccettiphoto.com</a>. | ||
</p> | ||
|
||
</lift:surround> |