Last active
June 12, 2018 12:49
-
-
Save mgladdish/5633c4073bbb698cdeca498519aceea0 to your computer and use it in GitHub Desktop.
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
trait NestingMultipleChoice[C <: Messages[C]] extends WidgetGroup { | |
def nestedWidgets: Map[String, Widget] | |
def nestingMultipleChoiceWidget: MultipleChoice[C] | |
override lazy val widgets: Seq[Widget] = nestingMultpleChoiceWidget +: nestedWidgets.values.toSeq | |
def templateChoices(form: Form, errors: ValidationErrors, requestInfo: RequestInfo)(...): Future[List[Map[String, Any]]] = { | |
nestingMultipleChoiceWidget.choicesForTemplate.map(... | |
// Iterate through the choices already coverted to template params | |
// For each choice, find the associated nestedWidget by its key | |
// If there is an associated widget, add the result of calling nestedWidget.render(form, errors, requestInfo) to the template params | |
... | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment