|
@@ -1,4 +1,4 @@
|
|
|
-package com.weEat.modules
|
|
|
|
|
|
|
+package com.weEat.view
|
|
|
|
|
|
|
|
import scala.scalajs.js.annotation._
|
|
import scala.scalajs.js.annotation._
|
|
|
import gov.usda.nal.fdc.models._
|
|
import gov.usda.nal.fdc.models._
|
|
@@ -11,15 +11,18 @@ import com.weEat.shared.models.{Count,MeasureUnit,USDANode}
|
|
|
import scala.util.Success
|
|
import scala.util.Success
|
|
|
import mhtml.{mount,Rx}
|
|
import mhtml.{mount,Rx}
|
|
|
import mhtml.future.syntax._
|
|
import mhtml.future.syntax._
|
|
|
-import MHtmlHelpers._
|
|
|
|
|
|
|
+import com.weEat.util.MHtmlHelpers._
|
|
|
|
|
+import com.weEat.modules._
|
|
|
|
|
|
|
|
@JSExportTopLevel("UsdaImporter")
|
|
@JSExportTopLevel("UsdaImporter")
|
|
|
-object UsdaImporter {
|
|
|
|
|
|
|
+object UsdaImporter extends View {
|
|
|
import com.weEat.Main.headers
|
|
import com.weEat.Main.headers
|
|
|
|
|
|
|
|
implicit val ctx = scala.concurrent.ExecutionContext.global
|
|
implicit val ctx = scala.concurrent.ExecutionContext.global
|
|
|
|
|
|
|
|
- def usdaImporterPane() = {
|
|
|
|
|
|
|
+ val title = "USDA Import"
|
|
|
|
|
+
|
|
|
|
|
+ def content = {
|
|
|
val searchBar = SearchBar(term => USDAController.getFoodsSearch(term, Seq(
|
|
val searchBar = SearchBar(term => USDAController.getFoodsSearch(term, Seq(
|
|
|
Foundation, Survey, SRLegacy
|
|
Foundation, Survey, SRLegacy
|
|
|
).map(_.toString))().map({
|
|
).map(_.toString))().map({
|
|
@@ -76,11 +79,11 @@ object UsdaImporter {
|
|
|
pageSel.page,
|
|
pageSel.page,
|
|
|
pageSizeSel.value)
|
|
pageSizeSel.value)
|
|
|
}
|
|
}
|
|
|
- { new ElemHelpers(pageSel.render).addClass("col-3 float-left") }
|
|
|
|
|
- { new ElemHelpers(pageSizeSel.render).addClass("col-1 float-right") }
|
|
|
|
|
|
|
+ { (pageSel.render).addClass("col-3 float-left") }
|
|
|
|
|
+ { (pageSizeSel.render).addClass("col-1 float-right") }
|
|
|
</div>
|
|
</div>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JSExport
|
|
@JSExport
|
|
|
- def render(parent: Element) = mount(parent, usdaImporterPane())
|
|
|
|
|
|
|
+ def render(parent: Element) = mhtml.mount(parent, content)
|
|
|
}
|
|
}
|