I'm getting
object index is not a member of package views.html
but unlike all the other threads opened on this subject, my issue seems totally unrelated to the IDE. I get this issue from the command line (no IDE) no matter how much I try to clean and rebuild by running
activator clean compile run
or just
sbt clean compile
Here is my conf/routes:
GET      /                   controllers.Application.index
GET      /books              controllers.Application.listBooks
POST     /books              controllers.Application.upload
GET     /assets/*file        controllers.Assets.at(path="/public", file)
This si my views/index.scala.html:
@import play.api.data.Form
@import models.Book
@(form: Form[Book])(implicit messages: Messages)
<!DOCTYPE html>
<html>
    <head>
        <title>xxx</title>
        <link rel="stylesheet" type="text/css" media="screen" href='@routes.Assets.at("stylesheets/main.css")'>
        <script type="text/javascript" href='@routes.Assets.at("javascripts/jquery-1.9.0.min.js")'></script>
    </head>
    <body>
        <div class="screenshot">
            <div class="navbar navbar-fixed-top">
                <div class="navbar-inner">
                    <div class="container">
                        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
                        </a> <a class="brand" href="#">Workday Dublin CTF</a>
                        <div class="nav-collapse">
                            <ul class="nav">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
                <h1>All Your Books Are Belong To Us</h1>
                <div class="container">
                    <h2>Add Book</h2>
                    @helper.form(action = routes.Application.upload, 'enctype -> "multipart/form-data") {
                        @helper.inputText(form("title"))
                        @helper.inputText(form("author"))
                        @helper.inputFile(form("myUpload"))
                        <div class="form-actions">
                            <button type="submit" class="btn btn-primary">Create Book</button>
                        </div>
                    }
                </div>
        </div>
    </body>
</html>
Finally, here is where the error is thrown, in my controllers/Application.scala:
package controllers
import models.Book
import models.Book._
import play.api.mvc._
class Application extends Controller {
  def index = Action {
    Ok(views.html.index(Book.form))
  }
  def listBooks = Action {
    Ok(books.head.myUpload)
  }
  def upload() = Action(parse.multipartFormData) { request =>
    request.body.file("myUpload").map { myUpload =>
      import java.io.File
      val filename = myUpload.filename
      val contentType = myUpload.contentType
      myUpload.ref.moveTo(new File(s"/tmp/$filename"))
      addBook(Book("xxxtitle", "xxxauthor", filename))
      Ok("File uploaded at /tmp/"+filename)
    }.getOrElse {
      Redirect(routes.Application.index).flashing(
        "error" -> "Missing file")
    }
  }
}
The error is thrown at Ok(views.html.index(Book.form)) which references models/Book.scala:
package models
import play.api.data.Form
import play.api.data.Forms._
case class Book(title: String, author: String, myUpload: String)
object Book {
  var books = List(Book("title test 1", "author test 1", "filename test 1"))
  def addBook(book: Book) = books = books ::: List(book)
  val form = Form(mapping(
    "title" -> text,
    "author" -> text,
    "myUpload" -> nonEmptyText)(Book.apply)(Book.unapply))
}
As I've researched a lot about this, and no other solution has worked so far, any help would be immensely appreciated. Thank you so much!