-
-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from mkurz/drop_cr28
[2.8.x] Windows line ending (CRLF) to unix line ending
- Loading branch information
Showing
10 changed files
with
584 additions
and
584 deletions.
There are no files selected for viewing
66 changes: 33 additions & 33 deletions
66
play-scala-hello-world-tutorial/app/controllers/HomeController.scala
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,33 +1,33 @@ | ||
package controllers | ||
|
||
import javax.inject._ | ||
import play.api._ | ||
import play.api.mvc._ | ||
|
||
/** | ||
* This controller creates an `Action` to handle HTTP requests to the | ||
* application's home page. | ||
*/ | ||
@Singleton | ||
class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) { | ||
|
||
/** | ||
* Create an Action to render an HTML page. | ||
* | ||
* The configuration in the `routes` file means that this method | ||
* will be called when the application receives a `GET` request with | ||
* a path of `/`. | ||
*/ | ||
def index() = Action { implicit request: Request[AnyContent] => | ||
Ok(views.html.index()) | ||
} | ||
|
||
def explore() = Action { implicit request: Request[AnyContent] => | ||
Ok(views.html.explore()) | ||
} | ||
|
||
def tutorial() = Action { implicit request: Request[AnyContent] => | ||
Ok(views.html.tutorial()) | ||
} | ||
|
||
} | ||
package controllers | ||
|
||
import javax.inject._ | ||
import play.api._ | ||
import play.api.mvc._ | ||
|
||
/** | ||
* This controller creates an `Action` to handle HTTP requests to the | ||
* application's home page. | ||
*/ | ||
@Singleton | ||
class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) { | ||
|
||
/** | ||
* Create an Action to render an HTML page. | ||
* | ||
* The configuration in the `routes` file means that this method | ||
* will be called when the application receives a `GET` request with | ||
* a path of `/`. | ||
*/ | ||
def index() = Action { implicit request: Request[AnyContent] => | ||
Ok(views.html.index()) | ||
} | ||
|
||
def explore() = Action { implicit request: Request[AnyContent] => | ||
Ok(views.html.explore()) | ||
} | ||
|
||
def tutorial() = Action { implicit request: Request[AnyContent] => | ||
Ok(views.html.tutorial()) | ||
} | ||
|
||
} |
34 changes: 17 additions & 17 deletions
34
play-scala-hello-world-tutorial/app/views/commonSidebar.scala.html
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,17 +1,17 @@ | ||
@() | ||
@defining(play.core.PlayVersion.current) { version => | ||
<h3>Table of Contents</h3> | ||
<ul> | ||
<li><a href="@routes.HomeController.index()#Introduction">Welcome</a> | ||
<li><a href="@routes.HomeController.explore()">Play application overview</a> | ||
<li><a href="@routes.HomeController.tutorial()">Implementing Hello World</a> | ||
</ul> | ||
<h3>Related Resources</h3> | ||
<ul> | ||
<li><a href="https://playframework.com/documentation/@version" target="_blank">Play documentation</a></li> | ||
<li><a href="https://github.com/playframework/playframework/discussions" target="_blank">Forum</a></li> | ||
<li><a href="https://discord.gg/g5s2vtZ4Fa" target="_blank">Play Discord Server</a></li> | ||
<li><a href="https://stackoverflow.com/questions/tagged/playframework" target="_blank">Stackoverflow</a></li> | ||
<li><a href="https://www.playframework.com/sponsors" target="_blank">Sponsor Play</a></li> | ||
</ul> | ||
} | ||
@() | ||
@defining(play.core.PlayVersion.current) { version => | ||
<h3>Table of Contents</h3> | ||
<ul> | ||
<li><a href="@routes.HomeController.index()#Introduction">Welcome</a> | ||
<li><a href="@routes.HomeController.explore()">Play application overview</a> | ||
<li><a href="@routes.HomeController.tutorial()">Implementing Hello World</a> | ||
</ul> | ||
<h3>Related Resources</h3> | ||
<ul> | ||
<li><a href="https://playframework.com/documentation/@version" target="_blank">Play documentation</a></li> | ||
<li><a href="https://github.com/playframework/playframework/discussions" target="_blank">Forum</a></li> | ||
<li><a href="https://discord.gg/g5s2vtZ4Fa" target="_blank">Play Discord Server</a></li> | ||
<li><a href="https://stackoverflow.com/questions/tagged/playframework" target="_blank">Stackoverflow</a></li> | ||
<li><a href="https://www.playframework.com/sponsors" target="_blank">Sponsor Play</a></li> | ||
</ul> | ||
} |
180 changes: 90 additions & 90 deletions
180
play-scala-hello-world-tutorial/app/views/explore.scala.html
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,90 +1,90 @@ | ||
@() | ||
|
||
@main("Hello World") { | ||
@defining(play.core.PlayVersion.current) { version => | ||
|
||
<section id="content"> | ||
<div class="wrapper doc"> | ||
<article> | ||
<h2>Play application overview</h2> | ||
|
||
<p>This tutorial is implemented as a Play application that demonstrates Play's basics. We started with the Play | ||
Scala seed template, which set up the application project structure and the configuration to build with sbt. | ||
We added stylesheets with Play's colors and a Table of Contents.</p> | ||
<p>Let's start by looking at what happens at runtime. When you entered the server name and port number, <a target="play-docs" | ||
href="http://localhost:9000/">http://localhost:9000/</a>, in your browser:</p> | ||
<ul> | ||
<li>The browser requested the root <code>/</code> URI from the HTTP server using the <code>GET</code> method.</li> | ||
<li>The Play internal HTTP Server received the request.</li> | ||
<li>Play resolved the request using the <code>routes</code> file, which maps URIs to controller action methods.</li> | ||
<li>The action method used Twirl templates to render the <code>index</code> page.</li> | ||
<li>The HTTP server returned the response as an HTML page.</li> | ||
</ul> | ||
<p> At a high level, the flow looks something like this:</p> | ||
<p><img src="assets/images/play-request-response.png" alt="Request and response" class="small-5 medium-4 large-3" /></p> | ||
<h3>Explore the project</h3> | ||
<p>Next, let's look at the tutorial project to locate the implementation for the following:</p> | ||
<ul> | ||
<li>The controller action method that defines how to handle a request to the root URI.</li> | ||
<li>The <code>conf/routes</code> file that maps the request to the controller method.</li> | ||
<li>The Twirl template that the action method calls to render the HTML markup.</li> | ||
</ul> | ||
<p>Using a command window or a GUI, start with the top-level project directory. The following directories contain | ||
application components:</p> | ||
|
||
<blockquote>Note: When changing directories in Windows shells, substitute <code>/</code> for <code>\</code> in | ||
path names.</blockquote> | ||
<p> | ||
<ol> | ||
<li>The <code>app</code> subdirectory is where you put your Scala code and packages. It contains directories | ||
for <code>controllers</code> and <code>views</code>, which will be familiar to those experienced with the | ||
Model View Controller (MVC) architecture. Since this simple project does not need an external data | ||
repository, it does not contain a <code>models</code> directory, but this is where you would add it. You | ||
could also add a <code>service</code> package and <code>utils</code> here. </li> | ||
<li>The <code>public</code> subdirectory contains directories for <code>images</code>, <code>javascripts</code>, | ||
and <code>stylesheets</code>.</li> | ||
<li>The <code>conf</code> directory contains application configuration. For a more detailed explanation of | ||
the project's structure, see <a href="https://www.playframework.com/documentation/@version/Anatomy#The-Play-application-layout" | ||
target="blank" />Play Application Layout</a>.</li> | ||
|
||
<li> | ||
<p>To locate the controller action method, open <code>app/controllers/HomeController.scala</code> file with | ||
your favorite text editor.</p> | ||
|
||
<p>The <code>Homecontroller</code> class includes the <code>index</code> action method, as shown below. | ||
This is a very simple action method that generate an HTML page from the <code>index.scala.html</code> | ||
Twirl template file.</p> | ||
<pre><code class="language-scala">def index() = Action { implicit request: Request[AnyContent] => | ||
Ok(views.html.index()) | ||
}</code></pre> | ||
</li> | ||
<li>To view the route that maps the browser request to the controller method, open the <code>conf/routes</code> | ||
file. | ||
<p>A route consists of an HTTP method, a path, and an action. This control over the URL schema makes it | ||
easy to | ||
design clean, human-readable, bookmarkable URLs. The following line maps a GET request for the root URL | ||
<code>/</code> | ||
to the <code>index</code> action in <code>HomeController</code>:</p> | ||
<code>GET / controllers.HomeController.index</code></li> | ||
<li>Open <code>app/views/index.scala.html</code> with your text editor. | ||
<p>The main directive in this file calls the main template <code>main.scala.html</code> with the string | ||
<code>"Welcome"</code> | ||
to generate the page. | ||
You can open <code>app/views/main.scala.html</code> to see how a <code>String</code> parameter sets the | ||
page | ||
title.</p> | ||
</li> | ||
</ol> | ||
</p> | ||
<h3 id="next-steps">Next steps</h3> | ||
<p>With this overview of the tutorial application, you are ready to <a href="@routes.HomeController.tutorial()">add | ||
your own "Hello World" greeting</a>.</p> | ||
</article> | ||
<aside> | ||
@commonSidebar() | ||
</aside> | ||
</div> | ||
</section> | ||
|
||
} | ||
} | ||
@() | ||
|
||
@main("Hello World") { | ||
@defining(play.core.PlayVersion.current) { version => | ||
|
||
<section id="content"> | ||
<div class="wrapper doc"> | ||
<article> | ||
<h2>Play application overview</h2> | ||
|
||
<p>This tutorial is implemented as a Play application that demonstrates Play's basics. We started with the Play | ||
Scala seed template, which set up the application project structure and the configuration to build with sbt. | ||
We added stylesheets with Play's colors and a Table of Contents.</p> | ||
<p>Let's start by looking at what happens at runtime. When you entered the server name and port number, <a target="play-docs" | ||
href="http://localhost:9000/">http://localhost:9000/</a>, in your browser:</p> | ||
<ul> | ||
<li>The browser requested the root <code>/</code> URI from the HTTP server using the <code>GET</code> method.</li> | ||
<li>The Play internal HTTP Server received the request.</li> | ||
<li>Play resolved the request using the <code>routes</code> file, which maps URIs to controller action methods.</li> | ||
<li>The action method used Twirl templates to render the <code>index</code> page.</li> | ||
<li>The HTTP server returned the response as an HTML page.</li> | ||
</ul> | ||
<p> At a high level, the flow looks something like this:</p> | ||
<p><img src="assets/images/play-request-response.png" alt="Request and response" class="small-5 medium-4 large-3" /></p> | ||
<h3>Explore the project</h3> | ||
<p>Next, let's look at the tutorial project to locate the implementation for the following:</p> | ||
<ul> | ||
<li>The controller action method that defines how to handle a request to the root URI.</li> | ||
<li>The <code>conf/routes</code> file that maps the request to the controller method.</li> | ||
<li>The Twirl template that the action method calls to render the HTML markup.</li> | ||
</ul> | ||
<p>Using a command window or a GUI, start with the top-level project directory. The following directories contain | ||
application components:</p> | ||
|
||
<blockquote>Note: When changing directories in Windows shells, substitute <code>/</code> for <code>\</code> in | ||
path names.</blockquote> | ||
<p> | ||
<ol> | ||
<li>The <code>app</code> subdirectory is where you put your Scala code and packages. It contains directories | ||
for <code>controllers</code> and <code>views</code>, which will be familiar to those experienced with the | ||
Model View Controller (MVC) architecture. Since this simple project does not need an external data | ||
repository, it does not contain a <code>models</code> directory, but this is where you would add it. You | ||
could also add a <code>service</code> package and <code>utils</code> here. </li> | ||
<li>The <code>public</code> subdirectory contains directories for <code>images</code>, <code>javascripts</code>, | ||
and <code>stylesheets</code>.</li> | ||
<li>The <code>conf</code> directory contains application configuration. For a more detailed explanation of | ||
the project's structure, see <a href="https://www.playframework.com/documentation/@version/Anatomy#The-Play-application-layout" | ||
target="blank" />Play Application Layout</a>.</li> | ||
|
||
<li> | ||
<p>To locate the controller action method, open <code>app/controllers/HomeController.scala</code> file with | ||
your favorite text editor.</p> | ||
|
||
<p>The <code>Homecontroller</code> class includes the <code>index</code> action method, as shown below. | ||
This is a very simple action method that generate an HTML page from the <code>index.scala.html</code> | ||
Twirl template file.</p> | ||
<pre><code class="language-scala">def index() = Action { implicit request: Request[AnyContent] => | ||
Ok(views.html.index()) | ||
}</code></pre> | ||
</li> | ||
<li>To view the route that maps the browser request to the controller method, open the <code>conf/routes</code> | ||
file. | ||
<p>A route consists of an HTTP method, a path, and an action. This control over the URL schema makes it | ||
easy to | ||
design clean, human-readable, bookmarkable URLs. The following line maps a GET request for the root URL | ||
<code>/</code> | ||
to the <code>index</code> action in <code>HomeController</code>:</p> | ||
<code>GET / controllers.HomeController.index</code></li> | ||
<li>Open <code>app/views/index.scala.html</code> with your text editor. | ||
<p>The main directive in this file calls the main template <code>main.scala.html</code> with the string | ||
<code>"Welcome"</code> | ||
to generate the page. | ||
You can open <code>app/views/main.scala.html</code> to see how a <code>String</code> parameter sets the | ||
page | ||
title.</p> | ||
</li> | ||
</ol> | ||
</p> | ||
<h3 id="next-steps">Next steps</h3> | ||
<p>With this overview of the tutorial application, you are ready to <a href="@routes.HomeController.tutorial()">add | ||
your own "Hello World" greeting</a>.</p> | ||
</article> | ||
<aside> | ||
@commonSidebar() | ||
</aside> | ||
</div> | ||
</section> | ||
|
||
} | ||
} |
Oops, something went wrong.