Desktop version

Home arrow Computer Science arrow Building Applications with Scala

Source

Routes - adding new report routes

Now, we will need to add the new routes for the reports. For that, we will edit the conf/routes file, as follows:

GET /reports

#

# Reports

#

GET /product/report GET /review/report GET /image/report

controllers.HomeController.reports

controllers.ProductController.report

controllers.ReviewController.report

controllers.ImageController.report

We are done with routes now, and we need to change the UI in order to expose the new report functionality. We will create a new view containing all reports, and, for the sake of ease, we will also add a button for each resource UI (product, review, and image).

New centralized reports UI

We will need to create a new view at

ReactiveWebStore/views/reports_index.scala.html.

Your reports_index.scala.html file should look something like this:

@()(implicit flash: Flash)

@main("Reports") {

Products

Report

Reviews Report


Images Report

}

So here, we will basically list all resources-product, review, and images and link the relative controllers, and when the user clicks on the respective link a PDF report will be downloaded. Now we need to edit each resource (product, image, and review) view in order to add a link for the reports there as well.

 
Source
Found a mistake? Please highlight the word and press Shift + Enter  
< Prev   CONTENTS   Next >

Related topics