コード例 #1
0
 public static void index() {
   if (Gallery.count() > 0) {
     Gallery defaultGallery = Gallery.all().first();
     showGallery(defaultGallery.id, defaultGallery.name);
   } else {
     render();
   }
 }
コード例 #2
0
  public static void showGallery(Long id, String name) {
    notFoundIfNull(id);
    Gallery gallery = Gallery.findById(id);
    notFoundIfNull(gallery);

    List<Picture> pictures = gallery.getPictures();
    List<ImageView> images = new ArrayList<ImageView>();
    for (Picture picture : pictures) images.add(picture.toImageView());

    render("Application/gallery.html", images, gallery);
  }
コード例 #3
0
 @Util
 public static List<Gallery> getGalleries() {
   return Gallery.all().fetch();
 }