FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Refactoring · devhttps/frontend@5ece650 · GitHub

Commit 5ece650

Browse files
Matthew Walls
committed
Refactoring
1 parent 5a1051c commit 5ece650

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

‎article/app/controllers/ArticleController.scala‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class ArticleController(contentApiClient: ContentApiClient, val controllerCompon
7575
else ArticleHtmlPage.html(article)
7676
}
7777

78+
// add extra data for *.json?guui endpoint
7879
val contentFieldsJson = if (request.isGuuiJson) List("contentFields" -> Json.toJson(ContentFields(article.article))) else List()
7980

8081
val jsonResponse = () => List(("html", views.html.fragments.articleBody(article))) ++ contentFieldsJson
@@ -130,5 +131,3 @@ class ArticleController(contentApiClient: ContentApiClient, val controllerCompon
130131
}
131132

132133
}
133-
134-

‎article/app/controllers/LiveBlogController.scala‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ class LiveBlogController(contentApiClient: ContentApiClient, val controllerCompo
3232
else renderPage
3333
}
3434

35-
def renderLiveBlogEmail(path: String): Action[AnyContent] =
35+
def renderEmail(path: String): Action[AnyContent] =
3636
Action.async { implicit request =>
3737
println("Rendering live blog email")
3838
mapModel(path, range = Some(ArticleBlocks)) {
3939
render(path, _)
4040
}
4141
}
4242

43-
def renderLiveBlog(path: String, page: Option[String] = None, format: Option[String] = None): Action[AnyContent] =
43+
def renderArticle(path: String, page: Option[String] = None, format: Option[String] = None): Action[AnyContent] =
4444

4545
Action.async { implicit request =>
4646

@@ -58,7 +58,7 @@ class LiveBlogController(contentApiClient: ContentApiClient, val controllerCompo
5858
}
5959
}
6060

61-
def renderLiveBlogJson(path: String, lastUpdate: Option[String], rendered: Option[Boolean], isLivePage: Option[Boolean]): Action[AnyContent] = {
61+
def renderJson(path: String, lastUpdate: Option[String], rendered: Option[Boolean], isLivePage: Option[Boolean]): Action[AnyContent] = {
6262
Action.async { implicit request =>
6363

6464
println("Rendering live blog json")

‎article/conf/routes‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ GET /_cdn_healthcheck controllers.HealthCheck.healthCheck()
2020
# e.g. /theguardian/2015/nov/03/mainsection
2121
GET /$publication<(theguardian|theobserver)>/$year<\d\d\d\d>/$month<\w\w\w>/$day<\d\d>/$tail<.+> controllers.PublicationController.publishedOn(publication, year, month, day, tail)
2222

23-
GET /$path<[^/]+/([^/]+/)?live/.*>.json controllers.LiveBlogController.renderLiveBlogJson(path, lastUpdate: Option[String], rendered: Option[Boolean], isLivePage: Option[Boolean])
24-
GET /$path<[^/]+/([^/]+/)?live/.*>/email controllers.LiveBlogController.renderLiveBlogEmail(path)
25-
GET /$path<[^/]+/([^/]+/)?live/.*> controllers.LiveBlogController.renderLiveBlog(path, page: Option[String], format: Option[String])
26-
23+
GET /$path<[^/]+/([^/]+/)?live/.*>.json controllers.LiveBlogController.renderJson(path, lastUpdate: Option[String], rendered: Option[Boolean], isLivePage: Option[Boolean])
24+
GET /$path<[^/]+/([^/]+/)?live/.*>/email controllers.LiveBlogController.renderEmail(path)
25+
GET /$path<[^/]+/([^/]+/)?live/.*> controllers.LiveBlogController.renderArticle(path, page: Option[String], format: Option[String])
2726

2827
GET /*path.json controllers.ArticleController.renderJson(path)
2928
GET /*path/email controllers.ArticleController.renderEmail(path)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL