All Projects → splink → pagelets-seed

splink / pagelets-seed

Licence: Apache-2.0 License
An activator seed template and demo application to illustrate the Pagelets Module for the Play Framework

Programming Languages

scala
5932 projects
HTML
75241 projects
Less
1899 projects

Projects that are alternatives of or similar to pagelets-seed

play-scala-seed.g8
Play Scala Seed Template: run "sbt new playframework/play-scala-seed.g8"
Stars: ✭ 66 (+450%)
Mutual labels:  playframework
microframeworks-showcase
A simple grocery list webapplication implemented with the Microframeworks Spark Java, Jodd, Ninja, Javalite, Pippo and Ratpack
Stars: ✭ 29 (+141.67%)
Mutual labels:  demo-application
play-scala-anorm-example
Example Play Database Application using Anorm
Stars: ✭ 41 (+241.67%)
Mutual labels:  playframework
scalikejdbc-play-support
Play Framework support
Stars: ✭ 55 (+358.33%)
Mutual labels:  playframework
play-redis
Redis Module for Play Framework
Stars: ✭ 11 (-8.33%)
Mutual labels:  playframework
play-scala-chatroom-example
Play chatroom with Scala API
Stars: ✭ 43 (+258.33%)
Mutual labels:  playframework
MuezzinAPI
A web server application for Islamic prayer times
Stars: ✭ 33 (+175%)
Mutual labels:  playframework
play-scala-secure-session-example
An example Play application showing encrypted session management
Stars: ✭ 54 (+350%)
Mutual labels:  playframework
play-rconf
Remote configuration for Play Framework
Stars: ✭ 17 (+41.67%)
Mutual labels:  playframework
block-explorer
The official Stakenet block explorer
Stars: ✭ 29 (+141.67%)
Mutual labels:  playframework
contoso-university
Contoso University demo using asp net core and related technologies
Stars: ✭ 42 (+250%)
Mutual labels:  demo-application
playsonify
An opinionated micro-framework to help you build practical JSON APIs with Play Framework (or akka-http)
Stars: ✭ 42 (+250%)
Mutual labels:  playframework
play2scalaz
Scalaz typeclasses <~> Playframework2 typeclasses
Stars: ✭ 14 (+16.67%)
Mutual labels:  playframework
play-java-rest-api-example
REST API using Play in Java
Stars: ✭ 44 (+266.67%)
Mutual labels:  playframework
play2-oauth2-provider
This library is enabled using scala-oauth2-provider in Play Framework
Stars: ✭ 28 (+133.33%)
Mutual labels:  playframework
play-grpc
Play + Akka gRPC
Stars: ✭ 31 (+158.33%)
Mutual labels:  playframework
DomoScala
Home automation, with Scala and Arduino. Nerdy stuff.
Stars: ✭ 21 (+75%)
Mutual labels:  playframework
bookmarker-tutorial
The finished result of the bookmarker tutorial. Also serves as a sample application using CakePHP 3.x
Stars: ✭ 24 (+100%)
Mutual labels:  demo-application
scalapb-playjson
Json/Protobuf convertors for ScalaPB use play-json
Stars: ✭ 15 (+25%)
Mutual labels:  playframework
play-java-ebean-example
Example Play application showing Java with Ebean
Stars: ✭ 54 (+350%)
Mutual labels:  playframework

Build Status

Hello Pagelets!

just a few minutes and you have a complete Play application based on the Play Pagelets Module running.

See the app in action: Pagelets on Heroku *note that it runs on a free dyno which takes a couple of seconds to wake up.

TL;DR

The demo application serves the purpose to

  • showcase the Play Pagelets Module and it's advantages
  • demonstrate how to build a pagelet based application
  • serve as a template for pagelet based projects

What is a Pagelet

A pagelet is a small independent unit which consists of view, controller action and optionally a service which obtains the data to be rendered. Usually a web page is composed of multiple pagelets.

The demo app

This demo application shows how a modular and resilient web application can be built using the Playframework 2 and the Play Pagelets Module.

This example app is a small multi-language website. The page is composed of multiple pagelets. Each pagelet is completely independent and obtains data from a remote service and renders the data by means of a standard twirl template.

Depending on the selected language, the home page is composed from different pagelets. This shows how the page composition can be manipulated at runtime based on the properties of an incoming request.

The demo also invites to to simulate failure by configuring remote services to time-out or serve broken data.

To get a rough idea what the pagelet API looks like:

A page configuration

def tree(r: RequestHeader) = 
  Tree("root".id, Seq(
    Leaf("header".id, () => header).withJavascript(Javascript("lib/bootstrap/js/dropdown.min.js")),
    Tree("content".id, Seq(
      Leaf("carousel".id, () => carousel).withFallback(fallback("Carousel") _),
      Leaf("text".id, () => text).withFallback(fallback("Text") _)
    )),
    Leaf("footer".id, () => footer).withCss(Css("stylesheets/footer.min.css"))
  ))

A main action to render a complete page

def index = PageAction.async(routes.HomeController.errorPage)(_ => "Page Title", tree) { (request, page) =>
  views.html.wrapper(routes.HomeController.resourceFor)(page)
}

A pagelet (just a standard Play action)

def carousel = Action.async { implicit request =>
  carouselService.carousel.map { teasers =>
    Ok(views.html.pagelets.carousel(teasers))
  }
}

A fallback pagelet (also just a standard Play action)

def fallback(name: String)() = Action {
  Ok(views.html.pagelets.fallback(name))
}

Getting started

Open a terminal and clone the github repository with

git clone [email protected]:splink/pagelets-seed.git
  • then enter
cd play-pagelets-seed
  • then enter
sbt run

then point your browser to http://localhost:9000

If you are interested in more details, check out the main Play Pagelets repository

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].