diff --git a/core-play25/app/views/bs/Args.scala b/core-play25/app/views/bs/Args.scala deleted file mode 100644 index c308613..0000000 --- a/core-play25/app/views/bs/Args.scala +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.bs - -object Args { - - import play.api.i18n.Messages - - /** - * Adds some default arguments to the parameter 'args' - */ - def withDefault(args: Seq[(Symbol, Any)], default: (Symbol, Any)*) = default ++: args - - /** - * Adds a string value to a selected arg. For example, to add "form-control" to 'class, even if there is already other extra class - */ - def withAddingStringValue(args: Seq[(Symbol, Any)], arg: Symbol, value: String): Seq[(Symbol, Any)] = { - val (withArg, withoutArg) = args.partition(_._1 == arg) - (arg, withArg.headOption.map(v => s"$value ${v._2.toString}").getOrElse(value)) +: withoutArg - } - def withAddingStringValue(args: Seq[(Symbol, Any)], arg: Symbol, maybeValue: Option[String]): Seq[(Symbol, Any)] = - maybeValue.map(value => withAddingStringValue(args, arg, value)).getOrElse(args) - - /** - * Removes those arguments which its value is None. It lets you omit those arguments that satisfy some criteria. - * It also lets you add some default arguments to the parameter 'args'. - */ - def withoutNones(args: Seq[(Symbol, Any)], default: (Symbol, Any)*) = (default ++: args).filter(_._2 != None) - - /** - * Returns only the inner arguments (those that are exclusive for an input and not for the field constructor). - * Removes every argument with a prefixed underscore (_) and those whose value is false. - * It also lets you add some default arguments to the parameter 'args'. - */ - def inner(args: Seq[(Symbol, Any)], default: (Symbol, Any)*) = - (default ++: args).filter(arg => !arg._1.name.startsWith("_") && arg._2 != false) - - /** - * Gets the value for the selected key - */ - def get(args: Seq[(Symbol, Any)], key: Symbol) = args.find(_._1 == key).map(_._2) - - /** - * Removes those arguments with these keys - */ - def remove(args: Seq[(Symbol, Any)], keys: Symbol*) = args.filter(arg => !keys.contains(arg._1)) - - /** - * Returns true only if exists a pair with that key and its value is true. - */ - def isTrue(args: Seq[(Symbol, Any)], key: Symbol) = args.exists(_ == (key, true)) - - /** - * Localizes an argument - */ - def msg(arg: (Symbol, Any))(implicit msgs: Messages): (Symbol, Any) = arg match { - case (sym, str: String) => (sym, msgs(str)) - case _ => arg - } - - /** - * Localizes a value - */ - def msg(a: Any)(implicit msgs: Messages): Any = a match { - case str: String => msgs(str) - case _ => a - } -} - -object ArgsMap { - /** - * Adds a string value to a selected arg. For example, to add "form-control" to 'class, even if there is already other extra class - */ - def withAddingStringValue(argsMap: Map[Symbol, Any], arg: Symbol, value: String): Map[Symbol, Any] = { - val newValue = argsMap.get(arg).map(v => s"$value ${v.toString}").getOrElse(value) - argsMap + (arg -> newValue) - } - def withAddingStringValue(argsMap: Map[Symbol, Any], arg: Symbol, maybeValue: Option[String]): Map[Symbol, Any] = - maybeValue.map(value => withAddingStringValue(argsMap, arg, value)).getOrElse(argsMap) - /** - * Returns true only if the map contains an argument with that key and its value is true. - */ - def isTrue(argsMap: Map[Symbol, Any], key: Symbol) = argsMap.get(key).map(_ == true).getOrElse(false) - /** - * Returns true only if the map contains an argument with that key and its value is any value but false. - */ - def isNotFalse(argsMap: Map[Symbol, Any], key: Symbol) = argsMap.get(key).map(_ != false).getOrElse(false) -} \ No newline at end of file diff --git a/core-play25/app/views/bs/package.scala b/core-play25/app/views/bs/package.scala deleted file mode 100644 index 3eb3f2f..0000000 --- a/core-play25/app/views/bs/package.scala +++ /dev/null @@ -1,216 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html - -package object bs { - - import play.api.data.{ Field, FormError } - import play.twirl.api.Html - import play.api.i18n.{ Lang, Messages } - import bs.ArgsMap.isTrue - import play.api.mvc.Call - - /** - * Class with relevant variables for a field to pass it to the helper and field constructor - * - args: list of available arguments for the helper and field constructor - */ - class BSFieldInfo(field: Field, args: Seq[(Symbol, Any)], val messages: Messages) { - - /* A map with the args to work easily with them */ - val argsMap: Map[Symbol, Any] = Args.withoutNones(args).toMap - - /* Id of the input */ - val id: String = argsMap.get('id).map(_.toString).getOrElse(field.id) - - /* Id of the form-group */ - val idFormField: String = argsMap.get('_id).map(_.toString).getOrElse(id + "_field") - - /* The optional label */ - val labelOpt: Option[Any] = argsMap.get('_label).orElse(argsMap.get('_hiddenLabel)) - - /* Indicates if the label must be hidden */ - val hideLabel: Boolean = isTrue(argsMap, '_hideLabel) || argsMap.contains('_hiddenLabel) - - /* Name of the input */ - def name: String = field.name - - /* Value of the input */ - val value: Option[String] = field.value.orElse(argsMap.get('value).map(_.toString)) - - /* List with every error and its corresponding ARIA id. Ex: ("foo_error_0" -> "foo error") */ - val errors: Seq[(String, String)] = BSFieldInfo.errors(Some(field), argsMap, messages).zipWithIndex.map { - case (error, i) => (id + "_error_" + i, error) - } - - /* Indicates if there is any error */ - val hasErrors: Boolean = !errors.isEmpty || ArgsMap.isNotFalse(argsMap, '_error) - - /* The optional validation state ("success", "warning" or "error") */ - lazy val status: Option[String] = BSFieldInfo.status(hasErrors, argsMap) - - } - - /** - * Companion object for class BSFieldInfo - */ - object BSFieldInfo { - - def apply(field: Field, args: Seq[(Symbol, Any)], messages: Messages): BSFieldInfo = { - new BSFieldInfo(field, args, messages) - } - - /* List with every error */ - def errors(maybeField: Option[Field], argsMap: Map[Symbol, Any], messages: Messages): Seq[String] = { - argsMap.get('_error).filter(!_.isInstanceOf[Boolean]).map { - _ match { - case Some(FormError(_, message, args)) => Seq(messages(message, args.map(a => translateMsgArg(a, messages)): _*)) - case message => Seq(messages(message.toString)) - } - }.getOrElse { - maybeField.filter(_ => argsMap.get('_showErrors) != Some(false)).map { field => - field.errors.map { e => messages(e.message, e.args.map(a => translateMsgArg(a, messages)): _*) } - }.getOrElse(Nil) - } - } - - /* List with every "feedback info" except "errors" */ - def feedbackInfosButErrors(argsMap: Map[Symbol, Any], messages: Messages): Seq[String] = { - argsMap.get('_warning).filter(!_.isInstanceOf[Boolean]).map(m => Seq(messages(m.toString))).getOrElse( - argsMap.get('_success).filter(!_.isInstanceOf[Boolean]).map(m => Seq(messages(m.toString))).getOrElse(Nil) - ) - } - - /* List with every "help info", i.e. a help text or constraints */ - def helpInfos(maybeField: Option[Field], argsMap: Map[Symbol, Any], messages: Messages): Seq[String] = { - argsMap.get('_help).map(m => Seq(messages(m.toString))).getOrElse { - maybeField.filter(_ => argsMap.get('_showConstraints) == Some(true)).map { field => - field.constraints.map(c => messages(c._1, c._2.map(a => translateMsgArg(a, messages)): _*)) ++ field.format.map(f => messages(f._1, f._2.map(a => translateMsgArg(a, messages)): _*)) - }.getOrElse(Nil) - } - } - - /* The optional validation state ("success", "warning" or "error") */ - def status(hasErrors: Boolean, argsMap: Map[Symbol, Any]): Option[String] = { - if (hasErrors) - Some("error") - else if (ArgsMap.isNotFalse(argsMap, '_warning)) - Some("warning") - else if (ArgsMap.isNotFalse(argsMap, '_success)) - Some("success") - else - None - } - - /* Generates automatically the input attributes for the constraints of a field */ - def constraintsArgs(field: Field, messages: Messages): Seq[(Symbol, Any)] = field.constraints.map { - case ("constraint.required", params) => Some(('required -> true)) - case ("constraint.min", params: Seq[Any]) => Some(('min -> messages(params.head.toString))) - case ("constraint.max", params: Seq[Any]) => Some(('max -> messages(params.head.toString))) - case ("constraint.minLength", params: Seq[Any]) => Some(('minlength -> messages(params.head.toString))) - case ("constraint.maxLength", params: Seq[Any]) => Some(('maxlength -> messages(params.head.toString))) - case ("constraint.pattern", params: Seq[Any]) => params.head match { - case str: String => Some(('pattern -> messages(str))) - case func: Function0[_] => Some(('pattern -> messages(func.asInstanceOf[() => scala.util.matching.Regex]().toString))) - case _ => None - } - case _ => None - }.flatten - - private def translateMsgArg(msgArg: Any, messages: Messages) = msgArg match { - case key: String => messages(key) - case keys: Seq[_] => keys.map(key => messages(key.toString)) - case _ => msgArg - } - } - - /** - * Class with relevant variables for the global information of a multifield - * - fields: list of Fields - * - globalArguments: list of available arguments for the global helper - * - fieldsArguments: list of available arguments for every specific field - */ - class BSMultifieldInfo(fields: Seq[Field], globalArguments: Seq[(Symbol, Any)], fieldsArguments: Seq[(Symbol, Any)], val messages: Messages) { - - /* A map with the args to work easily with them. The '_help is removed because the helper freeFormFieldormField will add it */ - val argsMap: Map[Symbol, Any] = Args.withoutNones(fieldsArguments ++ globalArguments).toMap - - /* List with every error */ - val errors: Seq[String] = { - val globalErrors = BSFieldInfo.errors(None, argsMap, messages) - if (globalErrors.size > 0) - globalErrors - else - fields.flatMap { field => - BSFieldInfo.errors(Some(field), argsMap, messages) - } - } - - /* Indicates if there is any error */ - val hasErrors: Boolean = !errors.isEmpty || ArgsMap.isNotFalse(argsMap, '_error) - - /* The optional validation state ("success", "warning" or "error") */ - lazy val status: Option[String] = BSFieldInfo.status(hasErrors, argsMap) - - lazy val globalArgs = globalArguments - - lazy val fieldsArgs = fieldsArguments - } - - /** - * Companion object for class BSMultifieldInfo - */ - object BSMultifieldInfo { - def apply(fields: Seq[Field], globalArguments: Seq[(Symbol, Any)], fieldsArguments: Seq[(Symbol, Any)], messages: Messages): BSMultifieldInfo = { - new BSMultifieldInfo(fields, globalArguments, fieldsArguments, messages) - } - } - - /** - * Custom BSFieldConstructor for the library. Every BSFieldConstructor must extend this functionality. - */ - trait BSFieldConstructor[F <: BSFieldInfo] { - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: F, inputHtml: Html)(implicit messages: Messages): Html - /* Renders the corresponding template of a fake field constructor (i.e. with the same structure but without the field) */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages): Html - } - - /** - * Renders an input field with its corresponding wrapper using the BSFieldConstructor. - * - fieldInfo: a BSFieldInfo with all the information about the field. - * - inputDef: function that returns a Html from the BSFieldInfo. - */ - def inputFormField[F <: BSFieldInfo](fieldInfo: F)(inputDef: F => Html)(implicit fc: BSFieldConstructor[F]) = - fc(fieldInfo, inputDef(fieldInfo))(fieldInfo.messages) - - /** - * Renders a fake field constructor using the BSFieldConstructor. - * - args: list of available arguments for the helper and the form-group - * - contentDef: function that returns a Html from a map of arguments - */ - def freeFormField[F <: BSFieldInfo](args: Seq[(Symbol, Any)])(contentDef: Map[Symbol, Any] => Html)(implicit fc: BSFieldConstructor[F], messages: Messages) = { - val argsWithoutNones = Args.withoutNones(args) - fc(contentDef(Args.inner(argsWithoutNones).toMap), argsWithoutNones.toMap)(messages) - } - - /** - * Renders a multi-field constructor using the BSFieldConstructor. - * - fieldInfo: a BSMultifieldInfo with all the information about the fields. - * - contentDef: function that returns a Html from the BSMultifieldInfo - */ - def multifieldFormField[F <: BSFieldInfo, M <: BSMultifieldInfo](multifieldInfo: M)(contentDef: M => Html)(implicit fc: BSFieldConstructor[F]) = - freeFormField(multifieldInfo.globalArgs)(_ => contentDef(multifieldInfo))(fc, multifieldInfo.messages) -} \ No newline at end of file diff --git a/core-play25/build.sbt b/core-play25/build.sbt deleted file mode 100644 index 43405af..0000000 --- a/core-play25/build.sbt +++ /dev/null @@ -1,62 +0,0 @@ -name := """play-bootstrap-core""" - -version := "1.4-P25-SNAPSHOT" - -scalaVersion := "2.11.11" - -crossScalaVersions := Seq("2.11.11") - -resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases" - - -lazy val root = (project in file(".")).enablePlugins(PlayScala) - - - -scalariformSettings - -//******************************* -// Maven settings -//******************************* - -sonatypeSettings - -publishMavenStyle := true - -organization := "com.adrianhurt" - -description := "This is a collection of input helpers and field constructors for Play Framework to render Bootstrap HTML code." - -homepage := Some(url("http://adrianhurt.github.io/play-bootstrap")) - -licenses := Seq("Apache License" -> url("https://github.com/adrianhurt/play-bootstrap/blob/master/LICENSE")) - -startYear := Some(2014) - -publishTo := { - val nexus = "https://oss.sonatype.org/" - if (isSnapshot.value) - Some("snapshots" at nexus + "content/repositories/snapshots") - else - Some("releases" at nexus + "service/local/staging/deploy/maven2") -} - -publishArtifact in Test := false - -pomIncludeRepository := { _ => false } - -pomExtra := ( - - git@github.com:adrianhurt/play-bootstrap.git - scm:git:git@github.com:adrianhurt/play-bootstrap.git - - - - adrianhurt - Adrian Hurtado - https://github.com/adrianhurt - - -) - -credentials += Credentials(Path.userHome / ".sbt" / "sonatype.credentials") diff --git a/core-play25/project/build.properties b/core-play25/project/build.properties deleted file mode 100644 index c364161..0000000 --- a/core-play25/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Activator-generated Properties -#Mon Aug 11 18:06:16 BST 2014 -template.uuid=688014f0-0585-43e3-a9fa-d62f7d12f1ab -sbt.version=0.13.11 diff --git a/core-play25/project/plugins.sbt b/core-play25/project/plugins.sbt deleted file mode 100644 index 63f4ec9..0000000 --- a/core-play25/project/plugins.sbt +++ /dev/null @@ -1,12 +0,0 @@ -resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" - -// The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.18") - -// web plugins - -addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") - -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.2") - -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") diff --git a/core-play26/build.sbt b/core-play26/build.sbt index 13cf4f0..32219ff 100644 --- a/core-play26/build.sbt +++ b/core-play26/build.sbt @@ -1,10 +1,10 @@ name := """play-bootstrap-core""" -version := "1.4-P26-SNAPSHOT" +version := "1.5-P26-SNAPSHOT" -scalaVersion := "2.12.4" +scalaVersion := "2.12.8" -crossScalaVersions := Seq("2.12.4", "2.11.12") +crossScalaVersions := Seq("2.12.8", "2.11.12") resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases" diff --git a/core-play26/project/plugins.sbt b/core-play26/project/plugins.sbt index 69d2bb6..070c0e5 100644 --- a/core-play26/project/plugins.sbt +++ b/core-play26/project/plugins.sbt @@ -1,7 +1,7 @@ resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12") +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.21") // web plugins diff --git a/play25-bootstrap3/module/app/views/b3/bsFieldConstructorCommon.scala.html b/play25-bootstrap3/module/app/views/b3/bsFieldConstructorCommon.scala.html deleted file mode 100644 index 7056c03..0000000 --- a/play25-bootstrap3/module/app/views/b3/bsFieldConstructorCommon.scala.html +++ /dev/null @@ -1,9 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html)(wrap: Html => Html)(implicit fc: b3.B3FieldConstructor) -
- @wrap { - @inputHtml - @fieldInfo.errorsAndInfos.map { case (id, text) => - @text - } - } -
\ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/bsFormGroupCommon.scala.html b/play25-bootstrap3/module/app/views/b3/bsFormGroupCommon.scala.html deleted file mode 100644 index b9d4713..0000000 --- a/play25-bootstrap3/module/app/views/b3/bsFormGroupCommon.scala.html +++ /dev/null @@ -1,11 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(wrap: Html => Html)(implicit messages: Messages) -@defining(argsMap.get('_id).map(_.toString).orElse(argsMap.get('id).map(_.toString + "_field"))) { idFormField => -
id="@id"}> - @wrap { - @contentHtml - @argsMap.get('_help).map { help => - @bs.Args.msg(help)(messages) - } - } -
-} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/buttonType.scala.html b/play25-bootstrap3/module/app/views/b3/buttonType.scala.html deleted file mode 100644 index c33f8c5..0000000 --- a/play25-bootstrap3/module/app/views/b3/buttonType.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(buttonType: String, args: (Symbol,Any)*)(text: => Html)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@freeFormGroup(args) { innerArgsMap => - -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/checkbox.scala.html b/play25-bootstrap3/module/app/views/b3/checkbox.scala.html deleted file mode 100644 index d8e8bc4..0000000 --- a/play25-bootstrap3/module/app/views/b3/checkbox.scala.html +++ /dev/null @@ -1,22 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@defining({ - val argsMap = args.toMap - val value = argsMap.get('value).getOrElse("true").toString - val checked = argsMap.get('checked).orElse(field.value.map(_ == value).orElse(argsMap.get('_default))).map(_.toString == "true").getOrElse(false) - val containsReadonly = argsMap.contains('readonly) - val readonly = bs.ArgsMap.isTrue(argsMap, 'readonly) - val disabled = readonly || bs.ArgsMap.isTrue(argsMap, 'disabled) - (argsMap, value, checked, containsReadonly, readonly, disabled) -}){ case (argsMap, value, checked, containsReadonly, readonly, disabled) => - @inputFormGroup(field, withFeedback = false, withLabelFor = false, bs.Args.withDefault(args.filterNot(_._1 == 'checked), 'checked -> checked, 'disabled -> disabled)) { fieldInfo => -
- - @if(containsReadonly) { - - } -
- }(fc, messages) -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/clear/package.scala b/play25-bootstrap3/module/app/views/b3/clear/package.scala deleted file mode 100644 index 875d6c4..0000000 --- a/play25-bootstrap3/module/app/views/b3/clear/package.scala +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -package object clear { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.Messages - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Clear FieldConstructor. - */ - class ClearFieldConstructor(val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* Define the class of the corresponding form */ - val formClass = "form-clear" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit messages: Messages) = inputHtml - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = contentHtml - } - - /** - * Creates a new ClearFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific ClearFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(withFeedbackIcons: Boolean = false): ClearFieldConstructor = - new ClearFieldConstructor(withFeedbackIcons) - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - def fieldConstructor(withFeedbackIcons: Boolean = false): B3FieldConstructor = - fieldConstructorSpecific(withFeedbackIcons) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: ClearFieldConstructor => Html) = { - val cfc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.form(action, inner(args): _*)(body(cfc))(cfc) - } - def formCSRF(action: Call, args: (Symbol, Any)*)(body: ClearFieldConstructor => Html)(implicit request: RequestHeader) = { - val cfc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.formCSRF(action, inner(args): _*)(body(cfc))(cfc, request) - } - -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/file.scala.html b/play25-bootstrap3/module/app/views/b3/file.scala.html deleted file mode 100644 index a4252e2..0000000 --- a/play25-bootstrap3/module/app/views/b3/file.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@inputFormGroup(field, withFeedback = true, withLabelFor = true, args) { fieldInfo => - -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/form.scala.html b/play25-bootstrap3/module/app/views/b3/form.scala.html deleted file mode 100644 index 53d938c..0000000 --- a/play25-bootstrap3/module/app/views/b3/form.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(action: Call, args: (Symbol, Any)*)(body: => Html)(implicit fc: b3.B3FieldConstructor) -
"form"), 'class).toMap)> - @body -
\ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/formCSRF.scala.html b/play25-bootstrap3/module/app/views/b3/formCSRF.scala.html deleted file mode 100644 index e85f92f..0000000 --- a/play25-bootstrap3/module/app/views/b3/formCSRF.scala.html +++ /dev/null @@ -1,5 +0,0 @@ -@(action: Call, args: (Symbol, Any)*)(body: => Html)(implicit fc: b3.B3FieldConstructor, request: RequestHeader) -@form(action, args:_*) { - @helper.CSRF.formField - @body -}(fc) \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/hiddenInput.scala.html b/play25-bootstrap3/module/app/views/b3/hiddenInput.scala.html deleted file mode 100644 index 5ae08f3..0000000 --- a/play25-bootstrap3/module/app/views/b3/hiddenInput.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(name: Any, value: Any, args: (Symbol, Any)*) - \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/hiddens.scala.html b/play25-bootstrap3/module/app/views/b3/hiddens.scala.html deleted file mode 100644 index 6c7d022..0000000 --- a/play25-bootstrap3/module/app/views/b3/hiddens.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(namesAndValues: (Any, Any)*) -@namesAndValues.map { case (name, value) => - -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/horizontal/bsFieldConstructor.scala.html b/play25-bootstrap3/module/app/views/b3/horizontal/bsFieldConstructor.scala.html deleted file mode 100644 index aa9fcd3..0000000 --- a/play25-bootstrap3/module/app/views/b3/horizontal/bsFieldConstructor.scala.html +++ /dev/null @@ -1,13 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html, colLabel: String, colOffset: String, colInput: String)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@b3.bsFieldConstructorCommon(fieldInfo, inputHtml) { content => - @fieldInfo.labelOpt.map { label => - -
- @content -
- }.getOrElse { -
- @content -
- } -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/horizontal/bsFormGroup.scala.html b/play25-bootstrap3/module/app/views/b3/horizontal/bsFormGroup.scala.html deleted file mode 100644 index 987f343..0000000 --- a/play25-bootstrap3/module/app/views/b3/horizontal/bsFormGroup.scala.html +++ /dev/null @@ -1,13 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any], colLabel: String, colOffset: String, colInput: String)(implicit messages: Messages) -@b3.bsFormGroupCommon(contentHtml, argsMap) { content => - @argsMap.get('_label).map { label => - -
- @content -
- }.getOrElse { -
- @content -
- } -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/horizontal/package.scala b/play25-bootstrap3/module/app/views/b3/horizontal/package.scala deleted file mode 100644 index 9d426d3..0000000 --- a/play25-bootstrap3/module/app/views/b3/horizontal/package.scala +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -package object horizontal { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.Messages - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Horizontal FieldConstructor. - * It needs the column widths for the corresponding Bootstrap3 form-group - */ - case class HorizontalFieldConstructor(colLabel: String, colInput: String, val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* The equivalent offset if label is not present (ex: colLabel = "col-md-2" => colOffset = "col-md-offset-2") */ - val colOffset: String = { - val chunks = colLabel.split("-") - (chunks.init :+ "offset" :+ chunks.last).mkString("-") - } - /* Define the class of the corresponding form */ - val formClass = "form-horizontal" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit messages: Messages) = bsFieldConstructor(fieldInfo, inputHtml, colLabel, colOffset, colInput)(this, messages) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = bsFormGroup(contentHtml, argsMap, colLabel, colOffset, colInput)(messages) - } - - /** - * Returns a new HorizontalFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific HorizontalFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(colLabel: String, colInput: String, withFeedbackIcons: Boolean = false): HorizontalFieldConstructor = - new HorizontalFieldConstructor(colLabel, colInput, withFeedbackIcons) - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - def fieldConstructor(colLabel: String, colInput: String, withFeedbackIcons: Boolean = false): B3FieldConstructor = - fieldConstructorSpecific(colLabel, colInput, withFeedbackIcons) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, colLabel: String, colInput: String, args: (Symbol, Any)*)(body: HorizontalFieldConstructor => Html) = { - val hfc = fieldConstructorSpecific(colLabel, colInput, withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.form(action, inner(args): _*)(body(hfc))(hfc) - } - def formCSRF(action: Call, colLabel: String, colInput: String, args: (Symbol, Any)*)(body: HorizontalFieldConstructor => Html)(implicit request: RequestHeader) = { - val hfc = fieldConstructorSpecific(colLabel, colInput, withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.formCSRF(action, inner(args): _*)(body(hfc))(hfc, request) - } - -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/inline/bsFieldConstructor.scala.html b/play25-bootstrap3/module/app/views/b3/inline/bsFieldConstructor.scala.html deleted file mode 100644 index 3d2aa0a..0000000 --- a/play25-bootstrap3/module/app/views/b3/inline/bsFieldConstructor.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@b3.bsFieldConstructorCommon(fieldInfo, inputHtml) { content => - @fieldInfo.labelOpt.map { label => - - } - @content -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/inline/bsFormGroup.scala.html b/play25-bootstrap3/module/app/views/b3/inline/bsFormGroup.scala.html deleted file mode 100644 index 064e7fd..0000000 --- a/play25-bootstrap3/module/app/views/b3/inline/bsFormGroup.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) -@b3.bsFormGroupCommon(contentHtml, argsMap) { content => - @argsMap.get('_label).map { label => - - } - @content -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/inline/package.scala b/play25-bootstrap3/module/app/views/b3/inline/package.scala deleted file mode 100644 index 5e47083..0000000 --- a/play25-bootstrap3/module/app/views/b3/inline/package.scala +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -package object inline { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.Messages - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Inline FieldConstructor. - */ - class InlineFieldConstructor(val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* Define the class of the corresponding form */ - val formClass = "form-inline" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit messages: Messages) = bsFieldConstructor(fieldInfo, inputHtml)(this, messages) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = bsFormGroup(contentHtml, argsMap)(messages) - } - - /** - * Creates a new InlineFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific InlineFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(withFeedbackIcons: Boolean = false): InlineFieldConstructor = - new InlineFieldConstructor(withFeedbackIcons) - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - def fieldConstructor(withFeedbackIcons: Boolean = false): B3FieldConstructor = - fieldConstructorSpecific(withFeedbackIcons) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: InlineFieldConstructor => Html) = { - val ifc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackTooltip)) - views.html.b3.form(action, inner(args): _*)(body(ifc))(ifc) - } - def formCSRF(action: Call, args: (Symbol, Any)*)(body: InlineFieldConstructor => Html)(implicit request: RequestHeader) = { - val ifc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackTooltip)) - views.html.b3.formCSRF(action, inner(args): _*)(body(ifc))(ifc, request) - } - -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/inputWrapped.scala.html b/play25-bootstrap3/module/app/views/b3/inputWrapped.scala.html deleted file mode 100644 index 4e9c80d..0000000 --- a/play25-bootstrap3/module/app/views/b3/inputWrapped.scala.html +++ /dev/null @@ -1,10 +0,0 @@ -@(inputType: String, field: Field, args: (Symbol,Any)*)(inputGroup: Html => Html)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@inputFormGroup(field, withFeedback = true, withLabelFor = true, bs.Args.withAddingStringValue(args, 'class, "form-control")) { fieldInfo => - @inputGroup { - - @if(fieldInfo.hasFeedback) { - - (@fieldInfo.status) - } - } -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/multifield.scala.html b/play25-bootstrap3/module/app/views/b3/multifield.scala.html deleted file mode 100644 index 91c45ee..0000000 --- a/play25-bootstrap3/module/app/views/b3/multifield.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(fields: Field*)(globalArgs: Seq[(Symbol,Any)], fieldsArgs: Seq[(Symbol,Any)])(inputsHtml: b3.clear.ClearFieldConstructor => Html)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@multifieldFormGroup(fields, globalArgs, fieldsArgs) { multifieldInfo => - @inputsHtml(b3.clear.fieldConstructorSpecific()) - @multifieldInfo.errorsAndInfos.map { errorOrInfo => - @errorOrInfo - } -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/package.scala b/play25-bootstrap3/module/app/views/b3/package.scala deleted file mode 100644 index 50e3588..0000000 --- a/play25-bootstrap3/module/app/views/b3/package.scala +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html - -package object b3 { - - import play.api.data.{ Field, FormError } - import play.twirl.api.Html - import play.api.i18n.{ Lang, Messages } - import bs._ - import bs.ArgsMap.isTrue - import play.api.mvc.Call - - /** - * Class with relevant variables for a field to pass it to the helper and field constructor - * - withFeedbak: indicates if the feedback icons are allowed - * - withLabelFor: indicates if the label's "for" attribute should be shown - * - args: list of available arguments for the helper and field constructor - */ - case class B3FieldInfo(field: Field, withFeedback: Boolean, withLabelFor: Boolean, args: Seq[(Symbol, Any)], override val messages: Messages) extends BSFieldInfo(field, args, messages) { - - /* List with every "info" and its corresponding ARIA id. Ex: ("foo_info_0" -> "foo constraint") */ - val infos: Seq[(String, String)] = { - val feedbackInfosButErrors = BSFieldInfo.feedbackInfosButErrors(argsMap, messages).zipWithIndex.map { - case (info, i) => (id + "_info_" + i, info) - } - if (feedbackInfosButErrors.size > 0) - feedbackInfosButErrors - else - BSFieldInfo.helpInfos(Some(field), argsMap, messages).zipWithIndex.map { - case (info, i) => (id + "_info_" + i, info) - } - } - - /* List with the errors and infos */ - def errorsAndInfos = errors ++ infos - - /* The optional validation state ("success", "warning" or "error") */ - override lazy val status: Option[String] = B3FieldInfo.status(hasErrors, argsMap) - - /* Each boolean indicate if a any of the corresponding feedback icons should be shown */ - val (showIconError, showIconWarning, showIconValid) = { - if (!withFeedback) (false, false, false) - else if (hasErrors) (isTrue(argsMap, '_showIconOnError), false, false) - else if (isTrue(argsMap, '_showIconWarning)) (false, true, false) - else (false, false, isTrue(argsMap, '_showIconValid)) - } - - /* Indicates if any of the previous feedback icons should be shown */ - def hasFeedback(implicit fc: B3FieldConstructor): Boolean = withFeedback && (fc.withFeedbackIcons || showIconError || showIconWarning || showIconValid) - - /* The optional validation state for the form-group ("has-success", "has-warning", "has-error") with the optional "has-feedback" */ - def statusWithFeedback(implicit fc: B3FieldConstructor): Option[String] = B3FieldInfo.statusWithFeedback(status, hasFeedback) - - /* Returns the corresponding icon from the validation status */ - def feedbackIcon: Option[String] = status.map { - _ match { - case "error" => "glyphicon-remove" - case "warning" => "glyphicon-warning-sign" - case "success" => "glyphicon-ok" - } - } - - /* ARIA id for the feedback icons (ex: "foo_status") */ - def ariaFeedbackId: String = id + "_status" - - /* List of every ARIA id */ - def ariaIds(implicit fc: B3FieldConstructor): Seq[String] = (if (hasFeedback) Seq(ariaFeedbackId) else Nil) ++ infos.map(_._1) ++ errors.map(_._1) - - /* - * Map with the inner args, i.e. those args for the helper itself removing those ones reserved for the field constructor. - * It adds the ARIA attributes and removes the underscored reserved for the field constructor and the `id and `value ones that are - * managed independently. - */ - def innerArgsMap(implicit fc: B3FieldConstructor): Map[Symbol, Any] = ( - (if (ariaIds.size > 0) Seq(Symbol("aria-describedby") -> ariaIds.mkString(" ")) else Nil) ++ - (if (hasErrors) Seq(Symbol("aria-invalid") -> "true") else Nil) ++ - BSFieldInfo.constraintsArgs(field, messages) ++ - Args.inner( - Args.remove(args, 'id, 'value).map { - case arg if arg._1 == 'placeholder => Args.msg(arg)(messages) - case other => other - } - ) - ).toMap - } - - /** - * Companion object for class B3FieldInfo - */ - object B3FieldInfo { - /* The optional validation state ("success", "warning" or "error") */ - def status(hasErrors: Boolean, argsMap: Map[Symbol, Any]): Option[String] = { - if (hasErrors) - Some("error") - else if (ArgsMap.isNotFalse(argsMap, '_warning) || isTrue(argsMap, '_showIconWarning)) - Some("warning") - else if (ArgsMap.isNotFalse(argsMap, '_success) || isTrue(argsMap, '_showIconValid)) - Some("success") - else - None - } - - /* The optional validation state for the form-group ("has-success", "has-warning", "has-error") with the optional "has-feedback" */ - def statusWithFeedback(status: Option[String], hasFeedback: Boolean): Option[String] = status.map { "has-" + _ + (if (hasFeedback) " has-feedback" else "") } - - } - - /** - * Class with relevant variables for the global information of a multifield - * - fields: list of Fields - * - args: list of available arguments for the helper and the form-group - */ - case class B3MultifieldInfo(fields: Seq[Field], globalArguments: Seq[(Symbol, Any)], fieldsArguments: Seq[(Symbol, Any)], override val messages: Messages) extends BSMultifieldInfo(fields, globalArguments, fieldsArguments, messages) { - - /* List with every "info" */ - val infos: Seq[String] = { - val globalFeedbackInfosButErrors = BSFieldInfo.feedbackInfosButErrors(argsMap, messages) - if (globalFeedbackInfosButErrors.size > 0) - globalFeedbackInfosButErrors - else { - val globalHelpInfos = BSFieldInfo.helpInfos(None, argsMap, messages) - if (globalHelpInfos.size > 0) - globalHelpInfos - else { - fields.flatMap { field => - BSFieldInfo.helpInfos(Some(field), argsMap, messages) - } - } - } - } - - /* List with the errors and infos */ - def errorsAndInfos: Seq[String] = errors ++ infos - - /* The optional validation state ("success", "warning" or "error") */ - override lazy val status: Option[String] = B3FieldInfo.status(hasErrors, argsMap) - - /* The optional validation state for the form-group ("has-success", "has-warning", "has-error") with the optional "has-feedback" */ - def statusWithFeedback: Option[String] = B3FieldInfo.statusWithFeedback(status, hasFeedback = isTrue(argsMap, '_hasFeedback)) - - override lazy val globalArgs = { - val withoutHelp = Args.remove(globalArguments, '_help) - val withStatus = status.map(s => Args.withDefault(withoutHelp, '_class -> statusWithFeedback)).getOrElse(withoutHelp) - withStatus - } - } - - /** - * Custom FieldConstructor for the library. Every FieldConstructor must extend this functionality. - */ - trait B3FieldConstructor extends BSFieldConstructor[B3FieldInfo] { - /* Define the class of the corresponding form (ex: "form-horizontal", "form-inline", ...) */ - val formClass: String - val withFeedbackIcons: Boolean - } - - /** - * Renders an input form-group using the B3FieldConstructor. - * - withFeedbak: indicates if the feedback icons are allowed - * - withLabelFor: indicates if the label's "for" attribute should be shown - * - args: list of available arguments for the helper and field constructor - * - inputDef: function that returns a Html from a B3FieldInfo that contains all the information about the field - */ - def inputFormGroup(field: Field, withFeedback: Boolean, withLabelFor: Boolean, args: Seq[(Symbol, Any)])(inputDef: B3FieldInfo => Html)(implicit fc: B3FieldConstructor, messages: Messages) = - inputFormField(B3FieldInfo(field, withFeedback, withLabelFor, Args.withoutNones(args), messages))(inputDef)(fc) - - /** - * Renders a form-group using the B3FieldConstructor. - * - args: list of available arguments for the helper and the form-group - * - contentDef: function that returns a Html from a map of arguments - */ - def freeFormGroup(args: Seq[(Symbol, Any)])(contentDef: Map[Symbol, Any] => Html)(implicit fc: B3FieldConstructor, messages: Messages) = - freeFormField(args)(contentDef)(fc, messages) - - def multifieldFormGroup(fields: Seq[Field], globalArgs: Seq[(Symbol, Any)], fieldsArgs: Seq[(Symbol, Any)])(contentDef: B3MultifieldInfo => Html)(implicit fc: B3FieldConstructor, messages: Messages) = - multifieldFormField(B3MultifieldInfo(fields, globalArgs, fieldsArgs, messages))(contentDef)(fc) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def inputType(inputType: String, field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputWrapped(inputType, field, args: _*)(html => html)(fc, messages) - - def text(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("text", field, args: _*)(fc, messages) - def password(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("password", field.copy(value = Some("")), args: _*)(fc, messages) - def color(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("color", field, args: _*)(fc, messages) - def date(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("date", field, args: _*)(fc, messages) - def datetime(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("datetime", field, args: _*)(fc, messages) - def datetimeLocal(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("datetime-local", field, args: _*)(fc, messages) - def email(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("email", field, args: _*)(fc, messages) - def month(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("month", field, args: _*)(fc, messages) - def number(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("number", field, args: _*)(fc, messages) - def range(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("range", field, args: _*)(fc, messages) - def search(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("search", field, args: _*)(fc, messages) - def tel(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("tel", field, args: _*)(fc, messages) - def time(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("time", field, args: _*)(fc, messages) - def url(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("url", field, args: _*)(fc, messages) - def week(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = inputType("week", field, args: _*)(fc, messages) - - def hidden(name: String, value: Any, args: (Symbol, Any)*) = hiddenInput(name, value, args: _*) - def hidden(field: Field, args: (Symbol, Any)*) = hiddenInput(name = field.name, value = field.value.orElse(bs.Args.get(args, 'value)), (bs.Args.inner(bs.Args.remove(args, 'value))): _*) - - def radio(field: Field, args: (Symbol, Any)*)(content: Tuple3[Boolean, Boolean, B3FieldInfo] => Html)(implicit fc: B3FieldConstructor, messages: Messages) = radioWithContent(field, args: _*)(content)(fc, messages) - def radio(field: Field, options: Seq[(String, Any)], args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = radioWithOptions(field, options, args: _*)(fc, messages) - - def select(field: Field, args: (Symbol, Any)*)(content: Set[String] => Html)(implicit fc: B3FieldConstructor, messages: Messages) = selectWithContent(field, args: _*)(content)(fc, messages) - def select(field: Field, options: Seq[(String, String)], args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, messages: Messages) = selectWithOptions(field, options, args: _*)(fc, messages) - - def submit(args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, messages: Messages) = buttonType("submit", args: _*)(text)(fc, messages) - def reset(args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, messages: Messages) = buttonType("reset", args: _*)(text)(fc, messages) - def button(args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, messages: Messages) = buttonType("button", args: _*)(text)(fc, messages) - - def static(args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, messages: Messages) = staticBasic(args: _*)(text)(fc, messages) - def static(label: String, args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, messages: Messages) = staticBasic(Args.withDefault(args, '_label -> label): _*)(text)(fc, messages) - def static(label: Html, args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, messages: Messages) = staticBasic(Args.withDefault(args, '_label -> label): _*)(text)(fc, messages) - - def free(args: (Symbol, Any)*)(content: => Html)(implicit fc: B3FieldConstructor, messages: Messages) = freeFormGroup(args)(_ => content)(fc, messages) -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/radioOption.scala.html b/play25-bootstrap3/module/app/views/b3/radioOption.scala.html deleted file mode 100644 index d22a0b9..0000000 --- a/play25-bootstrap3/module/app/views/b3/radioOption.scala.html +++ /dev/null @@ -1,16 +0,0 @@ -@(inputValue: Any, label: Any, args: (Symbol, Any)*)(implicit extraInfo: (Boolean, Boolean, B3FieldInfo), fc: B3FieldConstructor, messages: Messages) -@displayInput(labelClass: String, fieldInfo: b3.B3FieldInfo) = { - -} -@defining(extraInfo) { case (inline, disabled, fieldInfo) => - @if(inline) { - @displayInput(labelClass = "radio-inline" + (if (disabled) " disabled" else ""), fieldInfo) - } else { -
- @displayInput(labelClass = "", fieldInfo) -
- } -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/radioWithContent.scala.html b/play25-bootstrap3/module/app/views/b3/radioWithContent.scala.html deleted file mode 100644 index 9ababd1..0000000 --- a/play25-bootstrap3/module/app/views/b3/radioWithContent.scala.html +++ /dev/null @@ -1,22 +0,0 @@ -@(field: Field, args: (Symbol, Any)*)(content: Tuple3[Boolean, Boolean, b3.B3FieldInfo] => Html)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@readonlyWrapper(name: String, value: Option[String], argsMap: Map[Symbol, Any], disabled: Boolean)(contentWrapped: Html) = { - @if(argsMap.contains('readonly)) { -
- @contentWrapped - -
- } else { @contentWrapped } -} -@defining({ - val argsMap = args.toMap - val inline = bs.ArgsMap.isTrue(argsMap, '_inline) || fc.formClass == "form-inline" - val readonly = bs.ArgsMap.isTrue(argsMap, 'readonly) - val disabled = readonly || bs.ArgsMap.isTrue(argsMap, 'disabled) - (argsMap, inline, disabled) -}) { case (argsMap, inline, disabled) => - @inputFormGroup(field, withFeedback = false, withLabelFor = false, bs.Args.withDefault(args, 'disabled -> disabled)) { fieldInfo => - @readonlyWrapper(fieldInfo.name, fieldInfo.value, argsMap, disabled) { - @content(inline, disabled, fieldInfo) - } - }(fc, messages) -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/radioWithOptions.scala.html b/play25-bootstrap3/module/app/views/b3/radioWithOptions.scala.html deleted file mode 100644 index a5edbe5..0000000 --- a/play25-bootstrap3/module/app/views/b3/radioWithOptions.scala.html +++ /dev/null @@ -1,6 +0,0 @@ -@(field: Field, options: Seq[(String, Any)], args: (Symbol, Any)*)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@radioWithContent(field, bs.Args.withDefault(args, '_hiddenValue -> options.headOption.map(_._1)):_*) { implicit extraInfo => - @options.map { v => - @radioOption(v._1, bs.Args.msg(v._2)(messages)) - } -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/selectOption.scala.html b/play25-bootstrap3/module/app/views/b3/selectOption.scala.html deleted file mode 100644 index 57366be..0000000 --- a/play25-bootstrap3/module/app/views/b3/selectOption.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(value: Any, name: Any, args: (Symbol, Any)*)(implicit values: Set[String], messages: Messages) - \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/selectWithContent.scala.html b/play25-bootstrap3/module/app/views/b3/selectWithContent.scala.html deleted file mode 100644 index f508c1b..0000000 --- a/play25-bootstrap3/module/app/views/b3/selectWithContent.scala.html +++ /dev/null @@ -1,35 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(content: Set[String] => Html)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@readonlyWrapper(selectName: String, value: Option[String], disabled: Boolean, argsMap: Map[Symbol, Any])(contentWrapped: Html) = { - @if(argsMap.contains('readonly)) { -
- @contentWrapped - -
- } else { @contentWrapped } -} -@defining({ - val argsMap = args.toMap - val readonly = bs.ArgsMap.isTrue(argsMap, 'readonly) - val disabled = readonly || bs.ArgsMap.isTrue(argsMap, 'disabled) - val multiple = bs.ArgsMap.isTrue(argsMap, 'multiple) - (argsMap, disabled, multiple) -}) { case (argsMap, disabled, multiple) => - @inputFormGroup(field, withFeedback = false, withLabelFor = true, bs.Args.withDefault(bs.Args.withAddingStringValue(args, 'class, "form-control"), 'disabled -> disabled)) { fieldInfo => - @defining( if(multiple) "%s[]".format(fieldInfo.name) else fieldInfo.name ) { selectName => - @defining( ( !field.indexes.isEmpty && multiple ) match { - case true => field.indexes.map( i => field("[%s]".format(i)).value ).flatten.toSet - case _ if multiple && fieldInfo.value.isDefined => fieldInfo.value.get.split(",").toSet - case _ => fieldInfo.value.toSet - }){ implicit values => - @readonlyWrapper(selectName, fieldInfo.value, disabled, argsMap) { - - } - } - } - }(fc, messages) -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/selectWithOptions.scala.html b/play25-bootstrap3/module/app/views/b3/selectWithOptions.scala.html deleted file mode 100644 index 6470cc8..0000000 --- a/play25-bootstrap3/module/app/views/b3/selectWithOptions.scala.html +++ /dev/null @@ -1,6 +0,0 @@ -@(field: Field, options: Seq[(String,String)], args: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@selectWithContent(field, bs.Args.withDefault(args, '_hiddenValue -> bs.Args.get(args, '_default).map(bs.Args.msg(_)(messages)).orElse(options.headOption.map(_._1))):_*) { implicit values => - @options.map { v => - @selectOption(v._1, bs.Args.msg(v._2)(messages)) - } -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/staticBasic.scala.html b/play25-bootstrap3/module/app/views/b3/staticBasic.scala.html deleted file mode 100644 index b9f2d2a..0000000 --- a/play25-bootstrap3/module/app/views/b3/staticBasic.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(args: (Symbol,Any)*)(text: => Html)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@freeFormGroup(bs.Args.withAddingStringValue(args, 'class, "form-control-static")) { innerArgsMap => -

@text

-}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/textarea.scala.html b/play25-bootstrap3/module/app/views/b3/textarea.scala.html deleted file mode 100644 index 8c2604e..0000000 --- a/play25-bootstrap3/module/app/views/b3/textarea.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@inputFormGroup(field, withFeedback = false, withLabelFor = true, bs.Args.withAddingStringValue(args, 'class, "form-control")) { fieldInfo => - -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/vertical/bsFieldConstructor.scala.html b/play25-bootstrap3/module/app/views/b3/vertical/bsFieldConstructor.scala.html deleted file mode 100644 index 3d2aa0a..0000000 --- a/play25-bootstrap3/module/app/views/b3/vertical/bsFieldConstructor.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@b3.bsFieldConstructorCommon(fieldInfo, inputHtml) { content => - @fieldInfo.labelOpt.map { label => - - } - @content -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/vertical/bsFormGroup.scala.html b/play25-bootstrap3/module/app/views/b3/vertical/bsFormGroup.scala.html deleted file mode 100644 index 064e7fd..0000000 --- a/play25-bootstrap3/module/app/views/b3/vertical/bsFormGroup.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) -@b3.bsFormGroupCommon(contentHtml, argsMap) { content => - @argsMap.get('_label).map { label => - - } - @content -} \ No newline at end of file diff --git a/play25-bootstrap3/module/app/views/b3/vertical/package.scala b/play25-bootstrap3/module/app/views/b3/vertical/package.scala deleted file mode 100644 index 3924516..0000000 --- a/play25-bootstrap3/module/app/views/b3/vertical/package.scala +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -package object vertical { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.Messages - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Vertical FieldConstructor. - */ - class VerticalFieldConstructor(val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* Define the class of the corresponding form */ - val formClass = "form-vertical" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit messages: Messages) = bsFieldConstructor(fieldInfo, inputHtml)(this, messages) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = bsFormGroup(contentHtml, argsMap)(messages) - } - - /** - * Creates a new VerticalFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific VerticalFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(withFeedbackIcons: Boolean = false): VerticalFieldConstructor = - new VerticalFieldConstructor(withFeedbackIcons) - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - def fieldConstructor(withFeedbackIcons: Boolean = false): B3FieldConstructor = - fieldConstructorSpecific(withFeedbackIcons) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: VerticalFieldConstructor => Html) = { - val vfc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.form(action, args: _*)(body(vfc))(vfc) - } - def formCSRF(action: Call, args: (Symbol, Any)*)(body: VerticalFieldConstructor => Html)(implicit request: RequestHeader) = { - val vfc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.formCSRF(action, args: _*)(body(vfc))(vfc, request) - } - -} \ No newline at end of file diff --git a/play25-bootstrap3/module/build.sbt b/play25-bootstrap3/module/build.sbt deleted file mode 100644 index 5903829..0000000 --- a/play25-bootstrap3/module/build.sbt +++ /dev/null @@ -1,70 +0,0 @@ -name := """play-bootstrap""" - -version := "1.4-P25-B3-SNAPSHOT" - -scalaVersion := "2.11.11" - -crossScalaVersions := Seq("2.11.11") - -resolvers ++= Seq( - "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases", - "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" -) - -libraryDependencies ++= Seq( - filters % "provided", - "com.adrianhurt" %% "play-bootstrap-core" % "1.4-P25-SNAPSHOT", - specs2 % Test -) - -lazy val root = (project in file(".")).enablePlugins(PlayScala) - - - -scalariformSettings - -//******************************* -// Maven settings -//******************************* - -sonatypeSettings - -publishMavenStyle := true - -organization := "com.adrianhurt" - -description := "This is a collection of input helpers and field constructors for Play Framework to render Bootstrap HTML code." - -homepage := Some(url("https://adrianhurt.github.io/play-bootstrap")) - -licenses := Seq("Apache License" -> url("https://github.com/adrianhurt/play-bootstrap/blob/master/LICENSE")) - -startYear := Some(2014) - -publishTo := { - val nexus = "https://oss.sonatype.org/" - if (isSnapshot.value) - Some("snapshots" at nexus + "content/repositories/snapshots") - else - Some("releases" at nexus + "service/local/staging/deploy/maven2") -} - -publishArtifact in Test := false - -pomIncludeRepository := { _ => false } - -pomExtra := ( - - git@github.com:adrianhurt/play-bootstrap.git - scm:git:git@github.com:adrianhurt/play-bootstrap.git - - - - adrianhurt - Adrian Hurtado - https://github.com/adrianhurt - - -) - -credentials += Credentials(Path.userHome / ".sbt" / "sonatype.credentials") diff --git a/play25-bootstrap3/module/project/build.properties b/play25-bootstrap3/module/project/build.properties deleted file mode 100644 index c364161..0000000 --- a/play25-bootstrap3/module/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Activator-generated Properties -#Mon Aug 11 18:06:16 BST 2014 -template.uuid=688014f0-0585-43e3-a9fa-d62f7d12f1ab -sbt.version=0.13.11 diff --git a/play25-bootstrap3/module/project/plugins.sbt b/play25-bootstrap3/module/project/plugins.sbt deleted file mode 100644 index 63f4ec9..0000000 --- a/play25-bootstrap3/module/project/plugins.sbt +++ /dev/null @@ -1,12 +0,0 @@ -resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" - -// The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.18") - -// web plugins - -addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") - -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.2") - -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") diff --git a/play25-bootstrap3/module/test/FieldConstructorsSpec.scala b/play25-bootstrap3/module/test/FieldConstructorsSpec.scala deleted file mode 100644 index 61d6ed2..0000000 --- a/play25-bootstrap3/module/test/FieldConstructorsSpec.scala +++ /dev/null @@ -1,226 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -import views.html.b3 -import TestUtils._ -import org.specs2.mutable.Specification -import views.html.helper.FieldConstructor -import play.api.data.Forms._ -import play.api.data._ -import play.api.{ Configuration, Environment } -import play.api.i18n.{ DefaultLangs, DefaultMessagesApi } -import play.twirl.api.Html -import play.api.mvc.Call - -object FieldConstructorsSpec extends Specification { - - val messagesApi = new DefaultMessagesApi(Environment.simple(), Configuration.reference, new DefaultLangs(Configuration.reference)) - implicit val messages = messagesApi.preferred(Seq.empty) - - def testFielConstructor(fcDefault: B3FieldConstructor, fcWithFeedbackIcons: B3FieldConstructor) = { - implicit val fc = fcDefault - val testInputString = "" - def testInput(field: Field, args: (Symbol, Any)*) = - b3.inputFormGroup(field, false, true, args) { _ => Html(testInputString) } - - val fooForm = Form(single("foo" -> Forms.nonEmptyText(maxLength = 8))) - val fooField = fooForm("foo") - - val simpleInput = testInput(fooField).body - def simpleInputWithArgs(args: (Symbol, Any)*)(implicit fc: B3FieldConstructor) = b3.text(fooField, args: _*).body - def simpleInputWithError(args: (Symbol, Any)*)(implicit fc: B3FieldConstructor) = b3.text(fooForm.withError("foo", "test-error-0").withError("foo", "test-error-1")("foo"), args: _*).body - - val labelExtraClasses = fc match { - case hfc: b3.horizontal.HorizontalFieldConstructor => " " + hfc.colLabel - case _ => "" - } - - "have the basic structure" in { - simpleInput must contain("class=\"form-group") - simpleInput must not contain ("has-error") - simpleInput must not contain ("aria-invalid") - simpleInput must contain(testInputString) - simpleInput must not contain ("class=\"help-block\"") - } - - "have a default id" in { - simpleInput must contain("id=\"foo_field\"") - } - - "allow setting a custom id" in { - simpleInputWithArgs('_id -> "customid") must contain("id=\"customid\"") - } - - "allow setting extra classes form-group" in { - clean(simpleInputWithArgs('_class -> "extra_class another_class")) must contain(s"""
"theLabel")) must contain(s"""""") - } - - "allow hide the label" in { - val labelString = s"""""" - clean(simpleInputWithArgs('_label -> "theLabel", '_hideLabel -> true)) must contain(labelString) - clean(simpleInputWithArgs('_hiddenLabel -> "theLabel")) must contain(labelString) - } - - "allow render without label" in { - simpleInputWithArgs() must not contain ("label") - } - - "allow rendering errors" in { - val test = simpleInputWithError() - test must contain("has-error") - test must contain("test-error-0") - test must contain("test-error-1") - } - - "allow showing constraints" in { - val test = simpleInputWithArgs('_showConstraints -> true) - test must contain("") - test must contain("") - test must contain("class=\"help-block\">" + messages("constraint.required") + "") - test must contain("class=\"help-block\">" + messages("constraint.maxLength", 8) + "") - } - - "allow showing help info" in { - simpleInputWithArgs('_help -> "test-help") must contain("test-help") - simpleInputWithArgs('_success -> "test-help") must contain("test-help") - simpleInputWithArgs('_warning -> "test-help") must contain("test-help") - simpleInputWithArgs('_error -> "test-help") must contain("test-help") - } - - "allow rendering erros and hide constraints when help info is present" in { - val test = simpleInputWithError('_showConstraints -> true, '_help -> "test-help") - test must contain("test-error-0") - test must contain("test-error-1") - test must contain("test-help") - test must not contain (" "ok" - case "warning" => "warning-sign" - case "error" => "remove" - } - - def withFeedbackIcon(status: String) = contain(clean(s""" - - ($status)""" - )) - def testStatus(status: String, withIcon: Boolean, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor) = { - val test = clean(simpleInputWithArgs(args: _*)) - test must withStatus(status, withIcon) - if (withIcon) { - test must withFeedbackIcon(status) - } else { - test must not(withFeedbackIcon(status)) - } - } - - testStatus("success", withIcon = false, '_success -> true) - testStatus("success", withIcon = false, '_success -> "test-help") - testStatus("warning", withIcon = false, '_warning -> true) - testStatus("warning", withIcon = false, '_warning -> "test-help") - testStatus("error", withIcon = false, '_error -> true) - testStatus("error", withIcon = false, '_error -> "test-help") - - "with feedback icons" in { - testStatus("success", withIcon = true, '_showIconValid -> true) - testStatus("success", withIcon = true, '_success -> "test-help", '_showIconValid -> true) - testStatus("warning", withIcon = true, '_showIconWarning -> true) - testStatus("warning", withIcon = true, '_warning -> "test-help", '_showIconWarning -> true) - testStatus("error", withIcon = true, '_error -> true, '_showIconOnError -> true) - testStatus("error", withIcon = true, '_error -> "test-help", '_showIconOnError -> true) - } - - "with automatic feedback icons" in { - testStatus("success", withIcon = true, '_success -> "test-help")(fcWithFeedbackIcons) - testStatus("warning", withIcon = true, '_warning -> "test-help")(fcWithFeedbackIcons) - testStatus("error", withIcon = true, '_error -> true)(fcWithFeedbackIcons) - testStatus("error", withIcon = true, '_error -> "test-help")(fcWithFeedbackIcons) - } - } - - "render aria attributes" in { - val test0 = simpleInputWithArgs() - test0 must not contain ("aria-invalid") - test0 must not contain ("aria-describedby") - test0 must not contain (" true, '_showIconOnError -> true) - test1 must contain("aria-invalid=\"true\"") - test1 must contain("aria-describedby=\"foo_status foo_info_0 foo_info_1 foo_error_0 foo_error_1\"") - test1 must contain(" "test-help", '_showIconValid -> true) - test2 must not contain ("aria-invalid") - test2 must contain("aria-describedby=\"foo_status foo_info_0\"") - test2 must contain(" Forms.text))("foo"), '_label -> "theLabel").body - body must contain(colLabel) - body must contain(colInput) - } - } - - "vertical field constructor" should { - implicit val verticalFieldConstructor = new b3.vertical.VerticalFieldConstructor() - val fcWithFeedbackIcons = new b3.vertical.VerticalFieldConstructor(withFeedbackIcons = true) - testFielConstructor(verticalFieldConstructor, fcWithFeedbackIcons) - } - - "inline field constructor" should { - implicit val inlineFieldConstructor = new b3.inline.InlineFieldConstructor() - val fcWithFeedbackIcons = new b3.inline.InlineFieldConstructor(withFeedbackIcons = true) - testFielConstructor(inlineFieldConstructor, fcWithFeedbackIcons) - } - - "clear field constructor" should { - implicit val clearFieldConstructor = b3.clear.fieldConstructor() - - "simply render the input" in { - val simpleInput = b3.text(Form(single("foo" -> Forms.text))("foo")).body.trim - simpleInput must startWith("") - // Make sure it doesn't have it twice - simpleInput.substring(simpleInput.indexOf(">") + 1) must not contain (">") - } - } -} \ No newline at end of file diff --git a/play25-bootstrap3/module/test/FormsSpec.scala b/play25-bootstrap3/module/test/FormsSpec.scala deleted file mode 100644 index 173dac5..0000000 --- a/play25-bootstrap3/module/test/FormsSpec.scala +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -import views.html.b3 -import TestUtils._ -import org.specs2.mutable.Specification -import play.api.data.Forms._ -import play.api.data._ -import play.api.{ Configuration, Environment } -import play.api.i18n.{ DefaultLangs, DefaultMessagesApi } -import play.twirl.api.Html -import play.api.mvc.Call - -object FormsSpec extends Specification { - - val messagesApi = new DefaultMessagesApi(Environment.simple(), Configuration.reference, new DefaultLangs(Configuration.reference)) - implicit val messages = messagesApi.preferred(Seq.empty) - - val vfc = b3.vertical.fieldConstructor() - val (colLabel, colInput) = ("col-md-2", "col-md-10") - val hfc = b3.horizontal.fieldConstructor(colLabel, colInput) - val ifc = b3.inline.fieldConstructor() - val cfc = b3.clear.fieldConstructor() - - val testContentString = "" - - val (method, action) = ("POST", "/handleRequest") - val fooCall = Call(method, action) - def fooFormBody(args: (Symbol, Any)*)(fc: b3.B3FieldConstructor) = b3.form(fooCall, args: _*)(Html(testContentString))(fc).body - - "@form" should { - - val simple = fooFormBody()(vfc) - - "have action and method" in { - simple must contain("action=\"" + action + "\"") - simple must contain("method=\"" + method + "\"") - } - - "add default class for each field constructor" in { - fooFormBody()(vfc) must contain("class=\"form-vertical") - fooFormBody()(hfc) must contain("class=\"form-horizontal") - fooFormBody()(ifc) must contain("class=\"form-inline") - fooFormBody()(cfc) must contain("class=\"form-clear") - } - - "allow setting custom class" in { - fooFormBody('class -> "customClass")(vfc) must contain("class=\"form-vertical customClass\"") - } - - "add form role as default" in { - simple must contain("role=\"form\"") - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = fooFormBody('extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test")(vfc) - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - - "render the content body" in { - simple must contain("") - } - } -} \ No newline at end of file diff --git a/play25-bootstrap3/module/test/HelpersSpec.scala b/play25-bootstrap3/module/test/HelpersSpec.scala deleted file mode 100644 index faf3955..0000000 --- a/play25-bootstrap3/module/test/HelpersSpec.scala +++ /dev/null @@ -1,735 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -import views.html.b3 -import TestUtils._ -import org.specs2.mutable.Specification -import views.html.helper._ -import play.api.data.Forms._ -import play.api.data._ -import play.api.{ Configuration, Environment } -import play.api.i18n.{ DefaultLangs, DefaultMessagesApi, Messages } -import play.twirl.api.{ Html, HtmlFormat } -import play.api.mvc.Call - -object HelpersSpec extends Specification { - - val messagesApi = new DefaultMessagesApi(Environment.simple(), Configuration.reference, new DefaultLangs(Configuration.reference)) - implicit val messages = messagesApi.preferred(Seq.empty) - - val vfc = b3.vertical.fieldConstructor() - val (colLabel, colInput) = ("col-md-2", "col-md-10") - val hfc = b3.horizontal.fieldConstructor(colLabel, colInput) - val ifc = b3.inline.fieldConstructor() - val cfc = b3.clear.fieldConstructor() - - /** - * A test field constructor that simply renders the input - */ - implicit val testFieldConstructor = new B3FieldConstructor { - val formClass = "" - val withFeedbackIcons = false - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit messages: Messages) = inputHtml - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = contentHtml - } - - val fooField = Form(single("foo" -> Forms.text))("foo") - def fooFieldFilled(v: String) = Form(single("foo" -> Forms.text)).fill(v)("foo") - - "@inputType" should { - - "allow setting a custom id" in { - val body = b3.inputType("text", fooField, 'id -> "someid").body - val idAttr = "id=\"someid\"" - body must contain(idAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(idAttr) + idAttr.length) must not contain (idAttr) - } - - "allow setting a custom type" in { - val body = b3.inputType("email", fooField).body - val typeAttr = "type=\"email\"" - body must contain(typeAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(typeAttr) + typeAttr.length) must not contain (typeAttr) - } - - "add form-control class as default" in { - b3.inputType("text", fooField).body must contain("class=\"form-control\"") - } - - "allow setting additional classes" in { - b3.inputType("text", fooField, 'class -> "extra_class").body must contain("class=\"form-control extra_class\"") - } - - "allow setting a default value" in { - val body = b3.inputType("text", fooField, 'value -> "defaultvalue").body - val valueAttr = "value=\"defaultvalue\"" - body must contain(valueAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(valueAttr) + valueAttr.length) must not contain (valueAttr) - } - - "allow being filled with a value" in { - val body = b3.inputType("text", fooFieldFilled("filledvalue"), 'value -> "defaultvalue").body - val valueAttr = "value=\"filledvalue\"" - body must contain(valueAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(valueAttr) + valueAttr.length) must not contain (valueAttr) - // Make sure it doesn't contain the default value - body must not contain ("value=\"defaultvalue\"") - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = b3.inputType("text", fooField, 'extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test").body - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - } - - val sampleArgs = Seq[(Symbol, Any)]('id -> "someid", 'foo -> "fooValue") - def sampleInputTypeBody(theType: String) = b3.inputType(theType, fooField, sampleArgs: _*).body.trim - - "@text" should { - "be equivalent to inputType with text type" in { - b3.text(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("text") - } - } - "@password" should { - "be equivalent to inputType with password type" in { - b3.password(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("password") - } - "not display its value" in { - b3.password(fooFieldFilled("barValue"), sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("password") - } - } - "@file" should { - "be equivalent to inputType with file type" in { - b3.file(fooField, (('class -> "form-control") +: sampleArgs): _*).body.trim must be equalTo sampleInputTypeBody("file") - } - } - - "@textarea" should { - - "allow setting a custom id" in { - val body = b3.textarea(fooField, 'id -> "someid").body - val idAttr = "id=\"someid\"" - body must contain(idAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(idAttr) + idAttr.length) must not contain (idAttr) - } - - "add form-control class as default" in { - b3.textarea(fooField).body must contain("class=\"form-control\"") - } - - "allow setting additional classes" in { - b3.textarea(fooField, 'class -> "extra_class").body must contain("class=\"form-control extra_class\"") - } - - "allow setting a default value" in { - val body = b3.textarea(fooField, 'value -> "defaultvalue").body - body must contain(">defaultvalue") - body must not contain ("value=\"defaultvalue\"") - } - } - - "@checkbox" should { - - val boolField = Form(single("foo" -> Forms.boolean))("foo") - def boolFieldFilled(v: Boolean) = Form(single("foo" -> Forms.boolean)).fill(v)("foo") - def stringFieldFilled(v: String) = Form(single("foo" -> Forms.text)).fill(v)("foo") - - "allow setting a custom id" in { - val body = b3.checkbox(boolField, 'id -> "someid").body - val idAttr = "id=\"someid\"" - body must contain(idAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(idAttr) + idAttr.length) must not contain (idAttr) - } - - "be unchecked by default" in { - val body = b3.checkbox(boolField).body - body must not contain ("checked") - body must contain("value=\"true\"") - } - - "allow setting a default custom value" in { - val body = b3.checkbox(boolField, 'value -> "bar").body - body must not contain ("checked") - body must contain("value=\"bar\"") - } - - "allow setting a default value for checked attribute" in { - val body = b3.checkbox(boolField, '_default -> true).body - body must contain("checked") - body must contain("value=\"true\"") - } - - "allow setting a default value for checked attribute with a custom value" in { - val body = b3.checkbox(boolField, 'value -> "bar", '_default -> true).body - body must contain("checked") - body must contain("value=\"bar\"") - } - - "allow being filled with a value" in { - val body = b3.checkbox(boolFieldFilled(true)).body - body must contain("checked") - body must contain("value=\"true\"") - } - - "allow being filled with a custom value" in { - val body = b3.checkbox(stringFieldFilled("bar"), 'value -> "bar").body - body must contain("checked") - body must contain("value=\"bar\"") - } - - "ignore default checked value if it is filled" in { - val body1 = b3.checkbox(boolFieldFilled(false), '_default -> true).body - body1 must not contain ("checked") - body1 must contain("value=\"true\"") - val body2 = b3.checkbox(stringFieldFilled(""), 'value -> "bar", '_default -> true).body - body2 must not contain ("checked") - body2 must contain("value=\"bar\"") - } - - "allow setting a forced value for checked attribute (always true)" in { - val body = b3.checkbox(boolField, 'checked -> true).body - body must contain("checked") - body must contain("value=\"true\"") - } - "allow setting a forced value for checked attribute (always false)" in { - val body = b3.checkbox(boolField, 'checked -> false).body - body must not contain ("checked") - body must contain("value=\"true\"") - } - - "add support to readonly attribute" in { - val bodyWithoutReadonly = b3.checkbox(boolField, 'value -> true).body - bodyWithoutReadonly must contain("
false, 'value -> true).body - bodyReadonlyFalse must contain("
") - - val bodyReadonlyTrue = b3.checkbox(boolField, 'readonly -> true, 'value -> true).body - bodyReadonlyTrue must contain("
") - bodyReadonlyTrue must contain("disabled=\"true\"") - bodyReadonlyTrue must contain("") - } - } - - "@radio" should { - - val fruits = Seq("A" -> "Apples", "P" -> "Pears", "B" -> "Bananas") - - "allow setting a custom id" in { - val body = b3.radio(fooField, fruits, 'id -> "someid").body - body must contain("id=\"someid_A\"") - body must contain("id=\"someid_P\"") - body must contain("id=\"someid_B\"") - } - - "be unchecked by default" in { - b3.radio(fooField, fruits).body must not contain ("checked") - } - - "allow setting a default value" in { - val body = b3.radio(fooField, fruits, 'value -> "B").body - val checkedAttr = "checked" - body must contain(checkedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(checkedAttr) + checkedAttr.length) must not contain (checkedAttr) - } - - "allow being filled with a value" in { - val body = b3.radio(fooFieldFilled("B"), fruits).body - val checkedAttr = "checked" - body must contain(checkedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(checkedAttr) + checkedAttr.length) must not contain (checkedAttr) - } - - "not be inline by default" in { - b3.radio(fooField, fruits).body must not contain ("radio-inline") - } - - "allow be inline" in { - b3.radio(fooField, fruits, '_inline -> true).body must contain("radio-inline") - } - - "add support to readonly attribute" in { - val bodyWithoutReadonly = b3.radio(fooField, fruits, 'value -> "B").body - bodyWithoutReadonly must not contain ("radio-group") - bodyWithoutReadonly must not contain ("disabled") - bodyWithoutReadonly must not contain (" false, 'value -> "B").body - bodyReadonlyFalse must contain("
") - bodyReadonlyFalse must not contain ("disabled=\"true\"") - bodyReadonlyFalse must contain("
") - - val bodyReadonlyTrue = b3.radio(fooField, fruits, 'readonly -> true, 'value -> "B").body - bodyReadonlyTrue must contain("
") - bodyReadonlyTrue must contain("disabled=\"true\"") - bodyReadonlyTrue must contain("
") - } - } - - "@select" should { - - val fruits = Seq("A" -> "Apples", "P" -> "Pears", "B" -> "Bananas") - - "allow setting a custom id" in { - val body = b3.select(fooField, fruits, 'id -> "someid").body - body must contain("id=\"someid\"") - } - - "add form-control class as default" in { - b3.select(fooField, fruits).body must contain("class=\"form-control\"") - } - - "allow setting additional classes" in { - b3.select(fooField, fruits, 'class -> "extra_class").body must contain("class=\"form-control extra_class\"") - } - - "be unselected by default" in { - b3.select(fooField, fruits).body must not contain ("selected") - } - - "allow setting a default value" in { - val body = b3.select(fooField, fruits, 'value -> "B").body - val selectedAttr = "selected" - body must contain(selectedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(selectedAttr) + selectedAttr.length) must not contain (selectedAttr) - } - - "allow being filled with a value" in { - val body = b3.select(fooFieldFilled("B"), fruits).body - val selectedAttr = "selected" - body must contain(selectedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(selectedAttr) + selectedAttr.length) must not contain (selectedAttr) - } - - "add support to readonly attribute" in { - val bodyWithoutReadonly = b3.select(fooField, fruits, 'value -> "B").body - bodyWithoutReadonly must not contain ("
") - bodyWithoutReadonly must not contain ("disabled") - bodyWithoutReadonly must not contain (" false, 'value -> "B").body - bodyReadonlyFalse must contain("
") - bodyReadonlyFalse must not contain ("disabled=\"true\"") - bodyReadonlyFalse must contain("") - - val bodyReadonlyTrue = b3.select(fooField, fruits, 'readonly -> true, 'value -> "B").body - bodyReadonlyTrue must contain("
") - bodyReadonlyTrue must contain("disabled=\"true\"") - bodyReadonlyTrue must contain("") - } - - "allow multiple" in { - val body = b3.select(fooField, fruits, 'multiple -> true, 'value -> "P,B").body - body must contain("multiple=\"true\"") - val selectedAttr = "selected" - body must contain(selectedAttr) - // Make sure it has it twice, but not more. - val restBody = body.substring(body.indexOf(selectedAttr) + selectedAttr.length) - restBody must contain(selectedAttr) - restBody.substring(restBody.indexOf(selectedAttr) + selectedAttr.length) must not contain (selectedAttr) - } - } - - "@hidden" should { - "be rendered correctly" in { - val body = clean(b3.hidden("testName", "testValue", 'foo -> "bar").body) - body must be equalTo """""" - } - "with Field object" in { - val body = clean(b3.hidden(fooField, 'value -> "testValue", 'foo -> "bar").body) - body must be equalTo """""" - } - "with filled Field object" in { - val body = clean(b3.hidden(fooFieldFilled("filledValue"), 'value -> "testValue", 'foo -> "bar").body) - body must be equalTo """""" - } - } - "@hiddens" should { - "be rendered correctly" in { - val body = clean(b3.hiddens("fooId" -> 1L, "barId" -> 2L).body) - body must be equalTo """""" - } - } - - "@color" should { - "be equivalent to inputType with date type" in { - b3.color(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("color") - } - } - "@date" should { - "be equivalent to inputType with date type" in { - b3.date(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("date") - } - } - "@datetime" should { - "be equivalent to inputType with date type" in { - b3.datetime(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("datetime") - } - } - "@datetimeLocal" should { - "be equivalent to inputType with date type" in { - b3.datetimeLocal(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("datetime-local") - } - } - "@email" should { - "be equivalent to inputType with email type" in { - b3.email(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("email") - } - } - "@month" should { - "be equivalent to inputType with date type" in { - b3.month(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("month") - } - } - "@number" should { - "be equivalent to inputType with date type" in { - b3.number(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("number") - } - } - "@range" should { - "be equivalent to inputType with date type" in { - b3.range(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("range") - } - } - "@search" should { - "be equivalent to inputType with date type" in { - b3.search(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("search") - } - } - "@tel" should { - "be equivalent to inputType with date type" in { - b3.tel(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("tel") - } - } - "@time" should { - "be equivalent to inputType with date type" in { - b3.time(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("time") - } - } - "@url" should { - "be equivalent to inputType with date type" in { - b3.url(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("url") - } - } - "@week" should { - "be equivalent to inputType with date type" in { - b3.week(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("week") - } - } - - "@formGroup" should { - - def testFormGroup(args: (Symbol, Any)*)(fc: b3.B3FieldConstructor, msgs: Messages) = - clean(b3.freeFormGroup(args)(innerArgs => Html(""))(fc, msgs).body) - - "vertical: show label" in { - testFormGroup('_class -> "theClass", '_id -> "theId", '_label -> "theLabel")(vfc, messages) must be equalTo clean(""" -
- - -
- """) - } - "vertical: without label" in { - testFormGroup('_class -> "theClass", '_id -> "theId")(vfc, messages) must be equalTo clean(""" -
- -
- """) - } - "horizontal: show label" in { - testFormGroup('_class -> "theClass", '_id -> "theId", '_label -> "theLabel")(hfc, messages) must be equalTo clean(""" -
- -
- -
-
- """) - } - "horizontal: without label" in { - testFormGroup('_class -> "theClass", '_id -> "theId")(hfc, messages) must be equalTo clean(""" -
-
- -
-
- """) - } - "inline: show label" in { - testFormGroup('_class -> "theClass", '_id -> "theId", '_label -> "theLabel")(ifc, messages) must be equalTo clean(""" -
- - -
- """) - } - "inline: without label" in { - testFormGroup('_class -> "theClass", '_id -> "theId")(ifc, messages) must be equalTo clean(""" -
- -
- """) - } - - "get the inner arguments for the content" in { - val body = b3.freeFormGroup(Seq('_class -> "theClass", '_underscored -> "underscored", 'foo -> "foo"))(innerArgsMap => Html(innerArgsMap.toSeq.map(a => s"""${a._1.name}="${a._2.toString}"""").mkString("")))(vfc, messages).body - body must not contain "_class=\"theClass\"" - body must not contain "_underscored=\"underscored\"" - body must contain("foo=\"foo\"") - } - } - - "@free" should { - "be rendered correctly" in { - clean(b3.free('foo -> "fooValue")(Html(""))(vfc, messages).body) must be equalTo clean(b3.freeFormGroup(Seq('foo -> "fooValue"))(_ => Html(""))(vfc, messages).body) - } - } - - "@static" should { - - "render with form-control-static class as default" in { - b3.static("theLabel")(Html("theText"))(vfc, messages).body must contain("

theText

") - } - - "allow setting additional classes" in { - b3.static("theLabel", 'class -> "extra_class")(Html("theText"))(vfc, messages).body must contain("

theText

") - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = b3.static("theLabel", 'extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test")(Html("theText"))(vfc, messages).body - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - } - - "@buttonType" should { - - val sampleType = "myButtonType" - val sampleContent = "sample-content" - def buttonTypeBody(args: (Symbol, Any)*) = b3.buttonType(sampleType, args: _*)(Html(sampleContent))(vfc, messages).body - - "allow setting a custom type" in { - val body = buttonTypeBody() - val typeAttr = "type=\"" + sampleType + "\"" - body must contain(typeAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(typeAttr) + typeAttr.length) must not contain (typeAttr) - } - "render content" in { - buttonTypeBody() must contain(sampleContent) - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = buttonTypeBody('extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test") - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - - "be rendered correctly" in { - val body = buttonTypeBody('id -> "someid", 'class -> "btn btn-default") - body must contain("") - } - } - - def sampleButtonTypeBody(theType: String) = b3.buttonType(theType, sampleArgs: _*)(Html("content"))(vfc, messages).body.trim - - "@submit" should { - "be equivalent to buttonType with submit type" in { - b3.submit(sampleArgs: _*)(Html("content"))(vfc, messages).body.trim must be equalTo sampleButtonTypeBody("submit") - } - } - "@reset" should { - "be equivalent to buttonType with reset type" in { - b3.reset(sampleArgs: _*)(Html("content"))(vfc, messages).body.trim must be equalTo sampleButtonTypeBody("reset") - } - } - "@button" should { - "be equivalent to buttonType with button type" in { - b3.button(sampleArgs: _*)(Html("content"))(vfc, messages).body.trim must be equalTo sampleButtonTypeBody("button") - } - } - - "@inputWrapped" should { - - "be equivalent to inputType for an empty wrapper" in { - val bodyInputType = clean(b3.inputType("text", fooField, 'id -> "someid").body) - val body = clean(b3.inputWrapped("text", fooField, 'id -> "someid")(x => x).body) - body must be equalTo bodyInputType - } - - "wrap the input" in { - val bodyInputType = clean(b3.inputType("text", fooField, 'id -> "someid").body) - val (wrapperPre, wrapperPost) = ("", "") - def wrap(input: Html) = HtmlFormat.fill(scala.collection.immutable.Seq(Html(wrapperPre), input, Html(wrapperPost))) - val body = clean(b3.inputWrapped("text", fooField, 'id -> "someid")(input => wrap(input)).body) - - val (indexOfWrapperPre, indexOfWrapperPost) = (body.indexOf(wrapperPre), body.indexOf(wrapperPost)) - - body.substring(0, indexOfWrapperPre) must be equalTo bodyInputType.substring(0, indexOfWrapperPre) - body.substring(indexOfWrapperPre, indexOfWrapperPre + wrapperPre.length) must be equalTo wrapperPre - body.substring(indexOfWrapperPre + wrapperPre.length, indexOfWrapperPost) must be equalTo bodyInputType.substring(indexOfWrapperPre, indexOfWrapperPost - wrapperPre.length) - body.substring(indexOfWrapperPost, indexOfWrapperPost + wrapperPost.length) must be equalTo wrapperPost - body.substring(indexOfWrapperPost + wrapperPost.length) must be equalTo bodyInputType.substring(indexOfWrapperPost - wrapperPre.length) - } - } - - "@multifield" should { - - val testInputsString = "" - val fooForm = Form(tuple("foo" -> Forms.nonEmptyText, "bar" -> Forms.nonEmptyText)) - val fooFormWithError = fooForm.withError("foo", "test-error") - - def multifield(form: Form[(String, String)], globalArgs: Seq[(Symbol, Any)] = Seq(), fieldsArgs: Seq[(Symbol, Any)] = Seq())(fc: b3.B3FieldConstructor, messages: Messages) = - clean(b3.multifield(form("foo"), form("bar"))(globalArgs, fieldsArgs)(cfc => Html(testInputsString))(fc, messages).body) - def fooMultifield(globalArgs: (Symbol, Any)*) = multifield(fooForm, globalArgs)(vfc, messages) - def fooMultifieldWithFielsArgs(fieldsArgs: (Symbol, Any)*) = multifield(fooForm, fieldsArgs = fieldsArgs)(vfc, messages) - - "have the basic structure" in { - val body = fooMultifield('_label -> "theLabel") - body must contain("class=\"form-group") - body must not contain ("has-error") - body must contain("") - body must contain(testInputsString) - body must not contain ("class=\"help-block\"") - } - - "behave as a horizontal field constructor" in { - val body = multifield(fooForm, Seq('_label -> "theLabel"))(hfc, messages) - body must contain("") - body must contain("
") - } - - "allow setting a custom id" in { - fooMultifield('_id -> "customid") must contain("id=\"customid\"") - } - - "allow setting extra classes form-group" in { - fooMultifield('_class -> "extra_class another_class") must contain("class=\"form-group extra_class another_class") - } - - "show label" in { - multifield(fooForm, Seq('_label -> "fooLabel"))(vfc, messages) must contain("") - multifield(fooForm, Seq('_label -> "fooLabel"))(hfc, messages) must contain("") - } - - "without label" in { - multifield(fooForm)(vfc, messages) must not contain ("label") - multifield(fooForm)(hfc, messages) must not contain ("label") - } - - "allow rendering errors" in { - val body = multifield(fooFormWithError)(vfc, messages) - body must contain("has-error") - body must contain("test-error") - } - - "allow showing constraints" in { - multifield(fooForm, fieldsArgs = Seq('_showConstraints -> true))(vfc, messages) must contain("" + messages("constraint.required") + "") - } - - "allow showing help info" in { - fooMultifield('_help -> "test-help") must contain("""test-help""") - fooMultifield('_success -> "test-help") must contain("""test-help""") - fooMultifieldWithFielsArgs('_success -> "test-help") must contain("""test-help""") - fooMultifield('_warning -> "test-help") must contain("""test-help""") - fooMultifieldWithFielsArgs('_warning -> "test-help") must contain("""test-help""") - fooMultifield('_error -> "test-help") must contain("""test-help""") - fooMultifieldWithFielsArgs('_error -> "test-help") must contain("""test-help""") - } - - "render validation states" in { - def withStatus(status: String, withFeedback: Boolean) = contain(s"""
"ok" - case "warning" => "warning-sign" - case "error" => "remove" - } - - def withFeedbackIcon(status: String) = contain(clean(s""" - - ($status)""" - )) - def testStatus(status: String, withIcon: Boolean, withFieldsArgs: Boolean, args: (Symbol, Any)*) = { - val test = if (withFieldsArgs) - clean(b3.multifield(fooForm("foo"))(globalArgs = if (withIcon) Seq('_hasFeedback -> true) else Seq(), fieldsArgs = args)(cfc => b3.text(fooForm("foo"), args: _*))(vfc, messages).body) - else - clean(b3.multifield(fooForm("foo"))(globalArgs = if (withIcon) (('_hasFeedback -> true) +: args) else args, fieldsArgs = Seq())(cfc => b3.text(fooForm("foo"), args: _*))(vfc, messages).body) - test must withStatus(status, withIcon) - if (withIcon) { - test must withFeedbackIcon(status) - } else { - test must not(withFeedbackIcon(status)) - } - } - - testStatus("success", withIcon = false, withFieldsArgs = false, '_success -> true) - testStatus("success", withIcon = false, withFieldsArgs = true, '_success -> true) - testStatus("success", withIcon = false, withFieldsArgs = false, '_success -> "test-help") - testStatus("success", withIcon = false, withFieldsArgs = true, '_success -> "test-help") - testStatus("warning", withIcon = false, withFieldsArgs = false, '_warning -> true) - testStatus("warning", withIcon = false, withFieldsArgs = true, '_warning -> true) - testStatus("warning", withIcon = false, withFieldsArgs = false, '_warning -> "test-help") - testStatus("warning", withIcon = false, withFieldsArgs = true, '_warning -> "test-help") - testStatus("error", withIcon = false, withFieldsArgs = false, '_error -> true) - testStatus("error", withIcon = false, withFieldsArgs = true, '_error -> true) - testStatus("error", withIcon = false, withFieldsArgs = false, '_error -> "test-help") - testStatus("error", withIcon = false, withFieldsArgs = true, '_error -> "test-help") - - "with feedback icons" in { - testStatus("success", withIcon = true, withFieldsArgs = false, '_showIconValid -> true) - testStatus("success", withIcon = true, withFieldsArgs = true, '_showIconValid -> true) - testStatus("success", withIcon = true, withFieldsArgs = false, '_success -> "test-help", '_showIconValid -> true) - testStatus("success", withIcon = true, withFieldsArgs = true, '_success -> "test-help", '_showIconValid -> true) - testStatus("warning", withIcon = true, withFieldsArgs = false, '_showIconWarning -> true) - testStatus("warning", withIcon = true, withFieldsArgs = true, '_showIconWarning -> true) - testStatus("warning", withIcon = true, withFieldsArgs = false, '_warning -> "test-help", '_showIconWarning -> true) - testStatus("warning", withIcon = true, withFieldsArgs = true, '_warning -> "test-help", '_showIconWarning -> true) - testStatus("error", withIcon = true, withFieldsArgs = false, '_error -> true, '_showIconOnError -> true) - testStatus("error", withIcon = true, withFieldsArgs = true, '_error -> true, '_showIconOnError -> true) - testStatus("error", withIcon = true, withFieldsArgs = false, '_error -> "test-help", '_showIconOnError -> true) - testStatus("error", withIcon = true, withFieldsArgs = true, '_error -> "test-help", '_showIconOnError -> true) - } - } - - } -} \ No newline at end of file diff --git a/play25-bootstrap3/module/test/TestUtils.scala b/play25-bootstrap3/module/test/TestUtils.scala deleted file mode 100644 index f189d89..0000000 --- a/play25-bootstrap3/module/test/TestUtils.scala +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -object TestUtils { - - // clean a string removing control characters and extra whitespaces to compare equivalent rendered codes - def clean(str: String) = str.filter(_ >= ' ').replaceAll("\\s+", " ").trim.replaceAll(">\\s+<", "><").replaceAll("\\s+\"", "\"").replaceAll("=\"\\s+", "=\"") - -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/Filters.scala b/play25-bootstrap3/sample/app/Filters.scala deleted file mode 100644 index 578e98d..0000000 --- a/play25-bootstrap3/sample/app/Filters.scala +++ /dev/null @@ -1,7 +0,0 @@ -import play.api.http.HttpFilters -import play.filters.csrf.CSRFFilter -import javax.inject.Inject - -class Filters @Inject() (csrfFilter: CSRFFilter) extends HttpFilters { - def filters = Seq(csrfFilter) -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/assets/javascripts/main.coffee b/play25-bootstrap3/sample/app/assets/javascripts/main.coffee deleted file mode 100644 index 7a9c2a7..0000000 --- a/play25-bootstrap3/sample/app/assets/javascripts/main.coffee +++ /dev/null @@ -1,104 +0,0 @@ - -############################################################################################################ -## Smoth scroll for docs - -scrollWithAnimation = ($id, duration) -> - $('html,body').animate({scrollTop: $id.offset().top - 55}, duration) - -############################################################################################################ -## For readonly example - -disableForm = ($form) -> - $formGroups = $form.find('.form-group:not(.always-editable)') - $formGroups.find('input:not([type="file"], [type="checkbox"], [type="radio"], [type="hidden"])').removeAttr('disabled').attr('readonly', true) - $formGroups.find('input[type="file"], input[type="checkbox"], input[type="radio"], select').attr('disabled', true) - $formGroups.find('.checkbox, .radio, .radio-inline').addClass('disabled') - $formGroups.find('.checkbox-group, .radio-group, .select-group').find('input[type="hidden"]').removeAttr('disabled readonly') - -enableForm = ($form) -> - $formGroups = $form.find('.form-group:not(.always-editable)') - $formGroups.find('input:not([type="file"], [type="checkbox"], [type="radio"], [type="hidden"])').removeAttr('disabled readonly') - $formGroups.find('input[type="file"], input[type="checkbox"], input[type="radio"], select').removeAttr('disabled readonly') - $formGroups.find('.checkbox, .radio, .radio-inline').removeClass('disabled') - $formGroups.find('.checkbox-group, .radio-group, .select-group').find('input[type="hidden"]').removeAttr('readonly').attr('disabled', true) - -############################################################################################################ -## DOCUMENT IS READY - INIT APP -############################################################################################################ -$ -> - - ## For readonly example - $('.btn-readonly-unlock').click (e) -> - if $(this).hasClass('locked') - $(this).removeClass('locked btn-primary').addClass('btn-danger').text('Lock readonly fields') - enableForm($('#form-readonly')) - else - $(this).removeClass('btn-danger').addClass('locked btn-primary').text('Unlock readonly fields') - disableForm($('#form-readonly')) - if /\/readonly\/?\?\w/.test(window.location.href) - params = window.location.href.split('?')[1].split('&') - params = (p.split('=') for p in params) - getParam = (name, params) -> - foundParams = (p for p in params when p[0] == name) - if foundParams.length > 0 then foundParams[0][1] else undefined - text = getParam "text", params - checkbox = getParam "checkbox", params - radio = getParam "radio", params - select = getParam "select", params - if text? or checkbox? or radio? or select? - $data = $('#bound-data') - $data.find('#data-text').text text - $data.find('#data-checkbox').text checkbox - $data.find('#data-radio').text radio - $data.find('#data-select').text select - $data.removeAttr('hidden') - - # Change also the value of its companion input - $('.checkbox-group input[type="checkbox"]').change -> - $(this).parents('.checkbox-group').find('input[type="hidden"]').val $(this).prop('checked') - $('.radio-group input[type="radio"]').change -> - $radioGroup = $(this).parents('.radio-group') - $radioGroup.find('input[type="hidden"]').val $radioGroup.find('input[type="radio"]:checked').val() - $('.select-group select').change -> - $(this).parents('.select-group').find('input[type="hidden"]').val $(this).val() - - $('.input-daterange').datepicker - format: "dd-mm-yyyy" - todayBtn: "linked" - todayHighlight: true - - $('body[tab="docs"]').scrollspy - target: '#sidebar' - offset: 60 - - $('a[href*="#"]:not([href="#"], [href*="#collapse"], [data-toggle])').click (e) -> - if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) - target = $(this.hash) - target = if target.length then target else $('[name=' + this.hash.slice(1) +']') - if (target.length) - scrollWithAnimation(target, 500) - - hash = location.hash - if hash.length > 0 - scrollWithAnimation($(hash), 10) - - - $('.apply-tweak').click (e) -> - if $(this).hasClass('active') - $('.form-inline').removeClass('align-top') - $(this).removeClass('btn-danger').addClass('btn-info') - else - $('.form-inline').addClass('align-top') - $(this).removeClass('btn-info').addClass('btn-danger') - - - - $('.input-number-plus').click (e) -> - $input = $(this).parent().find('input') - current = parseInt $input.val(), 10 - $input.val current+1 - - $('.input-number-minus').click (e) -> - $input = $(this).parent().find('input') - current = parseInt $input.val(), 10 - $input.val current-1 \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/assets/stylesheets/main.less b/play25-bootstrap3/sample/app/assets/stylesheets/main.less deleted file mode 100644 index a791d0c..0000000 --- a/play25-bootstrap3/sample/app/assets/stylesheets/main.less +++ /dev/null @@ -1,286 +0,0 @@ - -@nav-bg-color: #3264C8; -@nav-bg-color-hover: lighten(@nav-bg-color, 5%); -@nav-bg-color-active: lighten(@nav-bg-color, 15%); -@nav-color: #eeeeee; -@nav-color-hover: white; -@nav-color-active: white; -@bg-color: #fbfcfe; -@footer-bg-color: lighten(@nav-bg-color, 45%); - -@code-bg-color: #FFFFF8; - -@play-color: #93D53A; -@boostrap-color: #5C3F83; - -body { - padding-top: 60px; - background-color: @bg-color; -} -.navbar-mixin-active() { - background-color: @nav-bg-color-active; - color: @nav-color-active; -} -.navbar-mixin-hover() { - background-color: @nav-bg-color-hover; - color: white; -} -.navbar-default { - background-color: @nav-bg-color; - .navbar-brand { - color: @nav-color; - &:hover, &:focus { - .navbar-mixin-hover(); - } - &.active { - .navbar-mixin-active(); - } - } - .navbar-nav { - & > li > a { - color: @nav-color; - &:hover, &:focus { - .navbar-mixin-hover(); - } - } - & > .active > a { - &, &:hover, &:focus { - .navbar-mixin-active(); - } - } - & > .open > a { - &, &:hover, &:focus { - .navbar-mixin-active(); - } - } - } - .dropdown-menu { - background-color: @nav-bg-color-active; - & > li > a { - color: @nav-color-active; - &:hover { - .navbar-mixin-hover(); - } - } - } - .github a { - padding-top: 10px; - padding-bottom: 10px; - } - .version-badge .code { - color: white; - } - - a[version] { - padding: 5px 20px; - } - a.legacy { - font-style: italic; - color: #ddd !important; - } -} -.container { - max-width: 960px; -} -.version-badge { - .code { - font-size: 1.1em; - font-weight: bold; - color: @nav-bg-color; - } - .play-bootstrap { - & > span { - font-size: 0.9em; - font-weight: bold; - border: 1px solid @boostrap-color; - padding: 5px; - } - .play { - background-color: white; - color: @play-color; - border-top-left-radius: 5px; - border-bottom-left-radius: 5px; - } - .bootstrap { - background-color: @boostrap-color; - color: white; - border-top-right-radius: 5px; - border-bottom-right-radius: 5px; - } - } - a[version] { - padding: 5px 20px; - } -} -.header-with-logo { - & > div { - display: inline-block; - vertical-align: middle; - margin-right: 15px; - } -} -#github-buttons { - margin-top: 25px; - margin-bottom: 25px; - position: relative; - img { - position: absolute; - top: -5px; - left: 120px; - } -} -i.fa-github { - vertical-align: middle; -} -.footer { - background-color: @footer-bg-color; - margin-top: 20px; - padding: 20px 0; - line-height: 15px; -} - -h3, h4 { margin-top: 35px; } -h1 + h2, h2 + h3, h3 + h4 { margin-top: 15px; } - -input:invalid { color: red !important; } -.example-html5-validation input:valid { color: green !important; } - -.highlight { - background-color: @code-bg-color; -} -pre code { - white-space: pre; -} -span.def { - color: #888; - font-size: 0.75em; - font-style: italic; - margin-left: 20px; -} - -.tab-pane > .bs-example { - border-top: 0; - border-top-left-radius: 0; - border-top-right-radius: 0; -} - -.form-inline { - button.apply-tweak { - width: 100%; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - } - .tweak .highlight { - border-top-left-radius: 0; - border-top-right-radius: 0; - pre code { - color: #aaa; - } - } - &.align-top { - .form-group { - vertical-align: top; - } - .tweak .highlight pre code { - color: #d9534f; - } - } -} - -[data-toggle="collapse"] { - .fa.fa-caret { - float: right; - margin-left: 15px; - &:before { content: "\f0d7" } - } - &[aria-expanded="true"] .fa.fa-caret:before { content: "\f0d8" } -} - -.bs-docs-sidebar { - .nav > .active > a, .nav > .active:hover > a, .nav > .active:focus > a, .nav > li > a:hover { - color: @nav-bg-color; - border-color: @nav-bg-color; - } -} -.bs-docs-sidenav { - min-width: 210px; -} - -.changelog { - h2 { - font-size: 24px; - } - .lead { - font-size: 18px; - font-style: italic; - } - ul { - list-style-type: none; - padding-left: 20px; - & > li { - font-size: 15px; - } - } - .panel ul { list-style-type: square; } -} - - -// For the examples: - -.multi-checkbox-list.inline > div { - display: inline-block; - margin-right: 20px; -} - -.input-text-checkbox > .input-group-addon { - .checkbox { display: inline; } - label { - display: inline; - padding: 0; - input { - position: relative; - margin-left: 0; - } - } -} - -.input-daterange { - #dateStart + .form-control-feedback { right: 395px; } - #dateEnd + .form-control-feedback { right: 0px; } -} -.input-text-checkbox #foo + .form-control-feedback { right: 0px; } - -.input-number-plus, .input-number-minus { cursor: pointer; } - -.input-number { - width: 150px; - input { - text-align: center; - & + .form-control-feedback { - right: 40px; - } - } -} - -.my-form-group { - white-space: nowrap; - & > div.field-container { - width: 50%; - } - & > div { - display: inline-block; - white-space: normal; - vertical-align: middle; - margin: 0; - ul { - padding-left: 0; - list-style-type: none; - } - .help-error { - color: #a94442 - } - .help-info { - color: #8a6d3b; - } - } -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/controllers/Application.scala b/play25-bootstrap3/sample/app/controllers/Application.scala deleted file mode 100644 index 16aff33..0000000 --- a/play25-bootstrap3/sample/app/controllers/Application.scala +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package controllers - -import javax.inject.Inject -import play.api.i18n.{ MessagesApi, I18nSupport } -import play.api._ -import play.api.mvc._ -import play.api.data._ -import play.api.data.Forms._ -import play.api.data.validation.Constraints._ - -class Application @Inject() (val messagesApi: MessagesApi) extends Controller with I18nSupport { - - val fooForm = Form(single("foo" -> text(maxLength = 20))) - - val validationForm = Form(tuple( - "username" -> nonEmptyText(maxLength = 20), - "email" -> email, - "age" -> number(min = 18, max = 99), - "color" -> nonEmptyText.verifying(pattern("^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$".r)) - )) - - def index = Action { implicit request => Ok(views.html.index(fooForm, validationForm)) } - def vertical = Action { implicit request => Ok(views.html.vertical(fooForm)) } - def horizontal = Action { implicit request => Ok(views.html.horizontal(fooForm)) } - def inline = Action { implicit request => Ok(views.html.inline(fooForm)) } - def mixed = Action { implicit request => Ok(views.html.mixed(fooForm)) } - def readonly = Action { implicit request => Ok(views.html.readonly(fooForm)) } - def multifield = Action { implicit request => Ok(views.html.multifield(fooForm)) } - def extendIt = Action { implicit request => Ok(views.html.extendIt(fooForm)) } - def docs = Action { implicit request => Ok(views.html.docs(fooForm, validationForm)) } - -} diff --git a/play25-bootstrap3/sample/app/models/Fruit.scala b/play25-bootstrap3/sample/app/models/Fruit.scala deleted file mode 100644 index b3f2df2..0000000 --- a/play25-bootstrap3/sample/app/models/Fruit.scala +++ /dev/null @@ -1,3 +0,0 @@ -package models - -case class Fruit(id: Long, name: String, isCitrus: Boolean) \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/utils/BSVersion.scala b/play25-bootstrap3/sample/app/utils/BSVersion.scala deleted file mode 100644 index 63bdc96..0000000 --- a/play25-bootstrap3/sample/app/utils/BSVersion.scala +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package utils - -object BSVersion { - final val code = "1.1.2-P25-B3" - final val library = "1.1" - final val play = "Play 2.5" - final val play_code = "2.5" - final val bootstrap = "Bootstrap 3" - final val bootstrap_code = "3" - - final val repositoryBase = "master/play25-bootstrap3/module" - - final val repository = "https://github.com/adrianhurt/play-bootstrap" - def repositoryPath(path: String) = s"$repository/$path" - def repositoryFile(file: String) = s"$repository/blob/$repositoryBase/$file" - def repositoryFolder(folder: String) = s"$repository/tree/$repositoryBase/$folder" - - final val msgsName = "messages" - final val msgsClass = "Messages" - final val msgsArg = s"$msgsName: $msgsClass" -} diff --git a/play25-bootstrap3/sample/app/utils/SimplePrettifier.scala b/play25-bootstrap3/sample/app/utils/SimplePrettifier.scala deleted file mode 100644 index f5b93db..0000000 --- a/play25-bootstrap3/sample/app/utils/SimplePrettifier.scala +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package utils - -object SimplePrettifier { - - /** - * Counts how many tabs there are at the begining of the first line and - * removes this number of tabs at the begining of every line. After, it - * replaces all tabs by two spaces. - */ - def prettify(str: String): String = { - val i = str.indexOf('\n') + 1 - var n = 0 - while (str.charAt(i + n) == '\t') n += 1 - str.replaceAll(s"\n\t{$n}", "\n").replaceAll("\t", " ").trim - } -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/b3/datepicker.scala.html b/play25-bootstrap3/sample/app/views/b3/datepicker.scala.html deleted file mode 100644 index 258953d..0000000 --- a/play25-bootstrap3/sample/app/views/b3/datepicker.scala.html +++ /dev/null @@ -1,8 +0,0 @@ -@(startField: Field, startArgs: (Symbol,Any)*)(endField: Field, endArgs: (Symbol,Any)*)(globalArgs: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@b3.multifield( startField, endField )(globalArgs, startArgs ++ endArgs) { implicit cfc => -
- @b3.text(startField, startArgs:_*) - to - @b3.text(endField, endArgs:_*) -
-} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/b3/multiCheckbox.scala.html b/play25-bootstrap3/sample/app/views/b3/multiCheckbox.scala.html deleted file mode 100644 index 17513b8..0000000 --- a/play25-bootstrap3/sample/app/views/b3/multiCheckbox.scala.html +++ /dev/null @@ -1,8 +0,0 @@ -@(fieldsWithArgs: (Field, Seq[(Symbol,Any)])*)(globalArgs: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@b3.multifield( fieldsWithArgs.map(_._1):_* )(globalArgs, fieldsWithArgs.map(_._2).flatten) { implicit cfc => -
- @fieldsWithArgs.map { case (field, fieldArgs) => - @b3.checkbox(field, fieldArgs:_*) - } -
-} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/b3/my/email.scala.html b/play25-bootstrap3/sample/app/views/b3/my/email.scala.html deleted file mode 100644 index f4332e5..0000000 --- a/play25-bootstrap3/sample/app/views/b3/my/email.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit handler: b3.B3FieldConstructor, messages: Messages) -@b3.inputFormGroup(field, withFeedback = false, withLabelFor = true, bs.Args.withDefault(args, 'class -> "form-control")) { fieldInfo => -
- @@ - -
-} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/b3/my/number.scala.html b/play25-bootstrap3/sample/app/views/b3/my/number.scala.html deleted file mode 100644 index 12b461e..0000000 --- a/play25-bootstrap3/sample/app/views/b3/my/number.scala.html +++ /dev/null @@ -1,8 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit handler: b3.B3FieldConstructor, messages: Messages) -@b3.inputWrapped("text", field, args:_*) { input => -
- - @input - -
-} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/b3/my/vertical/bsFieldConstructor.scala.html b/play25-bootstrap3/sample/app/views/b3/my/vertical/bsFieldConstructor.scala.html deleted file mode 100644 index 2df8ee2..0000000 --- a/play25-bootstrap3/sample/app/views/b3/my/vertical/bsFieldConstructor.scala.html +++ /dev/null @@ -1,27 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@alertStatus = @{ - if (fieldInfo.hasErrors) - "alert-danger" - else if (bs.ArgsMap.isTrue(fieldInfo.argsMap, '_success)) - "alert-success" - else - "alert-info" -} -
-
- @fieldInfo.labelOpt.map { label => - - } - @inputHtml -
- -
\ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/b3/my/vertical/bsFormGroup.scala.html b/play25-bootstrap3/sample/app/views/b3/my/vertical/bsFormGroup.scala.html deleted file mode 100644 index cedb72e..0000000 --- a/play25-bootstrap3/sample/app/views/b3/my/vertical/bsFormGroup.scala.html +++ /dev/null @@ -1,16 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) -
-
- @argsMap.get('_label).map { label => - - } - @contentHtml -
- -
\ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/b3/my/vertical/package.scala b/play25-bootstrap3/sample/app/views/b3/my/vertical/package.scala deleted file mode 100644 index 4636ce9..0000000 --- a/play25-bootstrap3/sample/app/views/b3/my/vertical/package.scala +++ /dev/null @@ -1,43 +0,0 @@ -package views.html.b3.my - -package object vertical { - - import views.html.b3._ - import play.twirl.api.Html - import play.api.mvc.Call - import play.api.i18n.Messages - import views.html.helper._ - - /** - * Declares the class for the Vertical FieldConstructor. - */ - class VerticalFieldConstructor(val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* Define the default class of the corresponding form */ - val formClass = "form-my-vertical" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit messages: Messages) = bsFieldConstructor(fieldInfo, inputHtml)(this, messages) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = bsFormGroup(contentHtml, argsMap)(messages) - } - - /** - * Creates a new VerticalFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific VerticalFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - val fieldConstructorSpecific: VerticalFieldConstructor = new VerticalFieldConstructor() - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - val fieldConstructor: B3FieldConstructor = fieldConstructorSpecific - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: VerticalFieldConstructor => Html) = - views.html.b3.form(action, args: _*)(body(fieldConstructorSpecific))(fieldConstructorSpecific) - -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/b3/package.scala b/play25-bootstrap3/sample/app/views/b3/package.scala deleted file mode 100644 index 663105c..0000000 --- a/play25-bootstrap3/sample/app/views/b3/package.scala +++ /dev/null @@ -1,8 +0,0 @@ -package views.html.b4 - -package object fc { - /** - * Returns it as a B4FieldConstructor to use it as default within a template - */ - implicit val verticalFieldConstructor: B4FieldConstructor = my.vertical.fieldConstructor -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/b3/textWithCheckbox.scala.html b/play25-bootstrap3/sample/app/views/b3/textWithCheckbox.scala.html deleted file mode 100644 index db5aebd..0000000 --- a/play25-bootstrap3/sample/app/views/b3/textWithCheckbox.scala.html +++ /dev/null @@ -1,9 +0,0 @@ -@(textField: Field, textArgs: (Symbol,Any)*)(checkboxField: Field, checkboxArgs: (Symbol,Any)*)(globalArgs: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: Messages) -@b3.multifield(textField, checkboxField)(globalArgs, textArgs ++ checkboxArgs) { implicit cfc => -
- - @b3.checkbox(checkboxField, checkboxArgs:_*) - - @b3.text(textField, textArgs:_*) -
-} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/docs.scala.html b/play25-bootstrap3/sample/app/views/docs.scala.html deleted file mode 100644 index f85319f..0000000 --- a/play25-bootstrap3/sample/app/views/docs.scala.html +++ /dev/null @@ -1,832 +0,0 @@ -@(fooForm: Form[String], validationForm: Form[(String, String, Int, String)])(implicit messages: Messages) - -@import utils.BSVersion -@import models._ -@import tags._ -@implicitFieldConstructor = @{ b3.vertical.fieldConstructor() } -@horizontalFieldConstructor = @{ b3.horizontal.fieldConstructor("col-md-2", "col-md-10") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - -@fruitsWithCitrus = @{ Seq( - Fruit(1L, "Apple", false), - Fruit(2L, "Orange", true), - Fruit(3L, "Pear", false), - Fruit(4L, "Lemon", true), - Fruit(5L, "Banana", false) -)} - - -@main("Documentation", tab = "docs") { - -
-
- @b3.form(routes.Application.docs) { - -

- Documentation @versionBadge(explicit = true) -

-

This page explains each component in more details.

- - -

Field Constructors

-

Vertical forms

-

Horizontal forms

-

Inline forms

-

Clear field constructor

-

Specific field constructors

- -

Arguments (args)

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - }{ - @@b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - } - -

Special arguments (the underscored ones)

- -

Validation arguments

- @bsExampleWithCode { -
- @b3.text( validationForm("username"), '_label -> "Username", '_help -> "A username between 1 and 20 characters" ) - @b3.email( validationForm("email"), '_label -> "Email" ) - @b3.number( validationForm("age"), '_label -> "Age", '_help -> "From 18 to 99 years old" ) - @b3.text( validationForm("color"), '_label -> "Hexadecimal color", '_help -> "Format is #CCC or #CCCCCC" ) -
- }{ - @@b3.text( validationForm("username"), '_label -> "Username", '_help -> "A username between 1 and 20 characters" ) - @@b3.email( validationForm("email"), '_label -> "Email" ) - @@b3.number( validationForm("age"), '_label -> "Age", '_help -> "From 18 to 99 years old" ) - @@b3.text( validationForm("color"), '_label -> "Hexadecimal color", '_help -> "Format is #CCC or #CCCCCC" ) - } - - -

Optional arguments

-

Boolean arguments

-

Arguments with dashes (e.g. data-* attributes)

- - -

ARIA attributes

- - -

Forms @@(action: Call, args: (Symbol, Any)*)(body: => Html)(implicit fc: B3FieldConstructor)

-

Forms with a specific B3FieldConstructor

-

Forms with CSRF token

- - -

Input helpers

- -

About disabled and readonly attributes

-

Validation states & feedback icons

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_label -> "Success", '_success -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_success -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - @bsExampleWithCode { - @b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - - - -

b3.inputType @@(inputType: String, field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a simple input with a specific type attribute and it adds class="form-control" by default, but you can add an extra class with 'class -> "extra_class". -

- @bsExampleWithCode { - @b3.inputType( "text", fooForm("name"), 'class -> "extra_class", '_label -> "Name", 'placeholder -> "John Doe" ) - @b3.inputType( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - @b3.inputType( "password", fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - }{ - @@b3.inputType( "text", fooForm("name"), 'class -> "extra_class", '_label -> "Name", 'placeholder -> "John Doe" ) - @@b3.inputType( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.inputType( "password", fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - } - - -

b3.text @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="text". -

- @bsExampleWithCode { - @b3.text( fooForm("name"), '_label -> "Name", 'placeholder -> "John Doe" ) - }{ - @@b3.text( fooForm("name"), '_label -> "Name", 'placeholder -> "John Doe" ) - } - - -

b3.password @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="password". -

-

- For security reasons, this helper doesn't display the possible value the field could have (for example when the form is reloaded after a validation failure). -

- @bsExampleWithCode { - @b3.password( fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - }{ - @@b3.password( fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - } - - -

b3.file @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="file". -

- @bsExampleWithCode { - @b3.file( fooForm("file"), '_label -> "File" ) - @b3.file( fooForm("file"), '_label -> "File", 'class -> "form-control" ) - }{ - @@b3.file( fooForm("file"), '_label -> "File" ) - @@b3.file( fooForm("file"), '_label -> "File", 'class -> "form-control" ) - } - - - -

b3.textarea @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a textarea and it adds class="form-control" by default. -

- @bsExampleWithCode { - @b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - }{ - @@b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - } - - -

b3.checkbox @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a checkbox. It has the attribute value set to true by default, - but you can use another one using the 'value argument. -

-

- The special '_text argument lets you put a text after the checkbox. -

-

- Regarding to the checked attribute, if you want to set it to true as default, use '_default -> true. - And if you need to force its value use directly the 'checked argument. -

-

- It supports readonly attribute adding an additional disabled one and a - <input type="hidden">. -

- @bsExampleWithCode { - @b3.checkbox( fooForm("foo"), '_text -> "Remember me" ) - }{ - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me" ) - - // uses "bar" as value for the checkbox - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", 'value -> "bar" ) - - // checked by default (if the form is filled, this value will be taken) - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", '_default -> true ) - - // always checked (even if the form has been filled with a false) - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", 'checked -> true ) - - // disabled -> it will NOT be sent within the POST request - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", 'disabled -> true ) - - // readonly -> it will be sent within the POST request - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", 'readonly -> true ) - } -

- Note you can use any value for the _text argument. -

- @bsExampleWithCode { - @b3.checkbox( fooForm("foo"), '_text -> Html("""Do you want a beer? """) ) - }{ - @@b3.checkbox( fooForm("foo"), '_text -> Html("Do you want a beer? ") ) - } - - -

b3.radio @@(field: Field, options: Seq[(String, Any)], args: (Symbol, Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a radio. It supports readonly attribute adding an additional disabled - one and a <input type="hidden">. -

-

- It has an additional special _inline argument to make it an inline radio (for vertical and horizontal forms). -

- @bsExampleWithCode { - @b3.radio( fooForm("foo_radio1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - }{ - @@opts = @@{ Seq("M"->"Male","F"->"Female") } - - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group" ) - - // an inline radio within a vertical or horizontal form - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", '_inline -> true ) - - // with value "F" by default (if the form is filled, this value will be taken) - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", 'value -> "F" ) - - // disabled -> it will NOT be sent within the POST request - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", 'disabled -> true ) - - // readonly -> it will be sent within the POST request - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", 'readonly -> true ) - } -

- Note you can use any value for the options argument. -

- @bsExampleWithCode { - @b3.radio( fooForm("foo_radio2"), options = Seq("B" -> Html("""Beer """), "C" -> Html("""Coffee """)), '_label -> "What do you prefer?" ) - }{ - @@b3.radio( fooForm("foo"), options = Seq("B" -> Html("Beer "), "C" -> Html("Coffee ")), '_label -> "What do you prefer?" ) - } - -
b3.radio @@(field: Field, args: (Symbol, Any)*)(content: Tuple6[Boolean, Boolean, String, String, Option[String], Map[Symbol, Any]] => Html)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)
-
b3.radioOption @@(inputValue: Any, label: Any, args: (Symbol, Any)*)(implicit extraInfo: (Boolean, Boolean, String, String, Option[String], Map[Symbol,Any]))
-

- If you need more versatility you can fully customize your radio options: -

- @bsExampleWithCode { - @b3.radio( fooForm("foo_radio3"), '_label -> "Ok, now that we're alone, what do you really prefer?" ) { implicit extraInfo => - @b3.radioOption("B", Html("""Beer """)) - @b3.radioOption("B", Html("""Coffee """), 'disabled -> true) - } - }{ - @@b3.radio( fooForm("foo3"), '_label -> "Ok, now that we're alone, what do you really prefer?" ) { implicit extraInfo => - @@b3.radioOption("B", Html("Beer ")) - @@b3.radioOption("B", Html("Coffee "), 'disabled -> true) - } - } - - - - -

b3.select @@(field: Field, options: Seq[(String,String)], args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a select. It supports readonly attribute adding an additional disabled - one and a <input type="hidden">. -

- @bsExampleWithCode { - @b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Disabled", 'disabled -> true ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Readonly", 'readonly -> true ) - }{ - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - - // disabled -> it will NOT be sent within the POST request - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'disabled -> true ) - - // readonly -> it will be sent within the POST request - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'readonly -> true ) - } -

- You can add a default first value using the argument '_default with a string. - It will add a first option to the select with an empty string value. So you could add a - required constraint to the field to force the user to select one - other option. In addition, this default option is always disable to avoid the user to select it, - and if any other option is selected this default one will not appear at all. -

- @bsExampleWithCode { - @b3.select( fooForm("foo"), options = fruits, '_label -> "With default", '_default -> "Select an option" ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "With default and Pears as value", '_default -> "Select an option", 'value -> "P" ) - }{ - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", '_default -> "Select an option" ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "With default and Pears as value", '_default -> "Select an option", 'value -> "P" ) - } - -

- For a multiple select you only need to add the 'multiple argument. - In that case, the '_default argument will be ignored. -

- @bsExampleWithCode { - @b3.select( fooForm("foo"), options = fruits, '_label -> "Select Multiple", 'multiple -> true ) - }{ - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Fruits", 'multiple -> true ) - - // with value "A" and "B" by default - // it is a string with every value separated by commas - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Fruits", 'multiple -> true, 'value -> "A,B" ) - } - -
b3.select @@(field: Field, args: (Symbol,Any)*)(content: Set[String] => Html)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)
-
b3.selectOption @@(value: Any, name: Any, args: (Symbol, Any)*)(implicit values: Set[String])
-

- If you need more versatility you can fully customize your select options: -

- @bsExampleWithCode { - @b3.select( fooForm("foo"), '_label -> "Grouped select" ) { implicit values => - - @b3.selectOption("opt_1-1", "Option 1.1") - @b3.selectOption("opt_1-2", "Option 1.2", 'disabled -> true) - @b3.selectOption("opt_1-3", "Option 1.3") - - - @b3.selectOption("opt_2-1", "Option 2.1", 'disabled -> true) - @b3.selectOption("opt_2-2", "Option 2.2") - - } - - @b3.select( fooForm("foo"), '_label -> "Fruits select (lemon preselected)" ) { implicit values => - - @fruitsWithCitrus.filter(_.isCitrus).map { citrus => - @b3.selectOption(citrus.id, citrus.name, 'selected -> (citrus.name == "Lemon")) - } - - - @fruitsWithCitrus.filterNot(_.isCitrus).map { fruit => - @b3.selectOption(fruit.id, fruit.name) - } - - } - }{ - @@b3.select( fooForm("foo"), '_label -> "Grouped select" ) { implicit values => - - @@b3.selectOption("opt_1-1", "Option 1.1") - @@b3.selectOption("opt_1-2", "Option 1.2", 'disabled -> true) - @@b3.selectOption("opt_1-3", "Option 1.3") - - - @@b3.selectOption("opt_2-1", "Option 2.1", 'disabled -> true) - @@b3.selectOption("opt_2-2", "Option 2.2") - - } - - class Fruit (id: Long, name: String, isCitrus: Boolean) - - @@fruitsWithCitrus = @@{ Seq( - Fruit(1L, "Apple", false), - Fruit(2L, "Orange", true), - Fruit(3L, "Pear", false), - Fruit(4L, "Lemon", true), - Fruit(5L, "Banana", false) - )} - - @@b3.select( fooForm("foo"), '_label -> "Fruits select (lemon preselected)" ) { implicit values => - - @@fruitsWithCitrus.filter(_.isCitrus).map { citrus => - @@b3.selectOption(citrus.id, citrus.name, 'selected -> (citrus.name == "Lemon")) - } - - - @@fruitsWithCitrus.filterNot(_.isCitrus).map { fruit => - @@b3.selectOption(fruit.id, fruit.name) - } - - } - } - - -

b3.hidden @@(name: String, value: Any, args: (Symbol, Any)*)

-

- It simply renders a hidden input. -

- @code { - @@b3.hidden("fooName", "fooValue", 'fooAttr -> "fooAttrValue") - } -

Renders to:

- @code { - - } -
b3.hidden @@(field: Field, args: (Symbol, Any)*)
-

- You can also render a hidden input directly with a Field as you could do with a b3.text helper, for example. - It lets you be able to simply change a b3.text for a b3.hidden to hide it. -

-

- It will automatically take the name of the Field and it's value if present. You can set a default value using the argument - 'value. Finally, take into account that every "underscored" argument (with "_" as preffix) will be removed. -

- @code { - @@b3.hidden( fooForm("name"), '_label -> "Name", 'value -> "defaultValue", 'placeholder -> "John Doe" ) - } -

Renders to:

- @code { - - } - -

b3.hiddens @@(namesAndValues: (Any, Any)*)

-

- Render a list of hidden inputs. -

- @code { - @@b3.hiddens("fooId" -> 1L, "barId" -> 2L) - } -

Renders to:

- @code { - - - } - - - - -

New HTML5 helpers

-

- Important note: the new HTML5 input types are not fully supported for web browsers. Those not supported by old web browsers, will behave as input type text. -

- -

b3.color @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="color". -

- @bsExampleWithCode { - @b3.color( fooForm("color"), '_label -> "Color", 'value -> "#3264c8" ) - }{ - @@b3.color( fooForm("color"), '_label -> "Color", 'value -> "#3264c8" ) - } - -

b3.date @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="date". -

- @bsExampleWithCode { - @b3.date( fooForm("date"), '_label -> "Date" ) - }{ - @@b3.date( fooForm("date"), '_label -> "Date" ) - } - -

b3.datetime @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="datetime". -

- @bsExampleWithCode { - @b3.datetime( fooForm("datetime"), '_label -> "Datetime" ) - }{ - @@b3.datetime( fooForm("datetime"), '_label -> "Datetime" ) - } - -

b3.datetimeLocal @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="datetime-local". -

- @bsExampleWithCode { - @b3.datetimeLocal( fooForm("datetimeLocal"), '_label -> "Datetime-Local" ) - }{ - @@b3.datetimeLocal( fooForm("datetimeLocal"), '_label -> "Datetime-Local" ) - } - -

b3.email @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="email". -

- @bsExampleWithCode { - @b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - }{ - @@b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - } - -

b3.month @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="month". -

- @bsExampleWithCode { - @b3.month( fooForm("month"), '_label -> "Month" ) - }{ - @@b3.month( fooForm("month"), '_label -> "Month" ) - } - -

b3.number @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="number". -

- @bsExampleWithCode { - @b3.number( fooForm("number"), '_label -> "Number (0 to 50 with intervals of 5)", 'min -> 0, 'max -> 50, 'step -> 5 ) - }{ - @@b3.number( fooForm("number"), '_label -> "Number", 'min -> 0, 'max -> 50, 'step -> 5 ) - } - -

b3.range @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="range". -

- @bsExampleWithCode { - @b3.range( fooForm("range"), '_label -> "Range (0 to 50)", 'min -> 0, 'max -> 50 ) - }{ - @@b3.range( fooForm("range"), '_label -> "Range", 'min -> 0, 'max -> 50 ) - } - - -

- It is a short version of b3.inputType for type="search". -

- @bsExampleWithCode { - @b3.search( fooForm("search"), '_label -> "Search" ) - }{ - @@b3.search( fooForm("search"), '_label -> "Search" ) - } - -

b3.tel @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="tel". -

- @bsExampleWithCode { - @b3.tel( fooForm("tel"), '_label -> "Telephone" ) - }{ - @@b3.tel( fooForm("tel"), '_label -> "Telephone" ) - } - -

b3.time @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="time". -

- @bsExampleWithCode { - @b3.time( fooForm("time"), '_label -> "Time" ) - }{ - @@b3.time( fooForm("time"), '_label -> "Time" ) - } - -

b3.url @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="url". -

- @bsExampleWithCode { - @b3.url( fooForm("url"), '_label -> "URL" ) - }{ - @@b3.url( fooForm("url"), '_label -> "URL" ) - } - -

b3.week @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="week". -

- @bsExampleWithCode { - @b3.week( fooForm("week"), '_label -> "Week" ) - }{ - @@b3.week( fooForm("week"), '_label -> "Week" ) - } - - - - - -

More helpers

-

- The following helpers use an auxiliar helper that creates a form-group without a field. - Here are the special arguments they use: -

    -
  • _id: the id for the form-group.
  • -
  • _class: the class for the form-group (the form-group class is always added).
  • -
  • _label: the text for the label.
  • -
  • _help: a help text below the input.
  • -
-

- -

b3.static @@(label: String, args: (Symbol,Any)*)(text: => Html)(implicit fc: B3FieldConstructor)

-

- It renders a static control to place within your form. It takes a HTML as parameter, so you can - render whatever you want. Actually, it is like a wrapper for a static HTML. -

- @bsExampleWithCode { - @b3.static("Static HTML"){ This is a link } - }{ - @@b3.static("Static HTML"){ This is a link } - } -

- There are two equivalent more versions of b3.static helper: one for labels with HTML, and another one to omit the label. Note that you can also have a hidden label using '_hideLabel' argument. -

- @bsExampleWithCode { - @b3.static(Html("Label with icon ")){ Basic control with label } - @b3.static("Hidden label", '_hideLabel -> true){ Basic control with hidden label } - @b3.static(){ Basic control without label } - }{ - @@b3.static(Html("Label with icon ")){ Basic control with label } - @@b3.static("Hidden label", '_hideLabel -> true){ Basic control with hidden label } - @@b3.static(){ Basic control without label } - } - - -

b3.buttonType @@(buttonType: String, args: (Symbol,Any)*)(text: => Html)(implicit fc: b3.B3FieldConstructor)

-

- It renders a simple button to place within your form. It takes a HTML as parameter, so you can - render whatever you want. -

- @bsExampleWithCode { - @b3.buttonType("submit", 'class -> "btn btn-default"){ Sign in } - }{ - @@b3.buttonType("submit", 'class -> "btn btn-default"){ Sign in } - } - -

b3.submit @@(args: (Symbol,Any)*)(text: => Html)(implicit fc: B3FieldConstructor)

-

- It is a short version of b3.buttonType for type="submit". -

- @bsExampleWithCode { - @b3.submit('class -> "btn btn-primary"){ Sign in } - }{ - @@b3.submit('class -> "btn btn-primary"){ Sign in } - } - - -

b3.reset @@(args: (Symbol,Any)*)(text: => Html)(implicit fc: B3FieldConstructor)

-

- It is a short version of b3.buttonType for type="reset". -

- @bsExampleWithCode { - @b3.reset('class -> "btn btn-danger"){ Reset } - }{ - @@b3.reset('class -> "btn btn-danger"){ Reset } - } - -

b3.button @@(args: (Symbol,Any)*)(text: => Html)(implicit fc: B3FieldConstructor)

-

- It is a short version of b3.buttonType for type="button". -

- @bsExampleWithCode { - @b3.button('class -> "btn btn-default"){ Favorite } - }{ - @@b3.button('class -> "btn btn-default"){ Favorite } - } - - -

b3.free @@(args: (Symbol,Any)*)(content: => Html)(implicit fc: B3FieldConstructor)

-

- It renders whatever you want within a form-group div. -

- @bsExampleWithCode { - @b3.free('_id -> "idFormGroup") { - - Cancel - } - }{ - @@b3.free('_id -> "idFormGroup") { - - Cancel - } - } - - - - - - - - -

Your own custom helpers

-

- The purpose of these helpers is to be a tool for creating your own helpers. Please see more about creating new helpers - here. -

- -

b3.inputWrapped @@(inputType: String, field: Field, args: (Symbol,Any)*)(inputGroup: Html => Html)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- This is the same as b3.inputType but specifying a custom wrapper for the input tag. - It is useful for input groups and inputs with validation states and feedback icons. -

- @bsExampleWithCode { - @b3.inputWrapped( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) { input => -
- @@ - @input - -
- } - }{ - @@b3.inputWrapped( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) { input => -
- @@@@ - @@input - -
- } - } - -

b3.multifield @@(fields: Field*)(args: (Symbol,Any)*)(inputsHtml: (B3FieldConstructor, @BSVersion.msgsClass) => Html)(implicit fc: B3FieldConstructor, @BSVersion.msgsArg)

-

- Sometimes you may need two or more fields within the same line in a horizontal or vertical form (for a set of checkboxes, a date range, ...). -

-

- The helper b3.multifield tries to: -

    -
  • Manage a set of fields and group them within the same form-group.
  • -
  • Manage all of their errors, infos and constraints at the end of the form-group as if they were only one.
  • -
  • Take advantage of the helpers that are already implemented.
  • -
  • Be a tool to create your custom multifield helpers.
  • -
-

-

- To know how it works and how to use it go the the Multifield section. -

- - } -
- - - -
- -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/extendIt.scala.html b/play25-bootstrap3/sample/app/views/extendIt.scala.html deleted file mode 100644 index 9d8e550..0000000 --- a/play25-bootstrap3/sample/app/views/extendIt.scala.html +++ /dev/null @@ -1,79 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@import helper.Implicits._ -@implicitFieldConstructor = @{ b3.vertical.fieldConstructor() } - - -@main("Extend it", tab = "extendit") { - - @b3.form(routes.Application.extendIt) { - -

Implement your own helpers or field constructors

-

- This library tries to be an out-of-the-box plugin. You simply need to install the library and you can - start to write your forms. However, although it is a very versatile library, you may have different - necessities. Thus, let's see some examples to know how you could extend it. -

- -

Create your own helper

- @bsExample { - @b3.my.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - } - @code { - @@b3.my.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - } - -

The use of b3.inputWrapped

- @bsExampleWithCode { - @b3.my.number( fooForm("foo"), '_label -> "Number", 'value -> 0 ) - }{ - @@b3.my.number( fooForm("foo"), '_label -> "Number", 'value -> 0 ) - } - - -

Create your multifield helper

- - } - - -

Create your own field constructor

- @bsExampleWithCode { - @b3.my.vertical.form(routes.Application.extendIt) { implicit myfc => - @b3.my.email( fooForm("foo"), '_label -> "Email", '_error -> "And error occurred!", '_showConstraints -> true, 'placeholder -> "example@mail.com" ) - } - }{ -
-
- -
- @@ - -
-
- -
- } -

- And that's all, you now can use your own field constructor as any other with: -

- @code { - @@import b3.my.vertical.fieldConstructor // Declare it as default - - @@b3.my.email( fooForm("foo"), '_label -> "Email", '_error -> "And error occurred!", '_showConstraints -> true, 'placeholder -> "example@@mail.com" ) - } -

- Or even using it for specific forms: -

- @code { - @@b3.my.vertical.form(routes.Application.extendIt) { implicit myfc => - @@b3.my.email( fooForm("foo"), '_label -> "Email", '_error -> "And error occurred!", '_showConstraints -> true, 'placeholder -> "example@@mail.com" ) - } - } - -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/horizontal.scala.html b/play25-bootstrap3/sample/app/views/horizontal.scala.html deleted file mode 100644 index 44376eb..0000000 --- a/play25-bootstrap3/sample/app/views/horizontal.scala.html +++ /dev/null @@ -1,221 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@implicitFC = @{ b3.horizontal.fieldConstructor("col-md-4", "col-md-8") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Horizontal Form", tab = "styles") { - -

Horizontal Form

- -

Simple inputs

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@mail.com" ) -
-
- @b3.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @b3.file( fooForm("foo"), '_label -> "File" ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @@b3.file( fooForm("foo"), '_label -> "File" ) - } - -

More options

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) -
-
- @b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @b3.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @@b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @@b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @@b3.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) - } - - -

Textareas, checkboxes, radio buttons and selects

- @bsExampleWithCode { -
-
- @b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) -
-
- @b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) -
-
- }{ - @@b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - ... - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) - } - -

Disabled and readonly attributes

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) -
-
- @b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @@b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - } - -

Validation states

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- @b3.horizontal.form(routes.Application.horizontal, "col-md-4", "col-md-8", '_feedbackIcons -> true) { implicit fc => - @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - @b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - // With feedback icons - @@b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - Or - - // With feedback icons - @@b3.horizontal.form(routes.Application.horizontal, "col-md-4", "col-md-8", '_feedbackIcons -> true) { implicit fc => - @@b3.text( fooForm("foo"), '_label -> "Success", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - } - -

Customize them

- @bsExampleWithCode { -
-
- @b3.inputWrapped( "email", fooForm("foo"), '_label -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@ - @input -
- } - @b3.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
- - @input - -
- } -
-
- @b3.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @input -
- - - -
-
- } -
-
- }{ - @@b3.inputWrapped( "email", fooForm("foo"), '_label -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@@@ - @@input -
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @@input -
- -
-
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
- - @@input - -
- } - } - -

More helpers

- @bsExampleWithCode { -
-
- @b3.static("Static HTML"){ This is a link } - @b3.submit('class -> "btn btn-default"){ Submit me! } - @b3.free() { - - Cancel - } -
-
- }{ - @@b3.static("Static HTML"){ This is a link } - @@b3.submit('class -> "btn btn-default"){ Submit me! } - @@b3.free() { - - Cancel - } - } - -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/index.scala.html b/play25-bootstrap3/sample/app/views/index.scala.html deleted file mode 100644 index 7800b98..0000000 --- a/play25-bootstrap3/sample/app/views/index.scala.html +++ /dev/null @@ -1,92 +0,0 @@ -@(fooForm: Form[String], validationForm: Form[(String, String, Int, String)])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@import helper.Implicits._ - -@main("Play-Bootstrap", tab = "index") { - - - -

- This is a collection of input helpers and field constructors for - Play Framework to render - Bootstrap HTML code. -

- -
- - - - -
- - - -
-
- @bsExampleWithCode { - @b3.vertical.form(routes.Application.index) { implicit vfc => - @b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @b3.submit('class -> "btn btn-default"){ Sign in } - } - }{ - @@b3.vertical.form(routes.Application.index) { implicit vfc => - @@b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @@b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @@b3.submit('class -> "btn btn-default"){ Sign in } - } - } -
-
- @bsExampleWithCode { - @b3.horizontal.form(routes.Application.index, "col-md-2", "col-md-10") { implicit hfc => - @b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @b3.submit('class -> "btn btn-default"){ Sign in } - } - }{ - @@b3.horizontal.form(routes.Application.index, "col-md-2", "col-md-10") { implicit hfc => - @@b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @@b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @@b3.submit('class -> "btn btn-default"){ Sign in } - } - } -
-
- @bsExampleWithCode { - @b3.inline.form(routes.Application.index) { implicit ifc => - @b3.email( fooForm("email"), '_hiddenLabel -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("password"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @b3.submit('class -> "btn btn-default"){ Sign in } - } - }{ - @@b4.inline.form(routes.Application.index) { implicit ifc => - @@b3.email( fooForm("email"), '_hiddenLabel -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("password"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @@b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @@b3.submit('class -> "btn btn-default"){ Sign in } - } - } -
-
-} diff --git a/play25-bootstrap3/sample/app/views/inline.scala.html b/play25-bootstrap3/sample/app/views/inline.scala.html deleted file mode 100644 index 801f3b4..0000000 --- a/play25-bootstrap3/sample/app/views/inline.scala.html +++ /dev/null @@ -1,179 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@implicitFieldConstructor = @{ b3.inline.fieldConstructor() } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Inline Form", tab = "styles") { - -

Inline Form

- -

Simple inputs

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @b3.file( fooForm("foo"), '_hiddenLabel -> "File" ) - }{ - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @@b3.file( fooForm("foo"), '_hiddenLabel -> "File" ) - } - -

More options

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.text( fooForm("foo"), '_label -> "Show label", '_showLabel -> true, 'placeholder -> "Show label" ) - @b3.text( fooForm("foo"), '_hiddenLabel -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @b3.text( fooForm("foo"), '_hiddenLabel -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @b3.text( fooForm("foo"), '_hiddenLabel -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) - }{ - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.text( fooForm("foo"), '_label -> "Show label", '_showLabel -> true, 'placeholder -> "Show label" ) - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @@b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @@b3.text( fooForm("foo"), '_hiddenLabel -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) - } - - -

Textareas, checkboxes, radio buttons and selects

- @bsExampleWithCode { - @b3.textarea( fooForm("foo"), '_hiddenLabel -> "Textarea", 'rows -> 3 ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female") ) - @b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select" ) - @b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Multiple Select", 'multiple -> true ) - }{ - @@b3.textarea( fooForm("foo"), '_hiddenLabel -> "Textarea", 'rows -> 3 ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female") ) - - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - ... - @@b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select" ) - @@b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Multiple Select", 'multiple -> true ) - } - -

Disabled and readonly attributes

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_hiddenLabel -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - }{ - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @@b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @@b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - } - -

Validation states

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- @b3.inline.form(routes.Application.inline, '_feedbackIcons -> true) { implicit fc => - @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - @b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - // With feedback icons - @@b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - Or - - // With feedback icons - @@b3.inline.form(routes.Application.inline, '_feedbackIcons -> true) { implicit fc => - @@b3.text( fooForm("foo"), '_label -> "Success", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - } - -

Customize them

- @bsExampleWithCode { - @b3.inputWrapped( "email", fooForm("foo"), '_hiddenLabel -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@ - @input -
- } - @b3.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @input -
- - - -
-
- } - @b3.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Number", 'value -> 0 ) { input => -
- - @input - -
- } - }{ - @@b3.inputWrapped( "email", fooForm("foo"), '_hiddenLabel -> "Simple input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@@@ - @@input -
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @@input -
- -
-
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Number", 'value -> 0 ) { input => -
- - @@input - -
- } - } - -

More helpers

- @bsExampleWithCode { - @b3.submit('class -> "btn btn-default"){ Submit me! } - }{ - @@b3.submit('class -> "btn btn-default"){ Submit me! } - } - -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/main.scala.html b/play25-bootstrap3/sample/app/views/main.scala.html deleted file mode 100644 index aa9ffdd..0000000 --- a/play25-bootstrap3/sample/app/views/main.scala.html +++ /dev/null @@ -1,69 +0,0 @@ -@(title: String, tab: String = "", styles: Html = Html(""), scripts: Html = Html(""), modals: Html = Html(""))(content: Html) -@import utils.BSVersion -@import tags._ - - - - - @title - - - - - - - @styles - - - - - @scripts - - - - -
- @content -
- - - @modals - - diff --git a/play25-bootstrap3/sample/app/views/mixed.scala.html b/play25-bootstrap3/sample/app/views/mixed.scala.html deleted file mode 100644 index 597965f..0000000 --- a/play25-bootstrap3/sample/app/views/mixed.scala.html +++ /dev/null @@ -1,120 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@implicitFC = @{ b3.horizontal.fieldConstructor("col-md-2", "col-md-10") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Mixed Forms", tab = "styles") { - -

Mixed Forms

-

This page its an example to show how to mix different forms within the same view.

- -

A simple horizontal form

- @bsExampleWithCode { - @b3.form(routes.Application.mixed) { - @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Select a fruit" ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b3.submit('class -> "btn btn-default"){ Save changes } - } - }{ - @@b3.form(routes.Application.mixed) { - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select a fruit" ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b3.submit('class -> "btn btn-default"){ Save changes } - } - } - - -

The typical inline login form on top

- @bsExampleWithCode { - @b3.inline.form(routes.Application.mixed) { implicit ifc => - @b3.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @b3.submit('class -> "btn btn-default"){ Sign in } - } - }{ - @@b3.inline.form(routes.Application.mixed) { implicit ifc => - @@b3.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @@b3.submit('class -> "btn btn-default"){ Sign in } - } - } - - -

The typical vertical contact form on one side

- @bsExampleWithCode { -
-
- @b3.vertical.form(routes.Application.mixed) { implicit vfc => - @b3.text( fooForm("foo"), '_label -> "Your name", 'placeholder -> "Your contact name" ) - @b3.email( fooForm("foo"), '_label -> "Your email", 'placeholder -> "example@mail.com" ) - @b3.textarea( fooForm("foo"), '_label -> "What happened?", 'rows -> 3 ) - @b3.checkbox( fooForm("foo"), '_text -> "Send me a copy to my email", 'checked -> true ) - @b3.submit('class -> "btn btn-default"){ Send } - } -
-
- }{ - @@b3.vertical.form(routes.Application.mixed) { implicit vfc => - @@b3.text( fooForm("foo"), '_label -> "Your name", 'placeholder -> "Your contact name" ) - @@b3.email( fooForm("foo"), '_label -> "Your email", 'placeholder -> "example@@mail.com" ) - @@b3.textarea( fooForm("foo"), '_label -> "What happened?", 'rows -> 3 ) - @@b3.checkbox( fooForm("foo"), '_text -> "Send me a copy to my email", 'checked -> true ) - @@b3.submit('class -> "btn btn-default"){ Send } - } - } - - -

A different horizontal form

- @bsExampleWithCode { - @b3.horizontal.form(routes.Application.mixed, "col-lg-4", "col-lg-8") { implicit hfc => - @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.file( fooForm("foo"), '_label -> "File" ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox" ) - @b3.submit('class -> "btn btn-default"){ Save changes } - } - }{ - @@b3.horizontal.form(routes.Application.mixed, "col-lg-4", "col-lg-8") { implicit hfc => - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.file( fooForm("foo"), '_label -> "File" ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox" ) - @@b3.submit('class -> "btn btn-default"){ Save changes } - } - } - - -

A clear field constructor

- @bsExampleWithCode { - @b3.clear.form(routes.Application.mixed) { implicit cfc => - @b3.inputWrapped( "search", fooForm("foo"), 'placeholder -> "Text to search..." ) { input => -
- - @input - - - -
- } - } - }{ - @@b3.clear.form(routes.Application.mixed) { implicit cfc => - @@b3.inputWrapped( "search", fooForm("foo"), 'placeholder -> "Text to search..." ) { input => -
- - @@input - - - -
- } - } - } - - -

Mixed FieldConstructors within the same form

- -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/multifield.scala.html b/play25-bootstrap3/sample/app/views/multifield.scala.html deleted file mode 100644 index 2589094..0000000 --- a/play25-bootstrap3/sample/app/views/multifield.scala.html +++ /dev/null @@ -1,91 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@import helper.Implicits._ -@implicitFC = @{ b3.horizontal.fieldConstructor("col-md-2", "col-md-10") } - - -@main("Multifield", tab = "multifield") { - - @b3.form(routes.Application.multifield) { - -

Multifield support

-

- Sometimes you may need two or more fields within the same line in a horizontal or vertical form (for a set of - checkboxes, a date range, ...). That is the purpose of the helper b3.multifield. -

- -

Let's see a couple of examples

- -

A date range

- @bsExampleWithCode { - @b3.datepicker( fooForm("dateStart"), 'value -> "15-11-2014" )( - fooForm("dateEnd"), 'value -> "31-12-2014" )( - '_label -> "Date range", "data-date-start-date" -> "10-11-2014", '_help -> "Select a date range from 10-11-2014" ) - }{ - @@b3.datepicker( fooForm("dateStart"), 'value -> "31-10-2014" )( - fooForm("dateEnd"), 'value -> "31-12-2014" )( - '_label -> "Date range", "data-date-start-date" -> "01-01-2014", '_help -> "Select a date range from 10-11-2014" ) - } - -

A set of checkboxes

- @bsExampleWithCode { - @b3.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )( '_label -> "Checkboxes", 'class -> "multi-checkbox-list", '_help -> "Mark what you want" ) - @b3.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )('_label -> "Inline", 'class -> "multi-checkbox-list inline", '_help -> "Mark what you want") - }{ - @@b3.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )('_label -> "Checkboxes", 'class -> "multi-checkbox-list", '_help -> "Mark what you want") - @@b3.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )('_label -> "Inline", 'class -> "multi-checkbox-list inline", '_help -> "Mark what you want") - } - -

A textfield with a checkbox addon

- @bsExampleWithCode { - @b3.textWithCheckbox( fooForm("foo"), 'placeholder -> "a foo value" )( fooForm("fooSelected") )('_label -> "New task" ) - }{ - @@b3.textWithCheckbox( fooForm("foo"), 'placeholder -> "a foo value" )( fooForm("fooSelected") )('_label -> "New task" ) - } - -

Validation states and feedback icons

- @bsExampleWithCode { - @b3.datepicker( fooForm("dateStart"), 'value -> "15-11-2014", '_showIconWarning -> true )( - fooForm("dateEnd"), 'value -> "31-10-2014", '_showIconWarning -> true )( - '_label -> "Date range", '_hasFeedback -> true ) - - @b3.textWithCheckbox( fooForm("foo"), 'value -> "an incorrect value", '_error -> "The value is incorrect", '_showIconOnError -> true )( - fooForm("fooSelected") )( - '_label -> "New task", '_hasFeedback -> true ) - }{ - @@b3.datepicker( fooForm("dateStart"), 'value -> "15-11-2014", '_showIconWarning -> true )( - fooForm("dateEnd"), 'value -> "31-10-2014", '_showIconWarning -> true )( - '_label -> "Date range", '_hasFeedback -> true ) - - @@b3.textWithCheckbox( fooForm("foo"), 'value -> "an incorrect value", '_error -> "The value is incorrect", '_showIconOnError -> true )( - fooForm("fooSelected") )( - '_label -> "New task", '_hasFeedback -> true ) - } -

- The CSS needed for this last example: -

- @code { - .input-daterange #dateStart + .form-control-feedback { right: 395px; } - .input-daterange #dateEnd + .form-control-feedback { right: 0px; } - .input-text-checkbox #foo + .form-control-feedback { right: 0px; } - } - - } -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/readonly.scala.html b/play25-bootstrap3/sample/app/views/readonly.scala.html deleted file mode 100644 index d6e52c4..0000000 --- a/play25-bootstrap3/sample/app/views/readonly.scala.html +++ /dev/null @@ -1,38 +0,0 @@ -@(fooForm: Form[String])(implicit request: RequestHeader, messages: Messages) -@import utils.BSVersion -@import tags._ -@implicitFC = @{ b3.horizontal.fieldConstructor("col-md-2", "col-md-10") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Demo for Readonly Attributes", tab = "readonly") { - -

Demo for Readonly Attributes

-

- This page its an example to show how to use the readonly attribute for - checkbox, radio and select helpers. -

- - @b3.formCSRF(Call("GET", ""), 'id -> "form-readonly") { - @bsExampleWithCode { - @b3.text( fooForm("text"), '_label -> "Always editable", '_class -> "always-editable", 'value -> "demo text", 'placeholder -> "A simple text..." ) - @b3.checkbox( fooForm("checkbox"), '_text -> "Checkbox", 'value -> true, 'readonly -> true ) - @b3.radio( fooForm("radio"), options = Seq("M"->"Male","F"->"Female"), 'value -> "M", '_label -> "Radio Group", 'readonly -> true ) - @b3.select( fooForm("select"), options = fruits, '_label -> "Select", 'value -> "A", 'readonly -> true ) - @b3.free() { - - Unlock readonly fields - } - }{ - @@b3.text( fooForm("text"), '_label -> "Always editable", '_class -> "always-editable", 'value -> "demo text", 'placeholder -> "A simple text..." ) - @@b3.checkbox( fooForm("checkbox"), '_text -> "Checkbox", 'value -> true, 'readonly -> true ) - @@b3.radio( fooForm("radio"), options = Seq("M"->"Male","F"->"Female"), 'value -> "M", '_label -> "Radio Group", 'readonly -> true ) - @@b3.select( fooForm("select"), options = fruits, '_label -> "Select", 'value -> "A", 'readonly -> true ) - @@b3.free() { - - Unlock readonly fields - } - } - } -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/bsExample.scala.html b/play25-bootstrap3/sample/app/views/tags/bsExample.scala.html deleted file mode 100644 index 9472aec..0000000 --- a/play25-bootstrap3/sample/app/views/tags/bsExample.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(example: Html) -
- @example -
\ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/bsExampleWithCode.scala.html b/play25-bootstrap3/sample/app/views/tags/bsExampleWithCode.scala.html deleted file mode 100644 index f9cebc8..0000000 --- a/play25-bootstrap3/sample/app/views/tags/bsExampleWithCode.scala.html +++ /dev/null @@ -1,3 +0,0 @@ -@(theExample: Html)(theCode: Html) -@bsExample(theExample) -@code(theCode) \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/code.scala.html b/play25-bootstrap3/sample/app/views/tags/code.scala.html deleted file mode 100644 index a814ab5..0000000 --- a/play25-bootstrap3/sample/app/views/tags/code.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(code: Html) -
-
@utils.SimplePrettifier.prettify(code.toString)
-
\ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/docsReadonlyAttributes.scala.html b/play25-bootstrap3/sample/app/views/tags/docsReadonlyAttributes.scala.html deleted file mode 100644 index 7d38686..0000000 --- a/play25-bootstrap3/sample/app/views/tags/docsReadonlyAttributes.scala.html +++ /dev/null @@ -1,18 +0,0 @@ -@() -

- Both the disabled and readonly attributes for an input prevent the user from modify it. - However, the disabled attribute means this input will NOT be sent within the POST request, whereas - the readonly one means it will. -

-

- Nevertheless, for checkbox, radio and select tags it doesn't happen. To - support the readonly attribute for these tags, the corresponding helpers have been adapted to behave - as would be expected. To do that, when the readonly attribute appears the helper will: -

    -
  • add an additional disabled attribute
  • -
  • add an additional <input type="hidden"> with the desired value
  • -
  • wraps them with in a div (with class checkbox-group, radio-group or select-group)
  • -
- Note it only happens when the readonly attribute is present, even with a false value. - It is done to make it easier to modify its readonly behaviour using javascript. -

\ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/javaMessagesWarning.scala.html b/play25-bootstrap3/sample/app/views/tags/javaMessagesWarning.scala.html deleted file mode 100644 index ecf656e..0000000 --- a/play25-bootstrap3/sample/app/views/tags/javaMessagesWarning.scala.html +++ /dev/null @@ -1,19 +0,0 @@ -@(id: String = "") -@if(utils.BSVersion.play_code == "2.4") { -
- -
-
- From Play 2.4, the implicit Messages argument defined in your custom template collides with the implicit one taken from PlayMagicForJava object, and it raises - a compilation error. So you only need to remove this implicit argument from your custom template. -
-
-
-} \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/repository/file.scala.html b/play25-bootstrap3/sample/app/views/tags/repository/file.scala.html deleted file mode 100644 index 3264bde..0000000 --- a/play25-bootstrap3/sample/app/views/tags/repository/file.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(file: String, text: String = "") -@resource(utils.BSVersion.repositoryFile(file), text) \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/repository/folder.scala.html b/play25-bootstrap3/sample/app/views/tags/repository/folder.scala.html deleted file mode 100644 index 70698e3..0000000 --- a/play25-bootstrap3/sample/app/views/tags/repository/folder.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(folder: String, text: String = "") -@resource(utils.BSVersion.repositoryFile(folder), text) \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/repository/home.scala.html b/play25-bootstrap3/sample/app/views/tags/repository/home.scala.html deleted file mode 100644 index 57fed4d..0000000 --- a/play25-bootstrap3/sample/app/views/tags/repository/home.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(text: String = "Github", theClass: String = "") -@resource(utils.BSVersion.repository, text, theClass) \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/repository/resource.scala.html b/play25-bootstrap3/sample/app/views/tags/repository/resource.scala.html deleted file mode 100644 index 30ca245..0000000 --- a/play25-bootstrap3/sample/app/views/tags/repository/resource.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(resource: String, text: String = "", theClass: String = "") -@Html(if (text != "") text else resource.replaceAll("^.*/", "")) \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/tags/versionBadge.scala.html b/play25-bootstrap3/sample/app/views/tags/versionBadge.scala.html deleted file mode 100644 index 5d87ba7..0000000 --- a/play25-bootstrap3/sample/app/views/tags/versionBadge.scala.html +++ /dev/null @@ -1,12 +0,0 @@ -@(explicit: Boolean = false) -@import utils.BSVersion._ - - @code - - @if(explicit) { -  @play  @bootstrap  - } else { -  @play_code  @bootstrap_code  - } - - \ No newline at end of file diff --git a/play25-bootstrap3/sample/app/views/vertical.scala.html b/play25-bootstrap3/sample/app/views/vertical.scala.html deleted file mode 100644 index 97cc54b..0000000 --- a/play25-bootstrap3/sample/app/views/vertical.scala.html +++ /dev/null @@ -1,218 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages, request: RequestHeader) -@import utils.BSVersion -@import tags._ -@implicitFieldConstructor = @{ b3.vertical.fieldConstructor() } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Vertical Form", tab = "styles") { - -

Vertical Form

- -

Simple inputs

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@mail.com" ) -
-
- @b3.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @b3.file( fooForm("foo"), '_label -> "File" ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @@b3.file( fooForm("foo"), '_label -> "File" ) - } - -

More options

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) -
-
- @b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @b3.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @@b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @@b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @@b3.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) - } - - -

Textareas, checkboxes, radio buttons and selects

- @bsExampleWithCode { -
-
- @b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) -
-
- @b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) -
-
- }{ - @@b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - ... - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) - } - -

Disabled and readonly attributes

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) -
-
- @b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @@b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - } - -

Validation states

-@bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- @b3.vertical.form(routes.Application.vertical, '_feedbackIcons -> true) { implicit fc => - @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - @b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - // With feedback icons - @@b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - Or - - // With feedback icons - @@b3.vertical.form(routes.Application.vertical, '_feedbackIcons -> true) { implicit fc => - @@b3.text( fooForm("foo"), '_label -> "Success", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - } - - -

Customize them

- @bsExampleWithCode { -
-
- @b3.inputWrapped( "email", fooForm("foo"), '_label -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@ - @input -
- } - @b3.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
- - @input - -
- } -
-
- @b3.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @input -
- - - -
-
- } -
-
- }{ - @@b3.inputWrapped( "email", fooForm("foo"), '_label -> "Simple input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@@@ - @@input -
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @@input -
- -
-
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
- - @@input - -
- } - } - -

More helpers

- @bsExampleWithCode { - @b3.static("Static HTML"){ This is a link } - @b3.submit('class -> "btn btn-default"){ Submit me! } - @b3.free() { - - Cancel - } - }{ - @@b3.static("Static HTML"){ This is a link } - @@b3.submit('class -> "btn btn-default"){ Submit me! } - @@b3.free() { - - Cancel - } - } - -} \ No newline at end of file diff --git a/play25-bootstrap3/sample/build.sbt b/play25-bootstrap3/sample/build.sbt deleted file mode 100644 index 0185c2b..0000000 --- a/play25-bootstrap3/sample/build.sbt +++ /dev/null @@ -1,24 +0,0 @@ -name := """play-bootstrap-sample""" - -version := "1.4" - -scalaVersion := "2.11.11" - -routesGenerator := InjectedRoutesGenerator - -lazy val root = (project in file(".")).enablePlugins(PlayScala) - - -resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" - -libraryDependencies ++= Seq( - filters, - "com.adrianhurt" %% "play-bootstrap" % "1.4-P25-B3-SNAPSHOT", - "org.webjars" % "bootstrap" % "3.3.7-1" exclude("org.webjars", "jquery"), - "org.webjars" % "jquery" % "3.3.1-1", - "org.webjars" % "font-awesome" % "4.7.0", - "org.webjars" % "bootstrap-datepicker" % "1.4.0" exclude("org.webjars", "bootstrap") -) - - -scalariformSettings diff --git a/play25-bootstrap3/sample/conf/application.conf b/play25-bootstrap3/sample/conf/application.conf deleted file mode 100644 index 284a047..0000000 --- a/play25-bootstrap3/sample/conf/application.conf +++ /dev/null @@ -1,54 +0,0 @@ -# This is the main configuration file for the application. -# ~~~~~ - -# Secret key -# ~~~~~ -# The secret key is used to secure cryptographics functions. -# -# This must be changed for production, but we recommend not changing it in this file. -# -# See http://www.playframework.com/documentation/latest/ApplicationSecret for more details. -play.crypto.secret="AQD]D`KQXB4Bx`bSG9v1n[Piq;Q4d=BB>SxEJfo01DeQd9;0`cgc" - -# The application languages -# ~~~~~ -play.i18n.langs=[ "en" ] - -# The filters -# ~~~~~ -play.http.filters = "Filters" - -# Global object class -# ~~~~~ -# Define the Global object class for this application. -# Default to Global in the root package. -# application.global=Global - -# Router -# ~~~~~ -# Define the Router object to use for this application. -# This router will be looked up first when the application is starting up, -# so make sure this is the entry point. -# Furthermore, it's assumed your route file is named properly. -# So for an application router like `my.application.Router`, -# you may need to define a router file `conf/my.application.routes`. -# Default to Routes in the root package (and conf/routes) -# play.http.router=my.application.Routes - -# Database configuration -# ~~~~~ -# You can declare as many datasources as you want. -# By convention, the default datasource is named `default` -# -# db.default.driver=org.h2.Driver -# db.default.url="jdbc:h2:mem:play" -# db.default.user=sa -# db.default.password="" - -# Evolutions -# ~~~~~ -# You can disable evolutions if needed -# evolutionplugin=disabled - - - diff --git a/play25-bootstrap3/sample/conf/routes b/play25-bootstrap3/sample/conf/routes deleted file mode 100644 index 080c7cb..0000000 --- a/play25-bootstrap3/sample/conf/routes +++ /dev/null @@ -1,21 +0,0 @@ -# Routes -# This file defines all application routes (Higher priority routes first) -# ~~~~ - -# Home page -GET / controllers.Application.index -GET /vertical controllers.Application.vertical -GET /horizontal controllers.Application.horizontal -GET /inline controllers.Application.inline -GET /mixed controllers.Application.mixed -GET /readonly controllers.Application.readonly -GET /multifield controllers.Application.multifield -GET /extend-it controllers.Application.extendIt -GET /docs controllers.Application.docs - - -GET /changelog controllers.Default.redirect(to = "http://adrianhurt.github.io/play-bootstrap/changelog") - - -# Map static resources from the /public folder to the /assets URL path -GET /assets/*file controllers.Assets.at(path="/public", file) diff --git a/play25-bootstrap3/sample/project/build.properties b/play25-bootstrap3/sample/project/build.properties deleted file mode 100644 index 016511b..0000000 --- a/play25-bootstrap3/sample/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Activator-generated Properties -#Sun Aug 03 14:36:39 BST 2014 -template.uuid=688014f0-0585-43e3-a9fa-d62f7d12f1ab -sbt.version=0.13.11 diff --git a/play25-bootstrap3/sample/project/plugins.sbt b/play25-bootstrap3/sample/project/plugins.sbt deleted file mode 100644 index 66eed52..0000000 --- a/play25-bootstrap3/sample/project/plugins.sbt +++ /dev/null @@ -1,12 +0,0 @@ -resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" - -// The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.18") - -// web plugins - -addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0") - -addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6") - -addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") diff --git a/play25-bootstrap3/sample/public/images/favicon.ico b/play25-bootstrap3/sample/public/images/favicon.ico deleted file mode 100644 index ac4bf59..0000000 Binary files a/play25-bootstrap3/sample/public/images/favicon.ico and /dev/null differ diff --git a/play25-bootstrap3/sample/public/images/logo.gif b/play25-bootstrap3/sample/public/images/logo.gif deleted file mode 100644 index db8eced..0000000 Binary files a/play25-bootstrap3/sample/public/images/logo.gif and /dev/null differ diff --git a/play25-bootstrap3/sample/public/images/please_star.png b/play25-bootstrap3/sample/public/images/please_star.png deleted file mode 100644 index d9489ba..0000000 Binary files a/play25-bootstrap3/sample/public/images/please_star.png and /dev/null differ diff --git a/play25-bootstrap3/sample/public/stylesheets/docs.min.css b/play25-bootstrap3/sample/public/stylesheets/docs.min.css deleted file mode 100644 index 7da4e4a..0000000 --- a/play25-bootstrap3/sample/public/stylesheets/docs.min.css +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Bootstrap Docs (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under the Creative Commons Attribution 3.0 Unported License. For - * details, see http://creativecommons.org/licenses/by/3.0/. - */body{position:relative}.table code{font-size:13px;font-weight:400}.btn-outline{color:#563d7c;background-color:transparent;border-color:#563d7c}.btn-outline:hover,.btn-outline:focus,.btn-outline:active{color:#fff;background-color:#563d7c;border-color:#563d7c}.btn-outline-inverse{color:#fff;background-color:transparent;border-color:#cdbfe3}.btn-outline-inverse:hover,.btn-outline-inverse:focus,.btn-outline-inverse:active{color:#563d7c;text-shadow:none;background-color:#fff;border-color:#fff}.bs-docs-booticon{display:block;font-weight:500;color:#fff;text-align:center;cursor:default;background-color:#563d7c;border-radius:15%}.bs-docs-booticon-sm{width:30px;height:30px;font-size:20px;line-height:28px}.bs-docs-booticon-lg{width:144px;height:144px;font-size:108px;line-height:140px}.bs-docs-booticon-inverse{color:#563d7c;background-color:#fff}.bs-docs-booticon-outline{background-color:transparent;border:1px solid #cdbfe3}.bs-docs-nav{margin-bottom:0;background-color:#fff;border-bottom:0}.bs-home-nav .bs-nav-b{display:none}.bs-docs-nav .navbar-brand,.bs-docs-nav .navbar-nav>li>a{font-weight:500;color:#563d7c}.bs-docs-nav .navbar-nav>li>a:hover,.bs-docs-nav .navbar-nav>.active>a,.bs-docs-nav .navbar-nav>.active>a:hover{color:#463265;background-color:#f9f9f9}.bs-docs-nav .navbar-toggle .icon-bar{background-color:#563d7c}.bs-docs-nav .navbar-header .navbar-toggle{border-color:#fff}.bs-docs-nav .navbar-header .navbar-toggle:hover,.bs-docs-nav .navbar-header .navbar-toggle:focus{background-color:#f9f9f9;border-color:#f9f9f9}.bs-docs-footer{padding-top:40px;padding-bottom:40px;margin-top:100px;color:#777;text-align:center;border-top:1px solid #e5e5e5}.bs-docs-footer-links{padding-left:0;margin-top:20px;color:#999}.bs-docs-footer-links li{display:inline;padding:0 2px}.bs-docs-footer-links li:first-child{padding-left:0}@media (min-width:768px){.bs-docs-footer p{margin-bottom:0}}.bs-docs-social{margin-bottom:20px;text-align:center}.bs-docs-social-buttons{display:inline-block;padding-left:0;margin-bottom:0;list-style:none}.bs-docs-social-buttons li{display:inline-block;padding:5px 8px;line-height:1}.bs-docs-social-buttons .twitter-follow-button{width:225px!important}.bs-docs-social-buttons .twitter-share-button{width:98px!important}.github-btn{overflow:hidden;border:0}.bs-docs-masthead,.bs-docs-header{position:relative;padding:30px 15px;color:#cdbfe3;text-align:center;text-shadow:0 1px 0 rgba(0,0,0,.1);background-color:#6f5499;background-image:-webkit-gradient(linear,left top,left bottom,from(#563d7c),to(#6f5499));background-image:-webkit-linear-gradient(top,#563d7c 0,#6f5499 100%);background-image:-o-linear-gradient(top,#563d7c 0,#6f5499 100%);background-image:linear-gradient(to bottom,#563d7c 0,#6f5499 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#563d7c', endColorstr='#6F5499', GradientType=0);background-repeat:repeat-x}.bs-docs-masthead .bs-docs-booticon{margin:0 auto 30px}.bs-docs-masthead h1{font-weight:300;line-height:1;color:#fff}.bs-docs-masthead .lead{margin:0 auto 30px;font-size:20px;color:#fff}.bs-docs-masthead .version{margin-top:-15px;margin-bottom:30px;color:#9783b9}.bs-docs-masthead .btn{width:100%;padding:15px 30px;font-size:20px}@media (min-width:480px){.bs-docs-masthead .btn{width:auto}}@media (min-width:768px){.bs-docs-masthead{padding:80px 0}.bs-docs-masthead h1{font-size:60px}.bs-docs-masthead .lead{font-size:24px}}@media (min-width:992px){.bs-docs-masthead .lead{width:80%;font-size:30px}}.bs-docs-header{margin-bottom:40px;font-size:20px}.bs-docs-header h1{margin-top:0;color:#fff}.bs-docs-header p{margin-bottom:0;font-weight:300;line-height:1.4}.bs-docs-header .container{position:relative}@media (min-width:768px){.bs-docs-header{padding-top:60px;padding-bottom:60px;font-size:24px;text-align:left}.bs-docs-header h1{font-size:60px;line-height:1}}@media (min-width:992px){.bs-docs-header h1,.bs-docs-header p{margin-right:380px}}.carbonad{width:auto!important;height:auto!important;padding:20px!important;margin:30px -30px -31px!important;overflow:hidden;font-size:13px!important;line-height:16px!important;text-align:left;background:transparent!important;border:solid #866ab3!important;border-width:1px 0!important}.carbonad-img{margin:0!important}.carbonad-text,.carbonad-tag{display:block!important;float:none!important;width:auto!important;height:auto!important;margin-left:145px!important;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif!important}.carbonad-text{padding-top:0!important}.carbonad-tag{color:inherit!important;text-align:left!important}.carbonad-text a,.carbonad-tag a{color:#fff!important}.carbonad #azcarbon>img{display:none}@media (min-width:480px){.carbonad{width:330px!important;margin:20px auto!important;border-width:1px!important;border-radius:4px}.bs-docs-masthead .carbonad{margin:50px auto 0!important}}@media (min-width:768px){.carbonad{margin-right:0!important;margin-left:0!important}}@media (min-width:992px){.carbonad{position:absolute;top:0;right:15px;width:330px!important;padding:15px!important;margin:0!important}.bs-docs-masthead .carbonad{position:static}}.bs-docs-featurette{padding-top:40px;padding-bottom:40px;font-size:16px;line-height:1.5;color:#555;text-align:center;background-color:#fff;border-bottom:1px solid #e5e5e5}.bs-docs-featurette+.bs-docs-footer{margin-top:0;border-top:0}.bs-docs-featurette-title{margin-bottom:5px;font-size:30px;font-weight:400;color:#333}.half-rule{width:100px;margin:40px auto}.bs-docs-featurette h3{margin-bottom:5px;font-weight:400;color:#333}.bs-docs-featurette-img{display:block;margin-bottom:20px;color:#333}.bs-docs-featurette-img:hover{color:#428bca;text-decoration:none}.bs-docs-featurette-img img{display:block;margin-bottom:15px}@media (min-width:480px){.bs-docs-featurette .img-responsive{margin-top:30px}}@media (min-width:768px){.bs-docs-featurette{padding-top:100px;padding-bottom:100px}.bs-docs-featurette-title{font-size:40px}.bs-docs-featurette .lead{max-width:80%;margin-right:auto;margin-left:auto}.bs-docs-featured-sites .col-sm-3:first-child img{border-top-left-radius:4px;border-bottom-left-radius:4px}.bs-docs-featured-sites .col-sm-3:last-child img{border-top-right-radius:4px;border-bottom-right-radius:4px}.bs-docs-featurette .img-responsive{margin-top:0}}.bs-docs-featured-sites{margin-right:-1px;margin-left:-1px}.bs-docs-featured-sites .col-sm-3{padding-right:1px;padding-left:1px}.bs-docs-featured-sites .img-responsive{margin-bottom:15px}@media (min-width:480px){.bs-docs-featured-sites .img-responsive{margin-bottom:0}}@media (max-width:480px){.bs-examples{margin-right:-10px;margin-left:-10px}.bs-examples>[class^=col-]{padding-right:10px;padding-left:10px}}.bs-docs-sidebar.affix{position:static}@media (min-width:768px){.bs-docs-sidebar{padding-left:20px}}.bs-docs-sidenav{margin-top:20px;margin-bottom:20px}.bs-docs-sidebar .nav>li>a{display:block;padding:4px 20px;font-size:13px;font-weight:500;color:#999}.bs-docs-sidebar .nav>li>a:hover,.bs-docs-sidebar .nav>li>a:focus{padding-left:19px;color:#563d7c;text-decoration:none;background-color:transparent;border-left:1px solid #563d7c}.bs-docs-sidebar .nav>.active>a,.bs-docs-sidebar .nav>.active:hover>a,.bs-docs-sidebar .nav>.active:focus>a{padding-left:18px;font-weight:700;color:#563d7c;background-color:transparent;border-left:2px solid #563d7c}.bs-docs-sidebar .nav .nav{display:none;padding-bottom:10px}.bs-docs-sidebar .nav .nav>li>a{padding-top:1px;padding-bottom:1px;padding-left:30px;font-size:12px;font-weight:400}.bs-docs-sidebar .nav .nav>li>a:hover,.bs-docs-sidebar .nav .nav>li>a:focus{padding-left:29px}.bs-docs-sidebar .nav .nav>.active>a,.bs-docs-sidebar .nav .nav>.active:hover>a,.bs-docs-sidebar .nav .nav>.active:focus>a{padding-left:28px;font-weight:500}.back-to-top,.bs-docs-theme-toggle{display:none;padding:4px 10px;margin-top:10px;margin-left:10px;font-size:12px;font-weight:500;color:#999}.back-to-top:hover,.bs-docs-theme-toggle:hover{color:#563d7c;text-decoration:none}.bs-docs-theme-toggle{margin-top:0}@media (min-width:768px){.back-to-top,.bs-docs-theme-toggle{display:block}}@media (min-width:992px){.bs-docs-sidebar .nav>.active>ul{display:block}.bs-docs-sidebar.affix,.bs-docs-sidebar.affix-bottom{width:213px}.bs-docs-sidebar.affix{position:fixed;top:20px}.bs-docs-sidebar.affix-bottom{position:absolute}.bs-docs-sidebar.affix-bottom .bs-docs-sidenav,.bs-docs-sidebar.affix .bs-docs-sidenav{margin-top:0;margin-bottom:0}}@media (min-width:1200px){.bs-docs-sidebar.affix-bottom,.bs-docs-sidebar.affix{width:263px}}.bs-docs-section{margin-bottom:60px}.bs-docs-section:last-child{margin-bottom:0}h1[id]{padding-top:20px;margin-top:0}.bs-callout{padding:20px;margin:20px 0;border:1px solid #eee;border-left-width:5px;border-radius:3px}.bs-callout h4{margin-top:0;margin-bottom:5px}.bs-callout p:last-child{margin-bottom:0}.bs-callout code{border-radius:3px}.bs-callout+.bs-callout{margin-top:-5px}.bs-callout-danger{border-left-color:#d9534f}.bs-callout-danger h4{color:#d9534f}.bs-callout-warning{border-left-color:#f0ad4e}.bs-callout-warning h4{color:#f0ad4e}.bs-callout-info{border-left-color:#5bc0de}.bs-callout-info h4{color:#5bc0de}.color-swatches{margin:0 -5px;overflow:hidden}.color-swatch{float:left;width:60px;height:60px;margin:0 5px;border-radius:3px}@media (min-width:768px){.color-swatch{width:100px;height:100px}}.color-swatches .gray-darker{background-color:#222}.color-swatches .gray-dark{background-color:#333}.color-swatches .gray{background-color:#555}.color-swatches .gray-light{background-color:#999}.color-swatches .gray-lighter{background-color:#eee}.color-swatches .brand-primary{background-color:#428bca}.color-swatches .brand-success{background-color:#5cb85c}.color-swatches .brand-warning{background-color:#f0ad4e}.color-swatches .brand-danger{background-color:#d9534f}.color-swatches .brand-info{background-color:#5bc0de}.color-swatches .bs-purple{background-color:#563d7c}.color-swatches .bs-purple-light{background-color:#c7bfd3}.color-swatches .bs-purple-lighter{background-color:#e5e1ea}.color-swatches .bs-gray{background-color:#f9f9f9}.bs-team .team-member{line-height:32px;color:#555}.bs-team .team-member:hover{color:#333;text-decoration:none}.bs-team .github-btn{float:right;width:180px;height:20px;margin-top:6px}.bs-team img{float:left;width:32px;margin-right:10px;border-radius:4px}.show-grid{margin-bottom:15px}.show-grid [class^=col-]{padding-top:10px;padding-bottom:10px;background-color:#eee;background-color:rgba(86,61,124,.15);border:1px solid #ddd;border:1px solid rgba(86,61,124,.2)}.bs-example{position:relative;padding:45px 15px 15px;margin:0 -15px 15px;border-color:#e5e5e5 #eee #eee;border-style:solid;border-width:1px 0;-webkit-box-shadow:inset 0 3px 6px rgba(0,0,0,.05);box-shadow:inset 0 3px 6px rgba(0,0,0,.05)}.bs-example:after{position:absolute;top:15px;left:15px;font-size:12px;font-weight:700;color:#959595;text-transform:uppercase;letter-spacing:1px;content:"Example"}.bs-example+.highlight{margin:-15px -15px 15px;border-width:0 0 1px;border-radius:0}@media (min-width:768px){.bs-example{margin-right:0;margin-left:0;background-color:#fff;border-color:#ddd;border-width:1px;border-radius:4px 4px 0 0;-webkit-box-shadow:none;box-shadow:none}.bs-example+.highlight{margin-top:-16px;margin-right:0;margin-left:0;border-width:1px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}}.bs-example .container{width:auto}.bs-example>p:last-child,.bs-example>ul:last-child,.bs-example>ol:last-child,.bs-example>blockquote:last-child,.bs-example>.form-control:last-child,.bs-example>.table:last-child,.bs-example>.navbar:last-child,.bs-example>.jumbotron:last-child,.bs-example>.alert:last-child,.bs-example>.panel:last-child,.bs-example>.list-group:last-child,.bs-example>.well:last-child,.bs-example>.progress:last-child,.bs-example>.table-responsive:last-child>.table{margin-bottom:0}.bs-example>p>.close{float:none}.bs-example-type .table .type-info{color:#999;vertical-align:middle}.bs-example-type .table td{padding:15px 0;border-color:#eee}.bs-example-type .table tr:first-child td{border-top:0}.bs-example-type h1,.bs-example-type h2,.bs-example-type h3,.bs-example-type h4,.bs-example-type h5,.bs-example-type h6{margin:0}.bs-example-bg-classes p{padding:15px}.bs-example>.img-circle,.bs-example>.img-rounded,.bs-example>.img-thumbnail{margin:5px}.bs-example>.table-responsive>.table{background-color:#fff}.bs-example>.btn,.bs-example>.btn-group{margin-top:5px;margin-bottom:5px}.bs-example>.btn-toolbar+.btn-toolbar{margin-top:10px}.bs-example-control-sizing select,.bs-example-control-sizing input[type=text]+input[type=text]{margin-top:10px}.bs-example-form .input-group{margin-bottom:10px}.bs-example>textarea.form-control{resize:vertical}.bs-example>.list-group{max-width:400px}.bs-example .navbar:last-child{margin-bottom:0}.bs-navbar-top-example,.bs-navbar-bottom-example{z-index:1;padding:0;overflow:hidden}.bs-navbar-top-example .navbar-header,.bs-navbar-bottom-example .navbar-header{margin-left:0}.bs-navbar-top-example .navbar-fixed-top,.bs-navbar-bottom-example .navbar-fixed-bottom{position:relative;margin-right:0;margin-left:0}.bs-navbar-top-example{padding-bottom:45px}.bs-navbar-top-example:after{top:auto;bottom:15px}.bs-navbar-top-example .navbar-fixed-top{top:-1px}.bs-navbar-bottom-example{padding-top:45px}.bs-navbar-bottom-example .navbar-fixed-bottom{bottom:-1px}.bs-navbar-bottom-example .navbar{margin-bottom:0}@media (min-width:768px){.bs-navbar-top-example .navbar-fixed-top,.bs-navbar-bottom-example .navbar-fixed-bottom{position:absolute}}.bs-example .pagination{margin-top:10px;margin-bottom:10px}.bs-example>.pager{margin-top:0}.bs-example-modal{background-color:#f5f5f5}.bs-example-modal .modal{position:relative;top:auto;right:auto;bottom:auto;left:auto;z-index:1;display:block}.bs-example-modal .modal-dialog{left:auto;margin-right:auto;margin-left:auto}.bs-example>.dropdown>.dropdown-toggle{float:left}.bs-example>.dropdown>.dropdown-menu{position:static;display:block;margin-bottom:5px;clear:left}.bs-example-tabs .nav-tabs{margin-bottom:15px}.bs-example-tooltips{text-align:center}.bs-example-tooltips>.btn{margin-top:5px;margin-bottom:5px}.bs-example-popover{padding-bottom:24px;background-color:#f9f9f9}.bs-example-popover .popover{position:relative;display:block;float:left;width:260px;margin:20px}.scrollspy-example{position:relative;height:200px;margin-top:10px;overflow:auto}.highlight{padding:9px 14px;margin-bottom:14px;background-color:#f7f7f9;border:1px solid #e1e1e8;border-radius:4px}.highlight pre{padding:0;margin-top:0;margin-bottom:0;word-break:normal;word-wrap:nowrap;white-space:nowrap;background-color:transparent;border:0}.highlight pre code{font-size:inherit;color:#333}.highlight pre code:first-child{display:inline-block;padding-right:45px}.table-responsive .highlight pre{white-space:normal}.bs-table th small,.responsive-utilities th small{display:block;font-weight:400;color:#999}.responsive-utilities tbody th{font-weight:400}.responsive-utilities td{text-align:center}.responsive-utilities td.is-visible{color:#468847;background-color:#dff0d8!important}.responsive-utilities td.is-hidden{color:#ccc;background-color:#f9f9f9!important}.responsive-utilities-test{margin-top:5px}.responsive-utilities-test .col-xs-6{margin-bottom:10px}.responsive-utilities-test span{display:block;padding:15px 10px;font-size:14px;font-weight:700;line-height:1.1;text-align:center;border-radius:4px}.visible-on .col-xs-6 .hidden-xs,.visible-on .col-xs-6 .hidden-sm,.visible-on .col-xs-6 .hidden-md,.visible-on .col-xs-6 .hidden-lg,.hidden-on .col-xs-6 .hidden-xs,.hidden-on .col-xs-6 .hidden-sm,.hidden-on .col-xs-6 .hidden-md,.hidden-on .col-xs-6 .hidden-lg{color:#999;border:1px solid #ddd}.visible-on .col-xs-6 .visible-xs-block,.visible-on .col-xs-6 .visible-sm-block,.visible-on .col-xs-6 .visible-md-block,.visible-on .col-xs-6 .visible-lg-block,.hidden-on .col-xs-6 .visible-xs-block,.hidden-on .col-xs-6 .visible-sm-block,.hidden-on .col-xs-6 .visible-md-block,.hidden-on .col-xs-6 .visible-lg-block{color:#468847;background-color:#dff0d8;border:1px solid #d6e9c6}.bs-glyphicons{margin:0 -10px 20px;overflow:hidden}.bs-glyphicons-list{padding-left:0;list-style:none}.bs-glyphicons li{float:left;width:25%;height:115px;padding:10px;font-size:10px;line-height:1.4;text-align:center;background-color:#f9f9f9;border:1px solid #fff}.bs-glyphicons .glyphicon{margin-top:5px;margin-bottom:10px;font-size:24px}.bs-glyphicons .glyphicon-class{display:block;text-align:center;word-wrap:break-word}.bs-glyphicons li:hover{color:#fff;background-color:#563d7c}@media (min-width:768px){.bs-glyphicons{margin-right:0;margin-left:0}.bs-glyphicons li{width:12.5%;font-size:12px}}.bs-customizer .toggle{float:right;margin-top:25px}.bs-customizer label{margin-top:10px;font-weight:500;color:#555}.bs-customizer h2{padding-top:30px;margin-top:0;margin-bottom:5px}.bs-customizer h3{margin-bottom:0}.bs-customizer h4{margin-top:15px;margin-bottom:0}.bs-customizer .bs-callout h4{margin-top:0;margin-bottom:5px}.bs-customizer input[type=text]{font-family:Menlo,Monaco,Consolas,"Courier New",monospace;background-color:#fafafa}.bs-customizer .help-block{margin-bottom:5px;font-size:12px}#less-section label{font-weight:400}.bs-customizer-input{float:left;width:33.333333%;padding-right:15px;padding-left:15px}.bs-customize-download .btn-outline{padding:20px}.bs-customizer-alert{position:fixed;top:0;right:0;left:0;z-index:1030;padding:15px 0;color:#fff;background-color:#d9534f;border-bottom:1px solid #b94441;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25);box-shadow:inset 0 1px 0 rgba(255,255,255,.25)}.bs-customizer-alert .close{margin-top:-4px;font-size:24px}.bs-customizer-alert p{margin-bottom:0}.bs-customizer-alert .glyphicon{margin-right:5px}.bs-customizer-alert pre{margin:10px 0 0;color:#fff;background-color:#a83c3a;border-color:#973634;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 2px 4px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}.bs-brand-logos{display:table;width:100%;margin-bottom:15px;overflow:hidden;color:#563d7c;background-color:#f9f9f9;border-radius:4px}.bs-brand-item{padding:60px 0;text-align:center}.bs-brand-item+.bs-brand-item{border-top:1px solid #fff}.bs-brand-logos .inverse{color:#fff;background-color:#563d7c}.bs-brand-item .svg{width:144px;height:144px}.bs-brand-item h1,.bs-brand-item h3{margin-top:0;margin-bottom:0}.bs-brand-item .bs-docs-booticon{margin-right:auto;margin-left:auto}.bs-brand-item .glyphicon{width:30px;height:30px;margin:10px auto -10px;line-height:30px;color:#fff;border-radius:50%}.bs-brand-item .glyphicon-ok{background-color:#5cb85c}.bs-brand-item .glyphicon-remove{background-color:#d9534f}@media (min-width:768px){.bs-brand-item{display:table-cell;width:1%}.bs-brand-item+.bs-brand-item{border-top:0;border-left:1px solid #fff}.bs-brand-item h1{font-size:60px}}.bs-examples .thumbnail{margin-bottom:10px}.bs-examples h4{margin-bottom:5px}.bs-examples p{margin-bottom:20px}#focusedInput{border-color:#ccc;border-color:rgba(82,168,236,.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:0 0 8px rgba(82,168,236,.6);box-shadow:0 0 8px rgba(82,168,236,.6)}.zero-clipboard{position:relative;display:none}.btn-clipboard{position:absolute;top:0;right:0;z-index:10;display:block;padding:5px 8px;font-size:12px;color:#777;cursor:pointer;background-color:#fff;border:1px solid #e1e1e8;border-radius:0 4px 0 4px}.btn-clipboard-hover{color:#fff;background-color:#563d7c;border-color:#563d7c}@media (min-width:768px){.zero-clipboard{display:block}}.hll{background-color:#ffc}.c{color:#999}.err{color:#A00;background-color:#FAA}.k{color:#069}.o{color:#555}.cm{color:#999}.cp{color:#099}.c1{color:#999}.cs{color:#999}.gd{background-color:#FCC;border:1px solid #C00}.ge{font-style:italic}.gr{color:red}.gh{color:#030}.gi{background-color:#CFC;border:1px solid #0C0}.go{color:#AAA}.gp{color:#009}.gu{color:#030}.gt{color:#9C6}.kc{color:#069}.kd{color:#069}.kn{color:#069}.kp{color:#069}.kr{color:#069}.kt{color:#078}.m{color:#F60}.s{color:#d44950}.na{color:#4f9fcf}.nb{color:#366}.nc{color:#0A8}.no{color:#360}.nd{color:#99F}.ni{color:#999}.ne{color:#C00}.nf{color:#C0F}.nl{color:#99F}.nn{color:#0CF}.nt{color:#2f6f9f}.nv{color:#033}.ow{color:#000}.w{color:#bbb}.mf{color:#F60}.mh{color:#F60}.mi{color:#F60}.mo{color:#F60}.sb{color:#C30}.sc{color:#C30}.sd{color:#C30;font-style:italic}.s2{color:#C30}.se{color:#C30}.sh{color:#C30}.si{color:#A00}.sx{color:#C30}.sr{color:#3AA}.s1{color:#C30}.ss{color:#FC3}.bp{color:#366}.vc{color:#033}.vg{color:#033}.vi{color:#033}.il{color:#F60}.css .o,.css .o+.nt,.css .nt+.nt{color:#999} \ No newline at end of file diff --git a/play25-bootstrap3/sample/system.properties b/play25-bootstrap3/sample/system.properties deleted file mode 100644 index 916c446..0000000 --- a/play25-bootstrap3/sample/system.properties +++ /dev/null @@ -1 +0,0 @@ -java.runtime.version=1.8 \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/bsFieldConstructorCommon.scala.html b/play25-bootstrap4/module/app/views/b4/bsFieldConstructorCommon.scala.html deleted file mode 100644 index 29bc7bd..0000000 --- a/play25-bootstrap4/module/app/views/b4/bsFieldConstructorCommon.scala.html +++ /dev/null @@ -1,12 +0,0 @@ -@(fieldInfo: b4.B4FieldInfo, inputHtml: Html, extraClasses: Option[String] = None)(wrap: Html => Html)(implicit fc: b4.B4FieldConstructor) -
- @wrap { - @inputHtml - @fieldInfo.feedbackInfos.map { case (id, text) => -
@text
- } - @fieldInfo.helpInfos.map { case (id, text) => - @text - } - } -
\ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/bsFormGroupCommon.scala.html b/play25-bootstrap4/module/app/views/b4/bsFormGroupCommon.scala.html deleted file mode 100644 index ceeae7d..0000000 --- a/play25-bootstrap4/module/app/views/b4/bsFormGroupCommon.scala.html +++ /dev/null @@ -1,11 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(wrap: Html => Html)(implicit messages: Messages) -@defining(argsMap.get('_id).map(_.toString).orElse(argsMap.get('id).map(_.toString + "_field"))) { idFormField => -
id="@id"}> - @wrap { - @contentHtml - @argsMap.get('_help).map { help => - @bs.Args.msg(help)(messages) - } - } -
-} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/buttonType.scala.html b/play25-bootstrap4/module/app/views/b4/buttonType.scala.html deleted file mode 100644 index f84ab88..0000000 --- a/play25-bootstrap4/module/app/views/b4/buttonType.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(buttonType: String, args: (Symbol,Any)*)(text: => Html)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@freeFormGroup(args) { innerArgsMap => - -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/checkbox.scala.html b/play25-bootstrap4/module/app/views/b4/checkbox.scala.html deleted file mode 100644 index 32b2add..0000000 --- a/play25-bootstrap4/module/app/views/b4/checkbox.scala.html +++ /dev/null @@ -1,34 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@displayLabelWithInput(inputClass: String, labelClass: String, textOpt: Option[Any], value: Any, fieldInfo: b4.B4FieldInfo) = { - - @textOpt.map { text => - - } -} -@defining({ - val argsMap = args.toMap - val textOpt = argsMap.get('_text).map(bs.Args.msg(_)(messages)) - val value = argsMap.get('value).getOrElse("true").toString - val checked = argsMap.get('checked).orElse(field.value.map(_ == value).orElse(argsMap.get('_default))).map(_.toString == "true").getOrElse(false) - val containsReadonly = argsMap.contains('readonly) - val readonly = bs.ArgsMap.isTrue(argsMap, 'readonly) - val disabled = readonly || bs.ArgsMap.isTrue(argsMap, 'disabled) - (argsMap, textOpt, value, checked, containsReadonly, readonly, disabled) -}){ case (argsMap, textOpt, value, checked, containsReadonly, readonly, disabled) => - @inputFormGroup(field, withLabelFor = false, bs.Args.withDefault(args.filterNot(_._1 == 'checked), 'checked -> checked, 'disabled -> disabled)) { fieldInfo => - @defining(fieldInfo.isCustom) { isCustom => -
- @if(isCustom) { - @displayLabelWithInput("custom-control-input", "custom-control-label", textOpt, value, fieldInfo) - } else { - @displayLabelWithInput("form-check-input", "form-check-label", textOpt, value, fieldInfo) - } - @if(containsReadonly) { - - } -
- } - }(fc, messages) -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/clear/package.scala b/play25-bootstrap4/module/app/views/b4/clear/package.scala deleted file mode 100644 index 1f58b0d..0000000 --- a/play25-bootstrap4/module/app/views/b4/clear/package.scala +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b4 - -package object clear { - - import play.twirl.api.Html - import play.api.i18n.Messages - import play.api.mvc.{ Call, RequestHeader } - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Clear FieldConstructor. - */ - class ClearFieldConstructor(val isCustom: Boolean = false, val withFeedbackTooltip: Boolean = false) extends B4FieldConstructor { - /* Define the class of the corresponding form */ - val formClass = "form-clear" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B4FieldInfo, inputHtml: Html)(implicit messages: Messages) = inputHtml - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = contentHtml - } - - /** - * Creates a new ClearFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B4FieldConstructor and a specific ClearFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(isCustom: Boolean = false, withFeedbackTooltip: Boolean = false): ClearFieldConstructor = - new ClearFieldConstructor(isCustom, withFeedbackTooltip) - - /** - * Returns it as a B4FieldConstructor to use it as default within a template - */ - def fieldConstructor(isCustom: Boolean = false, withFeedbackTooltip: Boolean = false): B4FieldConstructor = - fieldConstructorSpecific(isCustom, withFeedbackTooltip) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: ClearFieldConstructor => Html) = { - val cfc = fieldConstructorSpecific(isCustom = isTrue(args, '_custom), withFeedbackTooltip = isTrue(args, '_feedbackTooltip)) - views.html.b4.form(action, inner(args): _*)(body(cfc))(cfc) - } - def formCSRF(action: Call, args: (Symbol, Any)*)(body: ClearFieldConstructor => Html)(implicit request: RequestHeader) = { - val cfc = fieldConstructorSpecific(isCustom = isTrue(args, '_custom), withFeedbackTooltip = isTrue(args, '_feedbackTooltip)) - views.html.b4.formCSRF(action, inner(args): _*)(body(cfc))(cfc, request) - } - -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/file.scala.html b/play25-bootstrap4/module/app/views/b4/file.scala.html deleted file mode 100644 index 9431726..0000000 --- a/play25-bootstrap4/module/app/views/b4/file.scala.html +++ /dev/null @@ -1,11 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@inputFormGroup(field, withLabelFor = true, args) { fieldInfo => - @if(fieldInfo.isCustom) { -
- - -
- } else { - - } -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/form.scala.html b/play25-bootstrap4/module/app/views/b4/form.scala.html deleted file mode 100644 index aa940b5..0000000 --- a/play25-bootstrap4/module/app/views/b4/form.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(action: Call, args: (Symbol, Any)*)(body: => Html)(implicit fc: b4.B4FieldConstructor) -
"form"), 'class, if (bs.Args.isTrue(args, '_disableDefaultClass)) None else Some(fc.formClass)).toMap)> - @body -
\ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/formCSRF.scala.html b/play25-bootstrap4/module/app/views/b4/formCSRF.scala.html deleted file mode 100644 index 80f8b59..0000000 --- a/play25-bootstrap4/module/app/views/b4/formCSRF.scala.html +++ /dev/null @@ -1,5 +0,0 @@ -@(action: Call, args: (Symbol, Any)*)(body: => Html)(implicit fc: b4.B4FieldConstructor, request: RequestHeader) -@form(action, args:_*) { - @helper.CSRF.formField - @body -}(fc) \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/hiddenInput.scala.html b/play25-bootstrap4/module/app/views/b4/hiddenInput.scala.html deleted file mode 100644 index 5ae08f3..0000000 --- a/play25-bootstrap4/module/app/views/b4/hiddenInput.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(name: Any, value: Any, args: (Symbol, Any)*) - \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/hiddens.scala.html b/play25-bootstrap4/module/app/views/b4/hiddens.scala.html deleted file mode 100644 index 6c7d022..0000000 --- a/play25-bootstrap4/module/app/views/b4/hiddens.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(namesAndValues: (Any, Any)*) -@namesAndValues.map { case (name, value) => - -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/horizontal/bsFieldConstructor.scala.html b/play25-bootstrap4/module/app/views/b4/horizontal/bsFieldConstructor.scala.html deleted file mode 100644 index b32aaa5..0000000 --- a/play25-bootstrap4/module/app/views/b4/horizontal/bsFieldConstructor.scala.html +++ /dev/null @@ -1,13 +0,0 @@ -@(fieldInfo: b4.B4FieldInfo, inputHtml: Html, colLabel: String, colOffset: String, colInput: String)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@b4.bsFieldConstructorCommon(fieldInfo, inputHtml, extraClasses = Some("row")) { content => - @fieldInfo.labelOpt.map { label => - -
- @content -
- }.getOrElse { -
- @content -
- } -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/horizontal/bsFormGroup.scala.html b/play25-bootstrap4/module/app/views/b4/horizontal/bsFormGroup.scala.html deleted file mode 100644 index d1e104c..0000000 --- a/play25-bootstrap4/module/app/views/b4/horizontal/bsFormGroup.scala.html +++ /dev/null @@ -1,13 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any], colLabel: String, colOffset: String, colInput: String)(implicit messages: Messages) -@b4.bsFormGroupCommon(contentHtml, bs.ArgsMap.withAddingStringValue(argsMap, '_class, "row")) { content => - @argsMap.get('_label).map { label => - -
- @content -
- }.getOrElse { -
- @content -
- } -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/horizontal/package.scala b/play25-bootstrap4/module/app/views/b4/horizontal/package.scala deleted file mode 100644 index b7e9b22..0000000 --- a/play25-bootstrap4/module/app/views/b4/horizontal/package.scala +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b4 - -package object horizontal { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.Messages - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Horizontal FieldConstructor. - * It needs the column widths for the corresponding Bootstrap3 form-group - */ - case class HorizontalFieldConstructor(colLabel: String, colInput: String, val isCustom: Boolean = false, val withFeedbackTooltip: Boolean = false) extends B4FieldConstructor { - /* The equivalent offset if label is not present (ex: colLabel = "col-md-2" => colOffset = "offset-md-2") */ - val colOffset: String = colLabel.replace("col", "offset") - /* Define the class of the corresponding form */ - val formClass = "form-horizontal" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B4FieldInfo, inputHtml: Html)(implicit messages: Messages) = bsFieldConstructor(fieldInfo, inputHtml, colLabel, colOffset, colInput)(this, messages) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = bsFormGroup(contentHtml, argsMap, colLabel, colOffset, colInput)(messages) - } - - /** - * Returns a new HorizontalFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B4FieldConstructor and a specific HorizontalFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(colLabel: String, colInput: String, isCustom: Boolean = false, withFeedbackTooltip: Boolean = false): HorizontalFieldConstructor = - new HorizontalFieldConstructor(colLabel, colInput, isCustom, withFeedbackTooltip) - - /** - * Returns it as a B4FieldConstructor to use it as default within a template - */ - def fieldConstructor(colLabel: String, colInput: String, isCustom: Boolean = false, withFeedbackTooltip: Boolean = false): B4FieldConstructor = - fieldConstructorSpecific(colLabel, colInput, isCustom, withFeedbackTooltip) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, colLabel: String, colInput: String, args: (Symbol, Any)*)(body: HorizontalFieldConstructor => Html) = { - val hfc = fieldConstructorSpecific(colLabel, colInput, isCustom = isTrue(args, '_custom), withFeedbackTooltip = isTrue(args, '_feedbackTooltip)) - views.html.b4.form(action, inner(args): _*)(body(hfc))(hfc) - } - def formCSRF(action: Call, colLabel: String, colInput: String, args: (Symbol, Any)*)(body: HorizontalFieldConstructor => Html)(implicit request: RequestHeader) = { - val hfc = fieldConstructorSpecific(colLabel, colInput, isCustom = isTrue(args, '_custom), withFeedbackTooltip = isTrue(args, '_feedbackTooltip)) - views.html.b4.formCSRF(action, inner(args): _*)(body(hfc))(hfc, request) - } - -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/inline/bsFieldConstructor.scala.html b/play25-bootstrap4/module/app/views/b4/inline/bsFieldConstructor.scala.html deleted file mode 100644 index ff64695..0000000 --- a/play25-bootstrap4/module/app/views/b4/inline/bsFieldConstructor.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(fieldInfo: b4.B4FieldInfo, inputHtml: Html)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@b4.bsFieldConstructorCommon(fieldInfo, inputHtml) { content => - @fieldInfo.labelOpt.map { label => - @bs.Args.msg(label)(messages) - } - @content -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/inline/bsFormGroup.scala.html b/play25-bootstrap4/module/app/views/b4/inline/bsFormGroup.scala.html deleted file mode 100644 index 789f636..0000000 --- a/play25-bootstrap4/module/app/views/b4/inline/bsFormGroup.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) -@b4.bsFormGroupCommon(contentHtml, argsMap) { content => - @argsMap.get('_label).map { label => - @bs.Args.msg(label)(messages) - } - @content -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/inline/package.scala b/play25-bootstrap4/module/app/views/b4/inline/package.scala deleted file mode 100644 index 00720fc..0000000 --- a/play25-bootstrap4/module/app/views/b4/inline/package.scala +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b4 - -package object inline { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.Messages - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Inline FieldConstructor. - */ - class InlineFieldConstructor(val isCustom: Boolean = false, val withFeedbackTooltip: Boolean = false) extends B4FieldConstructor { - /* Define the class of the corresponding form */ - val formClass = "form-inline" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B4FieldInfo, inputHtml: Html)(implicit messages: Messages) = bsFieldConstructor(fieldInfo, inputHtml)(this, messages) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = bsFormGroup(contentHtml, argsMap)(messages) - } - - /** - * Creates a new InlineFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B4FieldConstructor and a specific InlineFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(isCustom: Boolean = false, withFeedbackTooltip: Boolean = false): InlineFieldConstructor = - new InlineFieldConstructor(isCustom, withFeedbackTooltip) - - /** - * Returns it as a B4FieldConstructor to use it as default within a template - */ - def fieldConstructor(isCustom: Boolean = false, withFeedbackTooltip: Boolean = false): B4FieldConstructor = - fieldConstructorSpecific(isCustom, withFeedbackTooltip) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: InlineFieldConstructor => Html) = { - val ifc = fieldConstructorSpecific(isCustom = isTrue(args, '_custom), withFeedbackTooltip = isTrue(args, '_feedbackTooltip)) - views.html.b4.form(action, inner(args): _*)(body(ifc))(ifc) - } - def formCSRF(action: Call, args: (Symbol, Any)*)(body: InlineFieldConstructor => Html)(implicit request: RequestHeader) = { - val ifc = fieldConstructorSpecific(isCustom = isTrue(args, '_custom), withFeedbackTooltip = isTrue(args, '_feedbackTooltip)) - views.html.b4.formCSRF(action, inner(args): _*)(body(ifc))(ifc, request) - } - -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/inputWrapped.scala.html b/play25-bootstrap4/module/app/views/b4/inputWrapped.scala.html deleted file mode 100644 index d23e3cf..0000000 --- a/play25-bootstrap4/module/app/views/b4/inputWrapped.scala.html +++ /dev/null @@ -1,6 +0,0 @@ -@(inputType: String, field: Field, args: (Symbol,Any)*)(inputGroup: Html => Html)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@inputFormGroup(field, withLabelFor = true, bs.Args.withAddingStringValue(args, 'class, "form-control")) { fieldInfo => - @inputGroup { - - } -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/multifield.scala.html b/play25-bootstrap4/module/app/views/b4/multifield.scala.html deleted file mode 100644 index 5c251cf..0000000 --- a/play25-bootstrap4/module/app/views/b4/multifield.scala.html +++ /dev/null @@ -1,16 +0,0 @@ -@(fields: Field*)(globalArgs: Seq[(Symbol,Any)], fieldsArgs: Seq[(Symbol,Any)])(inputsHtml: b4.clear.ClearFieldConstructor => Html)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@multifieldFormGroup(fields, globalArgs, fieldsArgs) { multifieldInfo => - @inputsHtml(b4.clear.fieldConstructorSpecific(isCustom = fc.isCustom)) - @* renders a hidden form-control only to force visibility of the next feedback *@ - @multifieldInfo.status.collect { - case "danger" => {
} - case "success" => {
} - case "warning" => {
} - } - @multifieldInfo.feedbackInfos.map { text => -
@text
- } - @multifieldInfo.helpInfos.map { text => - @text - } -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/package.scala b/play25-bootstrap4/module/app/views/b4/package.scala deleted file mode 100644 index 813db2c..0000000 --- a/play25-bootstrap4/module/app/views/b4/package.scala +++ /dev/null @@ -1,216 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html - -package object b4 { - - import play.api.data.{ Field, FormError } - import play.twirl.api.Html - import play.api.i18n.{ Lang, Messages } - import bs._ - import bs.ArgsMap.isTrue - import play.api.mvc.Call - - /** - * Class with relevant variables for a field to pass it to the helper and field constructor - * - withLabelFor: indicates if the label's "for" attribute should be shown - * - args: list of available arguments for the helper and field constructor - */ - case class B4FieldInfo(field: Field, withLabelFor: Boolean, args: Seq[(Symbol, Any)], override val messages: Messages) extends BSFieldInfo(field, args, messages) { - - /* List with every "feedback info" and its corresponding ARIA id. Ex: ("foo_info_0" -> "foo constraint") */ - val feedbackInfos: Seq[(String, String)] = - if (errors.size > 0) - errors - else - BSFieldInfo.feedbackInfosButErrors(argsMap, messages).zipWithIndex.map { - case (info, i) => (id + "_feedback_" + i, info) - } - - /* List with every "help info" (i.e. a help text or constraints) and its corresponding ARIA id. Ex: ("foo_info_0" -> "foo constraint") */ - val helpInfos: Seq[(String, String)] = BSFieldInfo.helpInfos(Some(field), argsMap, messages).zipWithIndex.map { - case (info, i) => (id + "_info_" + i, info) - } - - /* Indicates if it's a custom element */ - def isCustom(implicit fc: b4.B4FieldConstructor): Boolean = fc.isCustom || isTrue(argsMap, '_custom) - - /* The optional validation state ("success", "warning" or "danger") */ - override lazy val status: Option[String] = B4FieldInfo.status(hasErrors, argsMap) - - /* The corresponding optional validation feedback for B4 ("valid-feedback", "warning-feedback" or "invalid-feedback") */ - def statusB4Feedback(implicit fc: b4.B4FieldConstructor): Option[String] = B4FieldInfo.statusB4Feedback(status, fc.withFeedbackTooltip) - - /* List of every ARIA id */ - val ariaIds: Seq[String] = feedbackInfos.map(_._1) ++ helpInfos.map(_._1) - - /* - * Map with the inner args, i.e. those args for the helper itself removing those ones reserved for the field constructor. - * It adds the ARIA attributes and removes the underscored reserved for the field constructor and the `id and `value ones that are - * managed independently. - */ - lazy val innerArgsMap: Map[Symbol, Any] = ( - (if (ariaIds.size > 0) Seq(Symbol("aria-describedby") -> ariaIds.mkString(" ")) else Nil) ++ - (if (hasErrors) Seq(Symbol("aria-invalid") -> "true") else Nil) ++ - BSFieldInfo.constraintsArgs(field, messages) ++ - Args.inner( - Args.remove( - status.map(s => Args.withAddingStringValue(args, 'class, if (s == "danger") "is-invalid" else if (s == "success") "is-valid" else if (s == "warning") "is-warning" else "")).getOrElse(args), - 'id, 'value - ).map { - case arg if arg._1 == 'placeholder => Args.msg(arg)(messages) - case other => other - } - ) - ).toMap - } - - /** - * Companion object for class B4FieldInfo - */ - object B4FieldInfo { - /* The optional validation state ("success", "warning" or "danger") */ - def status(hasErrors: Boolean, argsMap: Map[Symbol, Any]): Option[String] = { - if (hasErrors) - Some("danger") - else if (ArgsMap.isNotFalse(argsMap, '_warning) || isTrue(argsMap, '_showIconWarning)) - Some("warning") - else if (ArgsMap.isNotFalse(argsMap, '_success) || isTrue(argsMap, '_showIconValid)) - Some("success") - else - None - } - /* The corresponding feedback class for helpers */ - def statusB4Feedback(status: Option[String], withFeedbackTooltip: Boolean = false): Option[String] = status.map { - case "success" => "valid" - case "warning" => "warning" - case _ => "invalid" - }.map(_ + (if (withFeedbackTooltip) "-tooltip" else "-feedback")) - } - - /** - * Class with relevant variables for the global information of a multifield - * - fields: list of Fields - * - args: list of available arguments for the helper and the form-group - */ - case class B4MultifieldInfo(fields: Seq[Field], globalArguments: Seq[(Symbol, Any)], fieldsArguments: Seq[(Symbol, Any)], override val messages: Messages) extends BSMultifieldInfo(fields, globalArguments, fieldsArguments, messages) { - - /* List with every "feedback info" */ - val feedbackInfos: Seq[String] = { - if (errors.size > 0) - errors - else - BSFieldInfo.feedbackInfosButErrors(argsMap, messages) - } - - /* List with every "help info" (i.e. a help text or constraints) */ - val helpInfos: Seq[String] = { - val globalHelpInfos = BSFieldInfo.helpInfos(None, argsMap, messages) - if (globalHelpInfos.size > 0) - globalHelpInfos - else - fields.flatMap { field => - BSFieldInfo.helpInfos(Some(field), argsMap, messages) - } - } - - /* The optional validation state ("success", "warning" or "danger") */ - override lazy val status: Option[String] = B4FieldInfo.status(hasErrors, argsMap) - - /* The corresponding optional validation feedback for B4 ("valid-feedback", "warning-feedback" or "invalid-feedback") */ - def statusB4Feedback(implicit fc: b4.B4FieldConstructor): Option[String] = B4FieldInfo.statusB4Feedback(status, fc.withFeedbackTooltip) - - override lazy val globalArgs = { - val withoutHelp = Args.remove(globalArguments, '_help) - val withStatus = status.map(s => Args.withDefault(withoutHelp, '_class -> s"has-$s")).getOrElse(withoutHelp) - withStatus - } - } - - /** - * Custom FieldConstructor for the library. Every FieldConstructor must extend this functionality. - */ - trait B4FieldConstructor extends BSFieldConstructor[B4FieldInfo] { - /* Define the class of the corresponding form (ex: "form-horizontal", "form-inline", ...) */ - val formClass: String - val isCustom: Boolean - val withFeedbackTooltip: Boolean - } - - /** - * Renders an input form-group using the B4FieldConstructor. - * - withFeedbak: indicates if the feedback icons are allowed - * - withLabelFor: indicates if the label's "for" attribute should be shown - * - args: list of available arguments for the helper and field constructor - * - inputDef: function that returns a Html from a B4FieldInfo that contains all the information about the field - */ - def inputFormGroup(field: Field, withLabelFor: Boolean, args: Seq[(Symbol, Any)])(inputDef: B4FieldInfo => Html)(implicit fc: B4FieldConstructor, messages: Messages) = - inputFormField(B4FieldInfo(field, withLabelFor, Args.withoutNones(args), messages))(inputDef)(fc) - - /** - * Renders a form-group using the B4FieldConstructor. - * - args: list of available arguments for the helper and the form-group - * - contentDef: function that returns a Html from a map of arguments - */ - def freeFormGroup(args: Seq[(Symbol, Any)])(contentDef: Map[Symbol, Any] => Html)(implicit fc: B4FieldConstructor, messages: Messages) = - freeFormField(args)(contentDef)(fc, messages) - - def multifieldFormGroup(fields: Seq[Field], globalArgs: Seq[(Symbol, Any)], fieldsArgs: Seq[(Symbol, Any)])(contentDef: B4MultifieldInfo => Html)(implicit fc: B4FieldConstructor, messages: Messages) = - multifieldFormField(B4MultifieldInfo(fields, globalArgs, fieldsArgs, messages))(contentDef)(fc) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def inputType(inputType: String, field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputWrapped(inputType, field, args: _*)(html => html)(fc, messages) - - def text(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("text", field, args: _*)(fc, messages) - def password(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("password", field.copy(value = Some("")), args: _*)(fc, messages) - def color(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("color", field, args: _*)(fc, messages) - def date(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("date", field, args: _*)(fc, messages) - def datetime(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("datetime", field, args: _*)(fc, messages) - def datetimeLocal(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("datetime-local", field, args: _*)(fc, messages) - def email(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("email", field, args: _*)(fc, messages) - def month(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("month", field, args: _*)(fc, messages) - def number(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("number", field, args: _*)(fc, messages) - def range(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("range", field, args: _*)(fc, messages) - def search(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("search", field, args: _*)(fc, messages) - def tel(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("tel", field, args: _*)(fc, messages) - def time(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("time", field, args: _*)(fc, messages) - def url(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("url", field, args: _*)(fc, messages) - def week(field: Field, args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = inputType("week", field, args: _*)(fc, messages) - - def hidden(name: String, value: Any, args: (Symbol, Any)*) = hiddenInput(name, value, args: _*) - def hidden(field: Field, args: (Symbol, Any)*) = hiddenInput(name = field.name, value = field.value.orElse(bs.Args.get(args, 'value)), (bs.Args.inner(bs.Args.remove(args, 'value))): _*) - - def radio(field: Field, args: (Symbol, Any)*)(content: Tuple3[Boolean, Boolean, B4FieldInfo] => Html)(implicit fc: B4FieldConstructor, messages: Messages) = radioWithContent(field, args: _*)(content)(fc, messages) - def radio(field: Field, options: Seq[(String, Any)], args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = radioWithOptions(field, options, args: _*)(fc, messages) - - def select(field: Field, args: (Symbol, Any)*)(content: Set[String] => Html)(implicit fc: B4FieldConstructor, messages: Messages) = selectWithContent(field, args: _*)(content)(fc, messages) - def select(field: Field, options: Seq[(String, String)], args: (Symbol, Any)*)(implicit fc: B4FieldConstructor, messages: Messages) = selectWithOptions(field, options, args: _*)(fc, messages) - - def submit(args: (Symbol, Any)*)(text: => Html)(implicit fc: B4FieldConstructor, messages: Messages) = buttonType("submit", args: _*)(text)(fc, messages) - def reset(args: (Symbol, Any)*)(text: => Html)(implicit fc: B4FieldConstructor, messages: Messages) = buttonType("reset", args: _*)(text)(fc, messages) - def button(args: (Symbol, Any)*)(text: => Html)(implicit fc: B4FieldConstructor, messages: Messages) = buttonType("button", args: _*)(text)(fc, messages) - - def static(args: (Symbol, Any)*)(text: => Html)(implicit fc: B4FieldConstructor, messages: Messages) = staticBasic(args: _*)(text)(fc, messages) - def static(label: String, args: (Symbol, Any)*)(text: => Html)(implicit fc: B4FieldConstructor, messages: Messages) = staticBasic(Args.withDefault(args, '_label -> label): _*)(text)(fc, messages) - def static(label: Html, args: (Symbol, Any)*)(text: => Html)(implicit fc: B4FieldConstructor, messages: Messages) = staticBasic(Args.withDefault(args, '_label -> label): _*)(text)(fc, messages) - - def free(args: (Symbol, Any)*)(content: => Html)(implicit fc: B4FieldConstructor, messages: Messages) = freeFormGroup(args)(_ => content)(fc, messages) - -} diff --git a/play25-bootstrap4/module/app/views/b4/radioOption.scala.html b/play25-bootstrap4/module/app/views/b4/radioOption.scala.html deleted file mode 100644 index 7ab6a5a..0000000 --- a/play25-bootstrap4/module/app/views/b4/radioOption.scala.html +++ /dev/null @@ -1,18 +0,0 @@ -@(inputValue: Any, label: Any, args: (Symbol, Any)*)(implicit extraInfo: (Boolean, Boolean, B4FieldInfo), fc: B4FieldConstructor, messages: Messages) -@displayLabelWithInput(inputClass: String, labelClass: String, fieldInfo: b4.B4FieldInfo) = { - - -} -@defining(extraInfo) { case (inline, disabled, fieldInfo) => - @if(fieldInfo.isCustom) { -
- @displayLabelWithInput("custom-control-input", "custom-control-label", fieldInfo) -
- } else { -
- @displayLabelWithInput("form-check-input", "form-check-label", fieldInfo) -
- } -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/radioWithContent.scala.html b/play25-bootstrap4/module/app/views/b4/radioWithContent.scala.html deleted file mode 100644 index accf431..0000000 --- a/play25-bootstrap4/module/app/views/b4/radioWithContent.scala.html +++ /dev/null @@ -1,22 +0,0 @@ -@(field: Field, args: (Symbol, Any)*)(content: Tuple3[Boolean, Boolean, b4.B4FieldInfo] => Html)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@readonlyWrapper(name: String, value: Option[String], argsMap: Map[Symbol, Any], disabled: Boolean)(contentWrapped: Html) = { - @if(argsMap.contains('readonly)) { -
- @contentWrapped - -
- } else { @contentWrapped } -} -@defining({ - val argsMap = args.toMap - val inline = bs.ArgsMap.isTrue(argsMap, '_inline) || fc.formClass == "form-inline" - val readonly = bs.ArgsMap.isTrue(argsMap, 'readonly) - val disabled = readonly || bs.ArgsMap.isTrue(argsMap, 'disabled) - (argsMap, inline, disabled) -}) { case (argsMap, inline, disabled) => - @inputFormGroup(field, withLabelFor = false, bs.Args.withDefault(args, 'disabled -> disabled)) { fieldInfo => - @readonlyWrapper(fieldInfo.name, fieldInfo.value, argsMap, disabled) { - @content(inline, disabled, fieldInfo) - } - }(fc, messages) -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/radioWithOptions.scala.html b/play25-bootstrap4/module/app/views/b4/radioWithOptions.scala.html deleted file mode 100644 index 5e1dfa5..0000000 --- a/play25-bootstrap4/module/app/views/b4/radioWithOptions.scala.html +++ /dev/null @@ -1,6 +0,0 @@ -@(field: Field, options: Seq[(String, Any)], args: (Symbol, Any)*)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@radioWithContent(field, bs.Args.withDefault(args, '_hiddenValue -> options.headOption.map(_._1)):_*) { implicit extraInfo => - @options.map { v => - @radioOption(v._1, bs.Args.msg(v._2)(messages)) - } -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/selectOption.scala.html b/play25-bootstrap4/module/app/views/b4/selectOption.scala.html deleted file mode 100644 index 57366be..0000000 --- a/play25-bootstrap4/module/app/views/b4/selectOption.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(value: Any, name: Any, args: (Symbol, Any)*)(implicit values: Set[String], messages: Messages) - \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/selectWithContent.scala.html b/play25-bootstrap4/module/app/views/b4/selectWithContent.scala.html deleted file mode 100644 index a7e9939..0000000 --- a/play25-bootstrap4/module/app/views/b4/selectWithContent.scala.html +++ /dev/null @@ -1,35 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(content: Set[String] => Html)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@readonlyWrapper(selectName: String, value: Option[String], disabled: Boolean, argsMap: Map[Symbol, Any])(contentWrapped: Html) = { - @if(argsMap.contains('readonly)) { -
- @contentWrapped - -
- } else { @contentWrapped } -} -@defining({ - val argsMap = args.toMap - val readonly = bs.ArgsMap.isTrue(argsMap, 'readonly) - val disabled = readonly || bs.ArgsMap.isTrue(argsMap, 'disabled) - val multiple = bs.ArgsMap.isTrue(argsMap, 'multiple) - (argsMap, disabled, multiple) -}) { case (argsMap, disabled, multiple) => - @inputFormGroup(field, withLabelFor = true, bs.Args.withDefault(args, 'disabled -> disabled)) { fieldInfo => - @defining( if(multiple) "%s[]".format(fieldInfo.name) else fieldInfo.name ) { selectName => - @defining( ( !field.indexes.isEmpty && multiple ) match { - case true => field.indexes.map( i => field("[%s]".format(i)).value ).flatten.toSet - case _ if multiple && fieldInfo.value.isDefined => fieldInfo.value.get.split(",").toSet - case _ => fieldInfo.value.toSet - }){ implicit values => - @readonlyWrapper(selectName, fieldInfo.value, disabled, argsMap) { - - } - } - } - }(fc, messages) -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/selectWithOptions.scala.html b/play25-bootstrap4/module/app/views/b4/selectWithOptions.scala.html deleted file mode 100644 index 391ad81..0000000 --- a/play25-bootstrap4/module/app/views/b4/selectWithOptions.scala.html +++ /dev/null @@ -1,6 +0,0 @@ -@(field: Field, options: Seq[(String,String)], args: (Symbol,Any)*)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@selectWithContent(field, bs.Args.withDefault(args, '_hiddenValue -> bs.Args.get(args, '_default).map(bs.Args.msg(_)(messages)).orElse(options.headOption.map(_._1))):_*) { implicit values => - @options.map { v => - @selectOption(v._1, bs.Args.msg(v._2)(messages)) - } -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/staticBasic.scala.html b/play25-bootstrap4/module/app/views/b4/staticBasic.scala.html deleted file mode 100644 index 946f70b..0000000 --- a/play25-bootstrap4/module/app/views/b4/staticBasic.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(args: (Symbol,Any)*)(text: => Html)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@freeFormGroup(bs.Args.withAddingStringValue(args, 'class, "form-control-static")) { innerArgsMap => -

@text

-}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/textarea.scala.html b/play25-bootstrap4/module/app/views/b4/textarea.scala.html deleted file mode 100644 index 1b5b279..0000000 --- a/play25-bootstrap4/module/app/views/b4/textarea.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@inputFormGroup(field, withLabelFor = true, bs.Args.withAddingStringValue(args, 'class, "form-control")) { fieldInfo => - -}(fc, messages) \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/vertical/bsFieldConstructor.scala.html b/play25-bootstrap4/module/app/views/b4/vertical/bsFieldConstructor.scala.html deleted file mode 100644 index ff64695..0000000 --- a/play25-bootstrap4/module/app/views/b4/vertical/bsFieldConstructor.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(fieldInfo: b4.B4FieldInfo, inputHtml: Html)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@b4.bsFieldConstructorCommon(fieldInfo, inputHtml) { content => - @fieldInfo.labelOpt.map { label => - @bs.Args.msg(label)(messages) - } - @content -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/vertical/bsFormGroup.scala.html b/play25-bootstrap4/module/app/views/b4/vertical/bsFormGroup.scala.html deleted file mode 100644 index 789f636..0000000 --- a/play25-bootstrap4/module/app/views/b4/vertical/bsFormGroup.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) -@b4.bsFormGroupCommon(contentHtml, argsMap) { content => - @argsMap.get('_label).map { label => - @bs.Args.msg(label)(messages) - } - @content -} \ No newline at end of file diff --git a/play25-bootstrap4/module/app/views/b4/vertical/package.scala b/play25-bootstrap4/module/app/views/b4/vertical/package.scala deleted file mode 100644 index da3fef9..0000000 --- a/play25-bootstrap4/module/app/views/b4/vertical/package.scala +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b4 - -package object vertical { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.Messages - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Vertical FieldConstructor. - */ - class VerticalFieldConstructor(val isCustom: Boolean = false, val withFeedbackTooltip: Boolean = false) extends B4FieldConstructor { - /* Define the class of the corresponding form */ - val formClass = "form-vertical" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B4FieldInfo, inputHtml: Html)(implicit messages: Messages) = bsFieldConstructor(fieldInfo, inputHtml)(this, messages) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = bsFormGroup(contentHtml, argsMap)(messages) - } - - /** - * Creates a new VerticalFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B4FieldConstructor and a specific VerticalFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(isCustom: Boolean = false, withFeedbackTooltip: Boolean = false): VerticalFieldConstructor = - new VerticalFieldConstructor(isCustom, withFeedbackTooltip) - - /** - * Returns it as a B4FieldConstructor to use it as default within a template - */ - def fieldConstructor(isCustom: Boolean = false, withFeedbackTooltip: Boolean = false): B4FieldConstructor = - fieldConstructorSpecific(isCustom, withFeedbackTooltip) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: VerticalFieldConstructor => Html) = { - val vfc = fieldConstructorSpecific(isCustom = isTrue(args, '_custom), withFeedbackTooltip = isTrue(args, '_feedbackTooltip)) - views.html.b4.form(action, args: _*)(body(vfc))(vfc) - } - def formCSRF(action: Call, args: (Symbol, Any)*)(body: VerticalFieldConstructor => Html)(implicit request: RequestHeader) = { - val vfc = fieldConstructorSpecific(isCustom = isTrue(args, '_custom), withFeedbackTooltip = isTrue(args, '_feedbackTooltip)) - views.html.b4.formCSRF(action, args: _*)(body(vfc))(vfc, request) - } - -} \ No newline at end of file diff --git a/play25-bootstrap4/module/build.sbt b/play25-bootstrap4/module/build.sbt deleted file mode 100644 index 9e97b6f..0000000 --- a/play25-bootstrap4/module/build.sbt +++ /dev/null @@ -1,70 +0,0 @@ -name := """play-bootstrap""" - -version := "1.4-P25-B4-SNAPSHOT" - -scalaVersion := "2.11.11" - -crossScalaVersions := Seq("2.11.11") - -resolvers ++= Seq( - "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases", - "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" -) - -libraryDependencies ++= Seq( - filters % "provided", - "com.adrianhurt" %% "play-bootstrap-core" % "1.4-P25-SNAPSHOT", - specs2 % Test -) - -lazy val root = (project in file(".")).enablePlugins(PlayScala) - - - -scalariformSettings - -//******************************* -// Maven settings -//******************************* - -sonatypeSettings - -publishMavenStyle := true - -organization := "com.adrianhurt" - -description := "This is a collection of input helpers and field constructors for Play Framework to render Bootstrap HTML code." - -homepage := Some(url("https://adrianhurt.github.io/play-bootstrap")) - -licenses := Seq("Apache License" -> url("https://github.com/adrianhurt/play-bootstrap/blob/master/LICENSE")) - -startYear := Some(2014) - -publishTo := { - val nexus = "https://oss.sonatype.org/" - if (isSnapshot.value) - Some("snapshots" at nexus + "content/repositories/snapshots") - else - Some("releases" at nexus + "service/local/staging/deploy/maven2") -} - -publishArtifact in Test := false - -pomIncludeRepository := { _ => false } - -pomExtra := ( - - git@github.com:adrianhurt/play-bootstrap.git - scm:git:git@github.com:adrianhurt/play-bootstrap.git - - - - adrianhurt - Adrian Hurtado - https://github.com/adrianhurt - - -) - -credentials += Credentials(Path.userHome / ".sbt" / "sonatype.credentials") diff --git a/play25-bootstrap4/module/project/build.properties b/play25-bootstrap4/module/project/build.properties deleted file mode 100644 index c364161..0000000 --- a/play25-bootstrap4/module/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Activator-generated Properties -#Mon Aug 11 18:06:16 BST 2014 -template.uuid=688014f0-0585-43e3-a9fa-d62f7d12f1ab -sbt.version=0.13.11 diff --git a/play25-bootstrap4/module/project/plugins.sbt b/play25-bootstrap4/module/project/plugins.sbt deleted file mode 100644 index 63f4ec9..0000000 --- a/play25-bootstrap4/module/project/plugins.sbt +++ /dev/null @@ -1,12 +0,0 @@ -resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" - -// The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.18") - -// web plugins - -addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") - -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.2") - -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") diff --git a/play25-bootstrap4/module/test/FieldConstructorsSpec.scala b/play25-bootstrap4/module/test/FieldConstructorsSpec.scala deleted file mode 100644 index 067eb27..0000000 --- a/play25-bootstrap4/module/test/FieldConstructorsSpec.scala +++ /dev/null @@ -1,248 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b4 - -import views.html.b4 -import TestUtils._ -import org.specs2.mutable.Specification -import views.html.helper.FieldConstructor -import play.api.data.Forms._ -import play.api.data._ -import play.api.{ Configuration, Environment } -import play.api.i18n.{ DefaultLangs, DefaultMessagesApi } -import play.twirl.api.Html -import play.api.mvc.Call - -object FieldConstructorsSpec extends Specification { - - val messagesApi = new DefaultMessagesApi(Environment.simple(), Configuration.reference, new DefaultLangs(Configuration.reference)) - implicit val messages = messagesApi.preferred(Seq.empty) - - def testFielConstructor(fcDefault: B4FieldConstructor, fcWithCustomFields: B4FieldConstructor, fcWithFeedbackTooltip: B4FieldConstructor) = { - implicit val fc = fcDefault - val testInputString = "" - def testInput(field: Field, args: (Symbol, Any)*) = - b4.inputFormGroup(field, true, args) { _ => Html(testInputString) } - - val fooForm = Form(single("foo" -> Forms.nonEmptyText(maxLength = 8))) - val fooField = fooForm("foo") - - val simpleInput = testInput(fooField).body - def simpleInputWithArgs(args: (Symbol, Any)*)(implicit fc: B4FieldConstructor) = b4.text(fooField, args: _*).body - def simpleInputWithError(args: (Symbol, Any)*)(implicit fc: B4FieldConstructor) = b4.text(fooForm.withError("foo", "test-error-0").withError("foo", "test-error-1")("foo"), args: _*).body - - val fieldsetExtraClasses = fc match { - case hfc: b4.horizontal.HorizontalFieldConstructor => " row" - case _ => "" - } - val labelExtraClasses = fc match { - case hfc: b4.horizontal.HorizontalFieldConstructor => "col-form-label " + hfc.colLabel - case _ => "" - } - - "have the basic structure" in { - simpleInput must contain("class=\"form-group") - simpleInput must not contain ("has-danger") - simpleInput must not contain ("aria-invalid") - simpleInput must contain(testInputString) - simpleInput must not contain ("class=\"-feedback\"") - simpleInput must not contain ("class=\"-tooltip\"") - simpleInput must not contain ("class=\"form-text text-muted\"") - } - - "have a default id" in { - simpleInput must contain("id=\"foo_field\"") - } - - "allow setting a custom id" in { - simpleInputWithArgs('_id -> "customid") must contain("id=\"customid\"") - } - - "allow setting extra classes form-group" in { - clean(simpleInputWithArgs('_class -> "extra_class another_class")) must contain(s"""
"theLabel")) must contain(if (labelExtraClasses == "") """""" else s"""""") - } - - "allow hide the label" in { - val labelString = if (labelExtraClasses == "") """""" else s"""""" - clean(simpleInputWithArgs('_label -> "theLabel", '_hideLabel -> true)) must contain(labelString) - clean(simpleInputWithArgs('_hiddenLabel -> "theLabel")) must contain(labelString) - } - - "allow render without label" in { - simpleInputWithArgs() must not contain ("label") - } - - "allow rendering errors" in { - val test = simpleInputWithError() - test must contain("has-danger") - test must contain("
test-error-0
") - test must contain("
test-error-1
") - } - - "allow showing constraints" in { - val test = simpleInputWithArgs('_showConstraints -> true) - test must contain("") - test must contain("") - test must contain("class=\"form-text text-muted\">" + messages("constraint.required") + "") - test must contain("class=\"form-text text-muted\">" + messages("constraint.maxLength", 8) + "") - } - - "localize placeholder property" in { - val test = simpleInputWithArgs('placeholder -> "simpleInputWithArgs.placeholder.value") - test must contain("placeholder=\"Placeholder value\"") - } - - "allow showing help info" in { - simpleInputWithArgs('_help -> "test-help") must contain("test-help") - simpleInputWithArgs('_success -> "test-help") must contain("
test-help
") - simpleInputWithArgs('_warning -> "test-help") must contain("
test-help
") - simpleInputWithArgs('_error -> "test-help") must contain("
test-help
") - } - - "allow rendering erros and hide constraints when help info is present" in { - val test = simpleInputWithError('_showConstraints -> true, '_help -> "test-help") - test must contain("
test-error-0
") - test must contain("
test-error-1
") - test must contain("test-help") - test must not contain (" true) - testStatus("success", '_success -> "test-help") - testStatus("warning", '_warning -> true) - testStatus("warning", '_warning -> "test-help") - testStatus("danger", '_error -> true) - testStatus("danger", '_error -> "test-help") - - "with feedback icons" in { - testStatus("success", '_showIconValid -> true) - testStatus("success", '_success -> "test-help", '_showIconValid -> true) - testStatus("warning", '_showIconWarning -> true) - testStatus("warning", '_warning -> "test-help", '_showIconWarning -> true) - testStatus("danger", '_error -> true, '_showIconOnError -> true) - testStatus("danger", '_error -> "test-help", '_showIconOnError -> true) - } - } - - "render aria attributes" in { - val test0 = simpleInputWithArgs() - test0 must not contain ("aria-invalid") - test0 must not contain ("aria-describedby") - test0 must not contain (" true) - test1 must contain("aria-invalid=\"true\"") - test1 must contain("aria-describedby=\"foo_error_0 foo_error_1 foo_info_0 foo_info_1\"") - test1 must contain(" "test-help") - test2 must contain("aria-describedby=\"foo_info_0\"") - test2 must contain(" true).body.trim - val customFile2 = b4.file(fooField)(fcWithCustomFields, messages).body.trim - customFile1 must be equalTo customFile2 - - val boolField = Form(single("foo" -> Forms.boolean))("foo") - val customCheckbox1 = b4.checkbox(boolField, '_custom -> true, '_text -> "theText").body.trim - val customCheckbox2 = b4.checkbox(boolField, '_text -> "theText")(fcWithCustomFields, messages).body.trim - customCheckbox1 must be equalTo customCheckbox2 - - val fruits = Seq("A" -> "Apples", "P" -> "Pears", "B" -> "Bananas") - val customRadio1 = b4.radio(fooField, fruits, '_custom -> true).body.trim - val customRadio2 = b4.radio(fooField, fruits)(fcWithCustomFields, messages).body.trim - customRadio1 must be equalTo customRadio2 - - val customSelect1 = b4.select(fooField, fruits, '_custom -> true).body.trim - val customSelect2 = b4.select(fooField, fruits)(fcWithCustomFields, messages).body.trim - customSelect1 must be equalTo customSelect2 - } - - "allow rendering with feedback tooltips" in { - val test1 = simpleInputWithError()(fc) - val test2 = simpleInputWithError()(fcWithFeedbackTooltip) - test1.replaceAll("-feedback", "-tooltip") must be equalTo test2 - - val test3 = simpleInputWithArgs('_success -> "test-help")(fc) - val test4 = simpleInputWithArgs('_success -> "test-help")(fcWithFeedbackTooltip) - test3.replaceAll("-feedback", "-tooltip") must be equalTo test4 - - val test5 = simpleInputWithArgs('_warning -> "test-help")(fc) - val test6 = simpleInputWithArgs('_warning -> "test-help")(fcWithFeedbackTooltip) - test6.replaceAll("-feedback", "-tooltip") must be equalTo test6 - } - } - - "horizontal field constructor" should { - val (colLabel, colInput) = ("col-md-2", "col-md-10") - implicit val horizontalFieldConstructor = new b4.horizontal.HorizontalFieldConstructor(colLabel, colInput) - val fcWithCustomFields = new b4.horizontal.HorizontalFieldConstructor(colLabel, colInput, isCustom = true) - val fcWithFeedbackTooltip = new b4.horizontal.HorizontalFieldConstructor(colLabel, colInput, withFeedbackTooltip = true) - - testFielConstructor(horizontalFieldConstructor, fcWithCustomFields, fcWithFeedbackTooltip) - - "render columns for horizontal form" in { - val body = b4.text(Form(single("foo" -> Forms.text))("foo"), '_label -> "theLabel").body - body must contain(colLabel) - body must contain(colInput) - } - } - - "vertical field constructor" should { - implicit val verticalFieldConstructor = new b4.vertical.VerticalFieldConstructor() - val fcWithCustomFields = new b4.vertical.VerticalFieldConstructor(isCustom = true) - val fcWithFeedbackTooltip = new b4.vertical.VerticalFieldConstructor(withFeedbackTooltip = true) - testFielConstructor(verticalFieldConstructor, fcWithCustomFields, fcWithFeedbackTooltip) - } - - "inline field constructor" should { - implicit val inlineFieldConstructor = new b4.inline.InlineFieldConstructor() - val fcWithCustomFields = new b4.inline.InlineFieldConstructor(isCustom = true) - val fcWithFeedbackTooltip = new b4.inline.InlineFieldConstructor(withFeedbackTooltip = true) - testFielConstructor(inlineFieldConstructor, fcWithCustomFields, fcWithFeedbackTooltip) - } - - "clear field constructor" should { - implicit val clearFieldConstructor = b4.clear.fieldConstructor() - - "simply render the input" in { - val simpleInput = b4.text(Form(single("foo" -> Forms.text))("foo")).body.trim - simpleInput must startWith("") - // Make sure it doesn't have it twice - simpleInput.substring(simpleInput.indexOf(">") + 1) must not contain (">") - } - } -} diff --git a/play25-bootstrap4/module/test/FormsSpec.scala b/play25-bootstrap4/module/test/FormsSpec.scala deleted file mode 100644 index 1796d46..0000000 --- a/play25-bootstrap4/module/test/FormsSpec.scala +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b4 - -import views.html.b4 -import TestUtils._ -import org.specs2.mutable.Specification -import play.api.data.Forms._ -import play.api.data._ -import play.api.{ Configuration, Environment } -import play.api.i18n.{ DefaultLangs, DefaultMessagesApi } -import play.twirl.api.Html -import play.api.mvc.Call - -object FormsSpec extends Specification { - - val messagesApi = new DefaultMessagesApi(Environment.simple(), Configuration.reference, new DefaultLangs(Configuration.reference)) - implicit val messages = messagesApi.preferred(Seq.empty) - - val vfc = b4.vertical.fieldConstructor() - val (colLabel, colInput) = ("col-md-2", "col-md-10") - val hfc = b4.horizontal.fieldConstructor(colLabel, colInput) - val ifc = b4.inline.fieldConstructor() - val cfc = b4.clear.fieldConstructor() - - val testContentString = "" - - val (method, action) = ("POST", "/handleRequest") - val fooCall = Call(method, action) - def fooFormBody(args: (Symbol, Any)*)(fc: b4.B4FieldConstructor) = b4.form(fooCall, args: _*)(Html(testContentString))(fc).body - - "@form" should { - - val simple = fooFormBody()(vfc) - - "have action and method" in { - simple must contain("action=\"" + action + "\"") - simple must contain("method=\"" + method + "\"") - } - - "add default class for each field constructor" in { - fooFormBody()(vfc) must contain("class=\"form-vertical") - fooFormBody()(hfc) must contain("class=\"form-horizontal") - fooFormBody()(ifc) must contain("class=\"form-inline") - fooFormBody()(cfc) must contain("class=\"form-clear") - } - - "allow setting custom class" in { - fooFormBody('class -> "customClass")(vfc) must contain("class=\"form-vertical customClass\"") - } - - "allow disabling default class" in { - fooFormBody('_disableDefaultClass -> true)(vfc) must not contain ("form-vertical") - fooFormBody('_disableDefaultClass -> true, 'class -> "customClass")(vfc) must contain("class=\"customClass\"") - } - - "add form role as default" in { - simple must contain("role=\"form\"") - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = fooFormBody('extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test")(vfc) - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - - "render the content body" in { - simple must contain("") - } - } -} \ No newline at end of file diff --git a/play25-bootstrap4/module/test/HelpersSpec.scala b/play25-bootstrap4/module/test/HelpersSpec.scala deleted file mode 100644 index cec1725..0000000 --- a/play25-bootstrap4/module/test/HelpersSpec.scala +++ /dev/null @@ -1,767 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b4 - -import views.html.b4 -import TestUtils._ -import org.specs2.mutable.Specification -import views.html.helper._ -import play.api.data.Forms._ -import play.api.data._ -import play.api.{ Configuration, Environment } -import play.api.i18n.{ DefaultLangs, DefaultMessagesApi, Messages } -import play.twirl.api.{ Html, HtmlFormat } -import play.api.mvc.Call - -object HelpersSpec extends Specification { - - val messagesApi = new DefaultMessagesApi(Environment.simple(), Configuration.reference, new DefaultLangs(Configuration.reference)) - implicit val messages = messagesApi.preferred(Seq.empty) - - val vfc = b4.vertical.fieldConstructor() - val (colLabel, colInput) = ("col-md-2", "col-md-10") - val hfc = b4.horizontal.fieldConstructor(colLabel, colInput) - val ifc = b4.inline.fieldConstructor() - val cfc = b4.clear.fieldConstructor() - - /** - * A test field constructor that simply renders the input - */ - implicit val testFieldConstructor = new B4FieldConstructor { - val formClass = "" - val isCustom = false - val withFeedbackTooltip = false - def apply(fieldInfo: B4FieldInfo, inputHtml: Html)(implicit messages: Messages) = inputHtml - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = contentHtml - } - - val fooField = Form(single("foo" -> Forms.text))("foo") - def fooFieldFilled(v: String) = Form(single("foo" -> Forms.text)).fill(v)("foo") - - "@inputType" should { - - "allow setting a custom id" in { - val body = b4.inputType("text", fooField, 'id -> "someid").body - val idAttr = "id=\"someid\"" - body must contain(idAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(idAttr) + idAttr.length) must not contain (idAttr) - } - - "allow setting a custom type" in { - val body = b4.inputType("email", fooField).body - val typeAttr = "type=\"email\"" - body must contain(typeAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(typeAttr) + typeAttr.length) must not contain (typeAttr) - } - - "add form-control class as default" in { - b4.inputType("text", fooField).body must contain("class=\"form-control\"") - } - - "allow setting additional classes" in { - b4.inputType("text", fooField, 'class -> "extra_class").body must contain("class=\"form-control extra_class\"") - } - - "allow setting a default value" in { - val body = b4.inputType("text", fooField, 'value -> "defaultvalue").body - val valueAttr = "value=\"defaultvalue\"" - body must contain(valueAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(valueAttr) + valueAttr.length) must not contain (valueAttr) - } - - "allow being filled with a value" in { - val body = b4.inputType("text", fooFieldFilled("filledvalue"), 'value -> "defaultvalue").body - val valueAttr = "value=\"filledvalue\"" - body must contain(valueAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(valueAttr) + valueAttr.length) must not contain (valueAttr) - // Make sure it doesn't contain the default value - body must not contain ("value=\"defaultvalue\"") - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = b4.inputType("text", fooField, 'extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test").body - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - } - - val sampleArgs = Seq[(Symbol, Any)]('id -> "someid", 'foo -> "fooValue") - def sampleInputTypeBody(theType: String) = b4.inputType(theType, fooField, sampleArgs: _*).body.trim - - "@text" should { - "be equivalent to inputType with text type" in { - b4.text(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("text") - } - } - "@password" should { - "be equivalent to inputType with password type" in { - b4.password(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("password") - } - "not display its value" in { - b4.password(fooFieldFilled("barValue"), sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("password") - } - } - "@file" should { - "be equivalent to inputType with file type" in { - val file = b4.file(fooField, sampleArgs: _*).body.trim - file must contain(""" true) +: sampleArgs): _*).body.trim - customFile must contain("""
""") - customFile must contain(""" "someid").body - val idAttr = "id=\"someid\"" - body must contain(idAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(idAttr) + idAttr.length) must not contain (idAttr) - } - - "add form-control class as default" in { - b4.textarea(fooField).body must contain("class=\"form-control\"") - } - - "allow setting additional classes" in { - b4.textarea(fooField, 'class -> "extra_class").body must contain("class=\"form-control extra_class\"") - } - - "allow setting a default value" in { - val body = b4.textarea(fooField, 'value -> "defaultvalue").body - body must contain(">defaultvalue") - body must not contain ("value=\"defaultvalue\"") - } - } - - "@checkbox" should { - - val boolField = Form(single("foo" -> Forms.boolean))("foo") - def boolFieldFilled(v: Boolean) = Form(single("foo" -> Forms.boolean)).fill(v)("foo") - def stringFieldFilled(v: String) = Form(single("foo" -> Forms.text)).fill(v)("foo") - - "allow setting a custom id" in { - val body = b4.checkbox(boolField, 'id -> "someid").body - val idAttr = "id=\"someid\"" - body must contain(idAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(idAttr) + idAttr.length) must not contain (idAttr) - } - - "be unchecked by default" in { - val body = b4.checkbox(boolField).body - body must not contain ("checked") - body must contain("value=\"true\"") - } - - "allow setting a default custom value" in { - val body = b4.checkbox(boolField, 'value -> "bar").body - body must not contain ("checked") - body must contain("value=\"bar\"") - } - - "allow setting a default value for checked attribute" in { - val body = b4.checkbox(boolField, '_default -> true).body - body must contain("checked") - body must contain("value=\"true\"") - } - - "allow setting a default value for checked attribute with a custom value" in { - val body = b4.checkbox(boolField, 'value -> "bar", '_default -> true).body - body must contain("checked") - body must contain("value=\"bar\"") - } - - "allow being filled with a value" in { - val body = b4.checkbox(boolFieldFilled(true)).body - body must contain("checked") - body must contain("value=\"true\"") - } - - "allow being filled with a custom value" in { - val body = b4.checkbox(stringFieldFilled("bar"), 'value -> "bar").body - body must contain("checked") - body must contain("value=\"bar\"") - } - - "ignore default checked value if it is filled" in { - val body1 = b4.checkbox(boolFieldFilled(false), '_default -> true).body - body1 must not contain ("checked") - body1 must contain("value=\"true\"") - val body2 = b4.checkbox(stringFieldFilled(""), 'value -> "bar", '_default -> true).body - body2 must not contain ("checked") - body2 must contain("value=\"bar\"") - } - - "allow setting a forced value for checked attribute (always true)" in { - val body = b4.checkbox(boolField, 'checked -> true).body - body must contain("checked") - body must contain("value=\"true\"") - } - "allow setting a forced value for checked attribute (always false)" in { - val body = b4.checkbox(boolField, 'checked -> false).body - body must not contain ("checked") - body must contain("value=\"true\"") - } - - "ignore default and filled checked value if it has forced checked" in { - val body1 = b4.checkbox(boolFieldFilled(false), '_default -> false, 'checked -> true).body - body1 must contain("checked") - body1 must contain("value=\"true\"") - val body2 = b4.checkbox(boolFieldFilled(true), '_default -> true, 'checked -> false).body - body2 must not contain ("checked") - body2 must contain("value=\"true\"") - val body3 = b4.checkbox(stringFieldFilled(""), 'value -> "bar", '_default -> false, 'checked -> true).body - body3 must contain("checked") - body3 must contain("value=\"bar\"") - val body4 = b4.checkbox(stringFieldFilled("bar"), 'value -> "bar", '_default -> true, 'checked -> false).body - body4 must not contain ("checked") - body4 must contain("value=\"bar\"") - } - - "add support to readonly attribute" in { - val bodyWithoutReadonly = b4.checkbox(boolField, 'value -> true).body - bodyWithoutReadonly must contain("
false, 'value -> true).body - bodyReadonlyFalse must contain("
") - - val bodyReadonlyTrue = b4.checkbox(boolField, 'readonly -> true, 'value -> true).body - bodyReadonlyTrue must contain("
") - bodyReadonlyTrue must contain("disabled=\"true\"") - bodyReadonlyTrue must contain("") - } - - "render custom checkbox properly" in { - val body = clean(b4.checkbox(boolField, '_custom -> true, '_text -> "theText").body) - body must contain("""
""") - body must contain("""""") - body must contain("""""") - } - } - - "@radio" should { - - val fruits = Seq("A" -> "Apples", "P" -> "Pears", "B" -> "Bananas") - - "allow setting a custom id" in { - val body = b4.radio(fooField, fruits, 'id -> "someid").body - body must contain("id=\"someid_A\"") - body must contain("id=\"someid_P\"") - body must contain("id=\"someid_B\"") - } - - "be unchecked by default" in { - b4.radio(fooField, fruits).body must not contain ("checked") - } - - "allow setting a default value" in { - val body = b4.radio(fooField, fruits, 'value -> "B").body - val checkedAttr = "checked" - body must contain(checkedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(checkedAttr) + checkedAttr.length) must not contain (checkedAttr) - } - - "allow being filled with a value" in { - val body = b4.radio(fooFieldFilled("B"), fruits).body - val checkedAttr = "checked" - body must contain(checkedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(checkedAttr) + checkedAttr.length) must not contain (checkedAttr) - } - - "not be inline by default" in { - b4.radio(fooField, fruits).body must not contain ("form-check-inline") - } - - "allow be inline" in { - b4.radio(fooField, fruits, '_inline -> true).body must contain("form-check-inline") - } - - "add support to readonly attribute" in { - val bodyWithoutReadonly = b4.radio(fooField, fruits, 'value -> "B").body - bodyWithoutReadonly must not contain ("radio-group") - bodyWithoutReadonly must not contain ("disabled") - bodyWithoutReadonly must not contain (" false, 'value -> "B").body - bodyReadonlyFalse must contain("
") - bodyReadonlyFalse must not contain ("disabled=\"true\"") - bodyReadonlyFalse must contain("
") - - val bodyReadonlyTrue = b4.radio(fooField, fruits, 'readonly -> true, 'value -> "B").body - bodyReadonlyTrue must contain("
") - bodyReadonlyTrue must contain("disabled=\"true\"") - bodyReadonlyTrue must contain("
") - } - - "render custom radio properly" in { - val body = clean(b4.radio(fooField, fruits, '_custom -> true).body) - body must contain("""
""") - body must contain(""" "Apples", "P" -> "Pears", "B" -> "Bananas") - - "allow setting a custom id" in { - val body = b4.select(fooField, fruits, 'id -> "someid").body - body must contain("id=\"someid\"") - } - - "add form-control class as default" in { - b4.select(fooField, fruits).body must contain("class=\"form-control\"") - } - - "allow setting additional classes" in { - b4.select(fooField, fruits, 'class -> "extra_class").body must contain("class=\"form-control extra_class\"") - } - - "be unselected by default" in { - b4.select(fooField, fruits).body must not contain ("selected") - } - - "allow setting a default value" in { - val body = b4.select(fooField, fruits, 'value -> "B").body - val selectedAttr = "selected" - body must contain(selectedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(selectedAttr) + selectedAttr.length) must not contain (selectedAttr) - } - - "allow being filled with a value" in { - val body = b4.select(fooFieldFilled("B"), fruits).body - val selectedAttr = "selected" - body must contain(selectedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(selectedAttr) + selectedAttr.length) must not contain (selectedAttr) - } - - "add support to readonly attribute" in { - val bodyWithoutReadonly = b4.select(fooField, fruits, 'value -> "B").body - bodyWithoutReadonly must not contain ("
") - bodyWithoutReadonly must not contain ("disabled") - bodyWithoutReadonly must not contain (" false, 'value -> "B").body - bodyReadonlyFalse must contain("
") - bodyReadonlyFalse must not contain ("disabled=\"true\"") - bodyReadonlyFalse must contain("") - - val bodyReadonlyTrue = b4.select(fooField, fruits, 'readonly -> true, 'value -> "B").body - bodyReadonlyTrue must contain("
") - bodyReadonlyTrue must contain("disabled=\"true\"") - bodyReadonlyTrue must contain("") - } - - "allow multiple" in { - val body = b4.select(fooField, fruits, 'multiple -> true, 'value -> "P,B").body - body must contain("multiple=\"true\"") - val selectedAttr = "selected" - body must contain(selectedAttr) - // Make sure it has it twice, but not more. - val restBody = body.substring(body.indexOf(selectedAttr) + selectedAttr.length) - restBody must contain(selectedAttr) - restBody.substring(restBody.indexOf(selectedAttr) + selectedAttr.length) must not contain (selectedAttr) - } - - "render custom select properly" in { - val body = b4.select(fooField, fruits, '_custom -> true).body - body must contain("""""" - } - "with Field object" in { - val body = clean(b4.hidden(fooField, 'value -> "testValue", 'foo -> "bar").body) - body must be equalTo """""" - } - "with filled Field object" in { - val body = clean(b4.hidden(fooFieldFilled("filledValue"), 'value -> "testValue", 'foo -> "bar").body) - body must be equalTo """""" - } - } - "@hiddens" should { - "be rendered correctly" in { - val body = clean(b4.hiddens("fooId" -> 1L, "barId" -> 2L).body) - body must be equalTo """""" - } - } - - "@color" should { - "be equivalent to inputType with date type" in { - b4.color(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("color") - } - } - "@date" should { - "be equivalent to inputType with date type" in { - b4.date(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("date") - } - } - "@datetime" should { - "be equivalent to inputType with date type" in { - b4.datetime(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("datetime") - } - } - "@datetimeLocal" should { - "be equivalent to inputType with date type" in { - b4.datetimeLocal(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("datetime-local") - } - } - "@email" should { - "be equivalent to inputType with email type" in { - b4.email(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("email") - } - } - "@month" should { - "be equivalent to inputType with date type" in { - b4.month(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("month") - } - } - "@number" should { - "be equivalent to inputType with date type" in { - b4.number(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("number") - } - } - "@range" should { - "be equivalent to inputType with date type" in { - b4.range(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("range") - } - } - "@search" should { - "be equivalent to inputType with date type" in { - b4.search(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("search") - } - } - "@tel" should { - "be equivalent to inputType with date type" in { - b4.tel(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("tel") - } - } - "@time" should { - "be equivalent to inputType with date type" in { - b4.time(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("time") - } - } - "@url" should { - "be equivalent to inputType with date type" in { - b4.url(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("url") - } - } - "@week" should { - "be equivalent to inputType with date type" in { - b4.week(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("week") - } - } - - "@formGroup" should { - - def testFormGroup(args: (Symbol, Any)*)(fc: b4.B4FieldConstructor, msgs: Messages) = - clean(b4.freeFormGroup(args)(innerArgs => Html(""))(fc, msgs).body) - - "vertical: show label" in { - testFormGroup('_class -> "theClass", '_id -> "theId", '_label -> "theLabel")(vfc, messages) must be equalTo clean(""" -
- - -
- """) - } - "vertical: without label" in { - testFormGroup('_class -> "theClass", '_id -> "theId")(vfc, messages) must be equalTo clean(""" -
- -
- """) - } - "horizontal: show label" in { - testFormGroup('_class -> "theClass", '_id -> "theId", '_label -> "theLabel")(hfc, messages) must be equalTo clean(""" -
- -
- -
-
- """) - } - "horizontal: without label" in { - testFormGroup('_class -> "theClass", '_id -> "theId")(hfc, messages) must be equalTo clean(""" -
-
- -
-
- """) - } - "inline: show label" in { - testFormGroup('_class -> "theClass", '_id -> "theId", '_label -> "theLabel")(ifc, messages) must be equalTo clean(""" -
- - -
- """) - } - "inline: without label" in { - testFormGroup('_class -> "theClass", '_id -> "theId")(ifc, messages) must be equalTo clean(""" -
- -
- """) - } - - "get the inner arguments for the content" in { - val body = b4.freeFormGroup(Seq('_class -> "theClass", '_underscored -> "underscored", 'foo -> "foo"))(innerArgsMap => Html(innerArgsMap.toSeq.map(a => s"""${a._1.name}="${a._2.toString}"""").mkString("")))(vfc, messages).body - body must not contain "_class=\"theClass\"" - body must not contain "_underscored=\"underscored\"" - body must contain("foo=\"foo\"") - } - } - - "@free" should { - "be rendered correctly" in { - clean(b4.free('foo -> "fooValue")(Html(""))(vfc, messages).body) must be equalTo clean(b4.freeFormGroup(Seq('foo -> "fooValue"))(_ => Html(""))(vfc, messages).body) - } - } - - "@static" should { - - "render with form-control-static class as default" in { - b4.static("theLabel")(Html("theText"))(vfc, messages).body must contain("

theText

") - } - - "allow setting additional classes" in { - b4.static("theLabel", 'class -> "extra_class")(Html("theText"))(vfc, messages).body must contain("

theText

") - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = b4.static("theLabel", 'extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test")(Html("theText"))(vfc, messages).body - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - } - - "@buttonType" should { - - val sampleType = "myButtonType" - val sampleContent = "sample-content" - def buttonTypeBody(args: (Symbol, Any)*) = b4.buttonType(sampleType, args: _*)(Html(sampleContent))(vfc, messages).body - - "allow setting a custom type" in { - val body = buttonTypeBody() - val typeAttr = "type=\"" + sampleType + "\"" - body must contain(typeAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(typeAttr) + typeAttr.length) must not contain (typeAttr) - } - "render content" in { - buttonTypeBody() must contain(sampleContent) - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = buttonTypeBody('extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test") - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - - "be rendered correctly" in { - val body = buttonTypeBody('id -> "someid", 'class -> "btn btn-default") - body must contain("") - } - } - - def sampleButtonTypeBody(theType: String) = b4.buttonType(theType, sampleArgs: _*)(Html("content"))(vfc, messages).body.trim - - "@submit" should { - "be equivalent to buttonType with submit type" in { - b4.submit(sampleArgs: _*)(Html("content"))(vfc, messages).body.trim must be equalTo sampleButtonTypeBody("submit") - } - } - "@reset" should { - "be equivalent to buttonType with reset type" in { - b4.reset(sampleArgs: _*)(Html("content"))(vfc, messages).body.trim must be equalTo sampleButtonTypeBody("reset") - } - } - "@button" should { - "be equivalent to buttonType with button type" in { - b4.button(sampleArgs: _*)(Html("content"))(vfc, messages).body.trim must be equalTo sampleButtonTypeBody("button") - } - } - - "@inputWrapped" should { - - "be equivalent to inputType for an empty wrapper" in { - val bodyInputType = clean(b4.inputType("text", fooField, 'id -> "someid").body) - val body = clean(b4.inputWrapped("text", fooField, 'id -> "someid")(x => x).body) - body must be equalTo bodyInputType - } - - "wrap the input" in { - val bodyInputType = clean(b4.inputType("text", fooField, 'id -> "someid").body) - val (wrapperPre, wrapperPost) = ("", "") - def wrap(input: Html) = HtmlFormat.fill(scala.collection.immutable.Seq(Html(wrapperPre), input, Html(wrapperPost))) - val body = clean(b4.inputWrapped("text", fooField, 'id -> "someid")(input => wrap(input)).body) - - val (indexOfWrapperPre, indexOfWrapperPost) = (body.indexOf(wrapperPre), body.indexOf(wrapperPost)) - - body.substring(0, indexOfWrapperPre) must be equalTo bodyInputType.substring(0, indexOfWrapperPre) - body.substring(indexOfWrapperPre, indexOfWrapperPre + wrapperPre.length) must be equalTo wrapperPre - body.substring(indexOfWrapperPre + wrapperPre.length, indexOfWrapperPost) must be equalTo bodyInputType.substring(indexOfWrapperPre, indexOfWrapperPost - wrapperPre.length) - body.substring(indexOfWrapperPost, indexOfWrapperPost + wrapperPost.length) must be equalTo wrapperPost - body.substring(indexOfWrapperPost + wrapperPost.length) must be equalTo bodyInputType.substring(indexOfWrapperPost - wrapperPre.length) - } - } - - "@multifield" should { - - val testInputsString = "" - val fooForm = Form(tuple("foo" -> Forms.nonEmptyText, "bar" -> Forms.nonEmptyText)) - val fooFormWithError = fooForm.withError("foo", "test-error") - - def multifield(form: Form[(String, String)], globalArgs: Seq[(Symbol, Any)] = Seq(), fieldsArgs: Seq[(Symbol, Any)] = Seq())(fc: b4.B4FieldConstructor, messages: Messages) = - clean(b4.multifield(form("foo"), form("bar"))(globalArgs, fieldsArgs)(cfc => Html(testInputsString))(fc, messages).body) - def fooMultifield(globalArgs: (Symbol, Any)*) = multifield(fooForm, globalArgs)(vfc, messages) - def fooMultifieldWithFielsArgs(fieldsArgs: (Symbol, Any)*) = multifield(fooForm, fieldsArgs = fieldsArgs)(vfc, messages) - - "have the basic structure" in { - val body = fooMultifield('_label -> "theLabel") - body must contain("class=\"form-group") - body must not contain ("has-danger") - body must contain("") - body must contain(testInputsString) - body must not contain ("class=\"form-control-feedback\"") - body must not contain ("class=\"form-text\"") - } - - "behave as a horizontal field constructor" in { - val body = multifield(fooForm, Seq('_label -> "theLabel"))(hfc, messages) - body must contain("") - body must contain("
") - } - - "allow setting a custom id" in { - fooMultifield('_id -> "customid") must contain("id=\"customid\"") - } - - "allow setting extra classes form-group" in { - fooMultifield('_class -> "extra_class another_class") must contain("class=\"form-group extra_class another_class") - } - - "show label" in { - multifield(fooForm, Seq('_label -> "fooLabel"))(vfc, messages) must contain("") - multifield(fooForm, Seq('_label -> "fooLabel"))(hfc, messages) must contain("") - } - - "without label" in { - multifield(fooForm)(vfc, messages) must not contain ("label") - multifield(fooForm)(hfc, messages) must not contain ("label") - } - - "allow rendering errors" in { - val body = multifield(fooFormWithError)(vfc, messages) - body must contain("has-danger") - body must contain("
test-error
") - } - - "allow showing constraints" in { - fooMultifield('_showConstraints -> true) must contain("" + messages("constraint.required") + "") - } - - "allow showing help info" in { - fooMultifield('_help -> "test-help") must contain("""test-help""") - fooMultifield('_success -> "test-help") must contain("""
test-help
""") - fooMultifieldWithFielsArgs('_success -> "test-help") must contain("""
test-help
""") - fooMultifield('_warning -> "test-help") must contain("""
test-help
""") - fooMultifieldWithFielsArgs('_warning -> "test-help") must contain("""
test-help
""") - fooMultifield('_error -> "test-help") must contain("""
test-help
""") - fooMultifieldWithFielsArgs('_error -> "test-help") must contain("""
test-help
""") - } - - "render validation states" in { - def withStatus(status: String) = contain(s"""
b4.text(fooForm("foo"), args: _*))(vfc, messages).body) - else - clean(b4.multifield(fooForm("foo"))(globalArgs = args, fieldsArgs = Seq())(cfc => b4.text(fooForm("foo"), args: _*))(vfc, messages).body) - test must withStatus(status) - } - - testStatus("success", withFieldsArgs = false, '_success -> true) - testStatus("success", withFieldsArgs = true, '_success -> true) - testStatus("success", withFieldsArgs = false, '_success -> "test-help") - testStatus("success", withFieldsArgs = true, '_success -> "test-help") - testStatus("warning", withFieldsArgs = false, '_warning -> true) - testStatus("warning", withFieldsArgs = true, '_warning -> true) - testStatus("warning", withFieldsArgs = false, '_warning -> "test-help") - testStatus("warning", withFieldsArgs = true, '_warning -> "test-help") - testStatus("danger", withFieldsArgs = false, '_error -> true) - testStatus("danger", withFieldsArgs = true, '_error -> true) - testStatus("danger", withFieldsArgs = false, '_error -> "test-help") - testStatus("danger", withFieldsArgs = true, '_error -> "test-help") - - "with feedback icons" in { - testStatus("success", withFieldsArgs = false, '_showIconValid -> true) - testStatus("success", withFieldsArgs = true, '_showIconValid -> true) - testStatus("success", withFieldsArgs = false, '_success -> "test-help", '_showIconValid -> true) - testStatus("success", withFieldsArgs = true, '_success -> "test-help", '_showIconValid -> true) - testStatus("warning", withFieldsArgs = false, '_showIconWarning -> true) - testStatus("warning", withFieldsArgs = true, '_showIconWarning -> true) - testStatus("warning", withFieldsArgs = false, '_warning -> "test-help", '_showIconWarning -> true) - testStatus("warning", withFieldsArgs = true, '_warning -> "test-help", '_showIconWarning -> true) - testStatus("danger", withFieldsArgs = false, '_error -> true, '_showIconOnError -> true) - testStatus("danger", withFieldsArgs = true, '_error -> true, '_showIconOnError -> true) - testStatus("danger", withFieldsArgs = false, '_error -> "test-help", '_showIconOnError -> true) - testStatus("danger", withFieldsArgs = true, '_error -> "test-help", '_showIconOnError -> true) - } - } - - } -} \ No newline at end of file diff --git a/play25-bootstrap4/module/test/TestUtils.scala b/play25-bootstrap4/module/test/TestUtils.scala deleted file mode 100644 index c74a4c4..0000000 --- a/play25-bootstrap4/module/test/TestUtils.scala +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b4 - -object TestUtils { - - // clean a string removing control characters and extra whitespaces to compare equivalent rendered codes - def clean(str: String) = str.filter(_ >= ' ').replaceAll("\\s+", " ").trim.replaceAll(">\\s+<", "><").replaceAll("\\s+\"", "\"").replaceAll("=\"\\s+", "=\"") - -} \ No newline at end of file diff --git a/play25-bootstrap4/module/test/resources/messages b/play25-bootstrap4/module/test/resources/messages deleted file mode 100644 index 8cf79aa..0000000 --- a/play25-bootstrap4/module/test/resources/messages +++ /dev/null @@ -1 +0,0 @@ -simpleInputWithArgs.placeholder.value=Placeholder value diff --git a/play25-bootstrap4/sample/app/Filters.scala b/play25-bootstrap4/sample/app/Filters.scala deleted file mode 100644 index 578e98d..0000000 --- a/play25-bootstrap4/sample/app/Filters.scala +++ /dev/null @@ -1,7 +0,0 @@ -import play.api.http.HttpFilters -import play.filters.csrf.CSRFFilter -import javax.inject.Inject - -class Filters @Inject() (csrfFilter: CSRFFilter) extends HttpFilters { - def filters = Seq(csrfFilter) -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/assets/javascripts/main.coffee b/play25-bootstrap4/sample/app/assets/javascripts/main.coffee deleted file mode 100644 index bea14b7..0000000 --- a/play25-bootstrap4/sample/app/assets/javascripts/main.coffee +++ /dev/null @@ -1,106 +0,0 @@ - -############################################################################################################ -## Smoth scroll for docs - -scrollWithAnimation = ($id, duration) -> - $('html,body').animate({scrollTop: $id.offset().top - 55}, duration) - -############################################################################################################ -## For readonly example - -disableForm = ($form) -> - $formGroups = $form.find('.form-group:not(.always-editable)') - $formGroups.find('input:not([type="file"], [type="checkbox"], [type="radio"], [type="hidden"])').removeAttr('disabled').attr('readonly', true) - $formGroups.find('input[type="file"], input[type="checkbox"], input[type="radio"], select').attr('disabled', true) - $formGroups.find('.checkbox, .radio, .radio-inline').addClass('disabled') - $formGroups.find('.checkbox-group, .radio-group, .select-group').find('input[type="hidden"]').removeAttr('disabled readonly') - -enableForm = ($form) -> - $formGroups = $form.find('.form-group:not(.always-editable)') - $formGroups.find('input:not([type="file"], [type="checkbox"], [type="radio"], [type="hidden"])').removeAttr('disabled readonly') - $formGroups.find('input[type="file"], input[type="checkbox"], input[type="radio"], select').removeAttr('disabled readonly') - $formGroups.find('.checkbox, .radio, .radio-inline').removeClass('disabled') - $formGroups.find('.checkbox-group, .radio-group, .select-group').find('input[type="hidden"]').removeAttr('readonly').attr('disabled', true) - -############################################################################################################ -## DOCUMENT IS READY - INIT APP -############################################################################################################ -$ -> - - ## For readonly example - $('.btn-readonly-unlock').click (e) -> - if $(this).hasClass('locked') - $(this).removeClass('locked btn-primary').addClass('btn-danger').text('Lock readonly fields') - enableForm($('#form-readonly')) - else - $(this).removeClass('btn-danger').addClass('locked btn-primary').text('Unlock readonly fields') - disableForm($('#form-readonly')) - if /\/readonly\/?\?\w/.test(window.location.href) - params = window.location.href.split('?')[1].split('&') - params = (p.split('=') for p in params) - getParam = (name, params) -> - foundParams = (p for p in params when p[0] == name) - if foundParams.length > 0 then foundParams[0][1] else undefined - text = getParam "text", params - checkbox = getParam "checkbox", params - radio = getParam "radio", params - select = getParam "select", params - if text? or checkbox? or radio? or select? - $data = $('#bound-data') - $data.find('#data-text').text text - $data.find('#data-checkbox').text checkbox - $data.find('#data-radio').text radio - $data.find('#data-select').text select - $data.removeAttr('hidden') - - - - # Change also the value of its companion input - $('.checkbox-group input[type="checkbox"]').change -> - $(this).parents('.checkbox-group').find('input[type="hidden"]').val $(this).prop('checked') - $('.radio-group input[type="radio"]').change -> - $radioGroup = $(this).parents('.radio-group') - $radioGroup.find('input[type="hidden"]').val $radioGroup.find('input[type="radio"]:checked').val() - $('.select-group select').change -> - $(this).parents('.select-group').find('input[type="hidden"]').val $(this).val() - - $('.input-daterange').datepicker - format: "dd-mm-yyyy" - todayBtn: "linked" - todayHighlight: true - - $('body[tab="docs"]').scrollspy - target: '#sidebar' - offset: 60 - - $('a[href*="#"]:not([href="#"], [href*="#collapse"], [data-toggle])').click (e) -> - if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) - target = $(this.hash) - target = if target.length then target else $('[name=' + this.hash.slice(1) +']') - if (target.length) - scrollWithAnimation(target, 500) - - hash = location.hash - if hash.length > 0 - scrollWithAnimation($(hash), 10) - - - $('.apply-tweak').click (e) -> - if $(this).hasClass('active') - $('.form-inline').removeClass('align-top') - $(this).removeClass('btn-danger').addClass('btn-info') - else - $('.form-inline').addClass('align-top') - $(this).removeClass('btn-info').addClass('btn-danger') - - - - $('.input-number-plus').click (e) -> - $input = $(this).parent().find('input') - current = parseInt $input.val(), 10 - $input.val current+1 - - $('.input-number-minus').click (e) -> - $input = $(this).parent().find('input') - current = parseInt $input.val(), 10 - $input.val current-1 \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/assets/stylesheets/main.less b/play25-bootstrap4/sample/app/assets/stylesheets/main.less deleted file mode 100644 index 261b944..0000000 --- a/play25-bootstrap4/sample/app/assets/stylesheets/main.less +++ /dev/null @@ -1,359 +0,0 @@ - -@nav-bg-color: #3264C8; -@nav-color: rgba(255,255,255,.5); -@nav-color-hover: rgba(255,255,255,.8); -@nav-color-active: white; -@bg-color: #fbfcfe; -@footer-bg-color: lighten(@nav-bg-color, 45%); - -@code-bg-color: #eee; -@code-color: #2f6f9f; - -@play-color: #93D53A; -@boostrap-color: #5C3F83; - - -// ------------------------ -// Warning state -.custom-select.is-warning, -.form-control.is-warning { - border-color: rgb(255, 174, 0); -} -.custom-select.is-warning~.warning-feedback, -.custom-select.is-warning~.warning-tooltip, -.form-control.is-warning~.warning-feedback, -.form-control.is-warning~.warning-tooltip { - display: block; -} -.warning-feedback { - display: none; - width: 100%; - margin-top: .25rem; - font-size: 80%; - color: rgb(255, 174, 0); -} -.warning-tooltip { - position: absolute; - top: 100%; - z-index: 5; - display: none; - max-width: 100%; - padding: .5rem; - margin-top: .1rem; - font-size: .875rem; - line-height: 1; - color: #fff; - background-color: rgba(255, 174, 0, 0.8); - border-radius: .2rem; -} -// ------------------------ - - -body { - position: relative; - padding-top: 80px; - background-color: @bg-color; -} - -.navbar { - background-color: @nav-bg-color; - .navbar-brand { - color: white; - &:hover, &:focus { - color: @nav-color-hover; - } - &.active { - color: @nav-color-active; - } - } - .navbar-nav { - & > li > a { - color: @nav-color; - &:hover, &:focus { - color: @nav-color-hover; - } - } - & > .active > a { - &, &:hover, &:focus { - color: @nav-color-active; - } - } - & > .open > a { - &, &:hover, &:focus { - color: @nav-color-active; - } - } - } - .dropdown-menu { - background-color: @nav-bg-color; - & > a { - background-color: @nav-bg-color !important; - color: @nav-color; - &:hover { - color: @nav-color-hover; - } - &.active { - color: @nav-color-active; - } - } - } - .github a { - color: white !important; - margin: -3px 0; - } - .version-badge .code { - color: white; - } - - a[version] { - padding: 5px 20px; - } - a.legacy { - font-style: italic; - color: #ddd !important; - } -} -.container { - max-width: 960px; -} -.version-badge { - .code { - font-size: 1.1em; - font-weight: bold; - color: @nav-bg-color; - } - .play-bootstrap { - & > span { - font-size: 0.9em; - font-weight: bold; - border: 1px solid @boostrap-color; - padding: 5px; - } - .play { - background-color: white; - color: @play-color; - border-top-left-radius: 5px; - border-bottom-left-radius: 5px; - } - .bootstrap { - background-color: @boostrap-color; - color: white; - border-top-right-radius: 5px; - border-bottom-right-radius: 5px; - } - } - a[version] { - padding: 5px 20px; - } -} -h1 small .version-badge { font-size: 20px; } - - -.header-with-logo { - & > div { - display: inline-block; - vertical-align: middle; - margin-right: 15px; - } -} -#github-buttons { - margin-top: 25px; - margin-bottom: 25px; - position: relative; - img { - position: absolute; - top: -5px; - left: 120px; - } -} -i.fa-github { - vertical-align: sub; -} -.footer { - background-color: @footer-bg-color; - margin-top: 20px; - padding: 20px 0; - line-height: 15px; -} - -h3, h4 { margin-top: 35px; } -h1 + h2, h2 + h3, h3 + h4 { margin-top: 15px; } - -input:invalid { color: red !important; } -.example-html5-validation input:valid { color: green !important; } - -.bd-example { - border: 0.4rem solid @code-bg-color; - padding: 0.8rem 1.2rem; - .form-group:last-child { margin-bottom: 0; } -} -.highlight { - padding: 0.8em; - background-color: @code-bg-color; - border: 1px solid @code-bg-color; - pre code { color: @code-color; } -} -pre code { - white-space: pre; -} -span.def { - color: #888; - font-size: 0.6em; - font-style: italic; - margin-left: 20px; -} - -.tab-pane > .bd-example { - border-top: 0; -} - -.form-inline { - button.apply-tweak { - width: 100%; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - } - .tweak .highlight { - border-top-left-radius: 0; - border-top-right-radius: 0; - pre code { - color: #aaa; - } - } - &.align-top { - .form-group { - vertical-align: top; - } - .tweak .highlight pre code { - color: #d9534f; - } - } -} - -[data-toggle="collapse"] { - .fa.fa-caret { - float: right; - margin-left: 15px; - &:before { content: "\f0d7" } - } - &[aria-expanded="true"] .fa.fa-caret:before { content: "\f0d8" } -} - - -.changelog { - h2 { - font-size: 24px; - } - .lead { - font-size: 18px; - font-style: italic; - } - ul { - list-style-type: none; - padding-left: 20px; - & > li { - font-size: 15px; - } - } - .panel ul { list-style-type: square; } -} - - -// For the examples: - -.multi-checkbox-list.inline > div { - display: inline-block; - margin-right: 20px; -} - -.input-text-checkbox > .input-group-addon { - .form-check { display: inline; } - label { - display: inline; - padding: 0; - input { - position: relative; - margin-left: 0; - } - } -} - - -.input-number-plus, .input-number-minus { cursor: pointer; } - -.input-number { - width: 150px; - input { - text-align: center; - & + .form-control-feedback { - right: 40px; - } - } -} - -.my-form-group { - white-space: nowrap; - & > div.field-container { - width: 50%; - } - & > div { - display: inline-block; - white-space: normal; - vertical-align: middle; - margin: 0; - ul { - padding-left: 0; - list-style-type: none; - } - .help-error { - color: #a94442 - } - .help-info { - color: #8a6d3b; - } - } -} - - - - - -// DOCS SIDEBAR - -@sidebar-color: #888; -@sidebar-active-color: @nav-bg-color; - - -[data-spy="scroll"] { - position: relative; - height: 100%; - overflow: auto; -} - -.affix { position: fixed; } - -#sidebar { - .nav-link, .dropdown-item { - background-color: inherit; - color: @sidebar-color; - border-left: 2px solid transparent; - &.active, &:hover { - color: @sidebar-active-color; - border-color: @sidebar-active-color; - } - } - .nav-link { - padding-left: 10px; - font-size: 14px; - font-weight: bold; - &:after { border: none; } - } - .dropdown-item { - font-size: 12px; - padding-top: 1px; - padding-bottom: 1px; - } - - .bd-sublinks { display: none; } - .nav-link.active + .bd-sublinks { display: inherit; } -} diff --git a/play25-bootstrap4/sample/app/controllers/Application.scala b/play25-bootstrap4/sample/app/controllers/Application.scala deleted file mode 100644 index 16aff33..0000000 --- a/play25-bootstrap4/sample/app/controllers/Application.scala +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package controllers - -import javax.inject.Inject -import play.api.i18n.{ MessagesApi, I18nSupport } -import play.api._ -import play.api.mvc._ -import play.api.data._ -import play.api.data.Forms._ -import play.api.data.validation.Constraints._ - -class Application @Inject() (val messagesApi: MessagesApi) extends Controller with I18nSupport { - - val fooForm = Form(single("foo" -> text(maxLength = 20))) - - val validationForm = Form(tuple( - "username" -> nonEmptyText(maxLength = 20), - "email" -> email, - "age" -> number(min = 18, max = 99), - "color" -> nonEmptyText.verifying(pattern("^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$".r)) - )) - - def index = Action { implicit request => Ok(views.html.index(fooForm, validationForm)) } - def vertical = Action { implicit request => Ok(views.html.vertical(fooForm)) } - def horizontal = Action { implicit request => Ok(views.html.horizontal(fooForm)) } - def inline = Action { implicit request => Ok(views.html.inline(fooForm)) } - def mixed = Action { implicit request => Ok(views.html.mixed(fooForm)) } - def readonly = Action { implicit request => Ok(views.html.readonly(fooForm)) } - def multifield = Action { implicit request => Ok(views.html.multifield(fooForm)) } - def extendIt = Action { implicit request => Ok(views.html.extendIt(fooForm)) } - def docs = Action { implicit request => Ok(views.html.docs(fooForm, validationForm)) } - -} diff --git a/play25-bootstrap4/sample/app/models/Fruit.scala b/play25-bootstrap4/sample/app/models/Fruit.scala deleted file mode 100644 index b3f2df2..0000000 --- a/play25-bootstrap4/sample/app/models/Fruit.scala +++ /dev/null @@ -1,3 +0,0 @@ -package models - -case class Fruit(id: Long, name: String, isCitrus: Boolean) \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/utils/BSVersion.scala b/play25-bootstrap4/sample/app/utils/BSVersion.scala deleted file mode 100644 index 5ad54dc..0000000 --- a/play25-bootstrap4/sample/app/utils/BSVersion.scala +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package utils - -object BSVersion { - final val code = "1.1.2-P25-B4" - final val library = "1.1" - final val play = "Play 2.5" - final val play_code = "2.5" - final val bootstrap = "Bootstrap 4" - final val bootstrap_code = "4" - - final val repositoryBase = "master/play25-bootstrap4/module" - - final val repository = "https://github.com/adrianhurt/play-bootstrap" - def repositoryPath(path: String) = s"$repository/$path" - def repositoryFile(file: String) = s"$repository/blob/$repositoryBase/$file" - def repositoryFolder(folder: String) = s"$repository/tree/$repositoryBase/$folder" - - final val msgsName = "messages" - final val msgsClass = "Messages" - final val msgsArg = s"$msgsName: $msgsClass" -} diff --git a/play25-bootstrap4/sample/app/utils/SimplePrettifier.scala b/play25-bootstrap4/sample/app/utils/SimplePrettifier.scala deleted file mode 100644 index f5b93db..0000000 --- a/play25-bootstrap4/sample/app/utils/SimplePrettifier.scala +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package utils - -object SimplePrettifier { - - /** - * Counts how many tabs there are at the begining of the first line and - * removes this number of tabs at the begining of every line. After, it - * replaces all tabs by two spaces. - */ - def prettify(str: String): String = { - val i = str.indexOf('\n') + 1 - var n = 0 - while (str.charAt(i + n) == '\t') n += 1 - str.replaceAll(s"\n\t{$n}", "\n").replaceAll("\t", " ").trim - } -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/b4/datepicker.scala.html b/play25-bootstrap4/sample/app/views/b4/datepicker.scala.html deleted file mode 100644 index bbaa05f..0000000 --- a/play25-bootstrap4/sample/app/views/b4/datepicker.scala.html +++ /dev/null @@ -1,10 +0,0 @@ -@(startField: Field, startArgs: (Symbol,Any)*)(endField: Field, endArgs: (Symbol,Any)*)(globalArgs: (Symbol,Any)*)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@b4.multifield( startField, endField )(globalArgs, startArgs ++ endArgs) { implicit cfc => -
- @b4.text(startField, startArgs:_*) -
- to -
- @b4.text(endField, endArgs:_*) -
-} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/b4/multiCheckbox.scala.html b/play25-bootstrap4/sample/app/views/b4/multiCheckbox.scala.html deleted file mode 100644 index 4711872..0000000 --- a/play25-bootstrap4/sample/app/views/b4/multiCheckbox.scala.html +++ /dev/null @@ -1,8 +0,0 @@ -@(fieldsWithArgs: (Field, Seq[(Symbol,Any)])*)(globalArgs: (Symbol,Any)*)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@b4.multifield( fieldsWithArgs.map(_._1):_* )(globalArgs, fieldsWithArgs.map(_._2).flatten) { implicit cfc => -
- @fieldsWithArgs.map { case (field, fieldArgs) => - @b4.checkbox(field, fieldArgs:_*) - } -
-} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/b4/my/email.scala.html b/play25-bootstrap4/sample/app/views/b4/my/email.scala.html deleted file mode 100644 index 926c600..0000000 --- a/play25-bootstrap4/sample/app/views/b4/my/email.scala.html +++ /dev/null @@ -1,9 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit handler: b4.B4FieldConstructor, messages: Messages) -@b4.inputFormGroup(field, withLabelFor = true, bs.Args.withDefault(args, 'class -> "form-control")) { fieldInfo => -
-
- @@ -
- -
-} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/b4/my/number.scala.html b/play25-bootstrap4/sample/app/views/b4/my/number.scala.html deleted file mode 100644 index e790629..0000000 --- a/play25-bootstrap4/sample/app/views/b4/my/number.scala.html +++ /dev/null @@ -1,12 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit handler: b4.B4FieldConstructor, messages: Messages) -@b4.inputWrapped("text", field, args:_*) { input => -
-
- -
- @input -
- -
-
-} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/b4/my/vertical/bsFieldConstructor.scala.html b/play25-bootstrap4/sample/app/views/b4/my/vertical/bsFieldConstructor.scala.html deleted file mode 100644 index 4d28633..0000000 --- a/play25-bootstrap4/sample/app/views/b4/my/vertical/bsFieldConstructor.scala.html +++ /dev/null @@ -1,27 +0,0 @@ -@(fieldInfo: b4.B4FieldInfo, inputHtml: Html)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@alertStatus = @{ - if (fieldInfo.hasErrors) - "alert-danger" - else if (bs.ArgsMap.isTrue(fieldInfo.argsMap, '_success)) - "alert-success" - else - "alert-info" -} -
-
- @fieldInfo.labelOpt.map { label => - @bs.Args.msg(label)(messages) - } - @inputHtml -
- -
\ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/b4/my/vertical/bsFormGroup.scala.html b/play25-bootstrap4/sample/app/views/b4/my/vertical/bsFormGroup.scala.html deleted file mode 100644 index 3cfad3d..0000000 --- a/play25-bootstrap4/sample/app/views/b4/my/vertical/bsFormGroup.scala.html +++ /dev/null @@ -1,16 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) -
-
- @argsMap.get('_label).map { label => - - } - @contentHtml -
- -
\ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/b4/my/vertical/package.scala b/play25-bootstrap4/sample/app/views/b4/my/vertical/package.scala deleted file mode 100644 index 0706230..0000000 --- a/play25-bootstrap4/sample/app/views/b4/my/vertical/package.scala +++ /dev/null @@ -1,43 +0,0 @@ -package views.html.b4.my - -package object vertical { - - import views.html.b4._ - import play.twirl.api.Html - import play.api.mvc.Call - import play.api.i18n.Messages - import views.html.helper._ - - /** - * Declares the class for the Vertical FieldConstructor. - */ - class VerticalFieldConstructor(val isCustom: Boolean = false, val withFeedbackTooltip: Boolean = false) extends B4FieldConstructor { - /* Define the default class of the corresponding form */ - val formClass = "form-my-vertical" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B4FieldInfo, inputHtml: Html)(implicit messages: Messages) = bsFieldConstructor(fieldInfo, inputHtml)(this, messages) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: Messages) = bsFormGroup(contentHtml, argsMap)(messages) - } - - /** - * Creates a new VerticalFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B4FieldConstructor and a specific VerticalFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - val fieldConstructorSpecific: VerticalFieldConstructor = new VerticalFieldConstructor() - - /** - * Returns it as a B4FieldConstructor to use it as default within a template - */ - val fieldConstructor: B4FieldConstructor = fieldConstructorSpecific - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: VerticalFieldConstructor => Html) = - views.html.b4.form(action, args: _*)(body(fieldConstructorSpecific))(fieldConstructorSpecific) - -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/b4/package.scala b/play25-bootstrap4/sample/app/views/b4/package.scala deleted file mode 100644 index 663105c..0000000 --- a/play25-bootstrap4/sample/app/views/b4/package.scala +++ /dev/null @@ -1,8 +0,0 @@ -package views.html.b4 - -package object fc { - /** - * Returns it as a B4FieldConstructor to use it as default within a template - */ - implicit val verticalFieldConstructor: B4FieldConstructor = my.vertical.fieldConstructor -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/b4/textWithCheckbox.scala.html b/play25-bootstrap4/sample/app/views/b4/textWithCheckbox.scala.html deleted file mode 100644 index 092fce9..0000000 --- a/play25-bootstrap4/sample/app/views/b4/textWithCheckbox.scala.html +++ /dev/null @@ -1,11 +0,0 @@ -@(textField: Field, textArgs: (Symbol,Any)*)(checkboxField: Field, checkboxArgs: (Symbol,Any)*)(globalArgs: (Symbol,Any)*)(implicit fc: b4.B4FieldConstructor, messages: Messages) -@b4.multifield(textField, checkboxField)(globalArgs, textArgs ++ checkboxArgs) { implicit cfc => -
-
-
- @b4.checkbox(checkboxField, checkboxArgs:_*) -
-
- @b4.text(textField, bs.Args.withDefault(textArgs, Symbol("aria-describedby") -> "checkbox-addon"):_*) -
-} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/docs.scala.html b/play25-bootstrap4/sample/app/views/docs.scala.html deleted file mode 100644 index 218c92c..0000000 --- a/play25-bootstrap4/sample/app/views/docs.scala.html +++ /dev/null @@ -1,874 +0,0 @@ -@(fooForm: Form[String], validationForm: Form[(String, String, Int, String)])(implicit messages: Messages) - -@import utils.BSVersion -@import models._ -@import tags._ -@implicitFieldConstructor = @{ b4.vertical.fieldConstructor() } -@horizontalFieldConstructor = @{ b4.horizontal.fieldConstructor("col-md-2", "col-md-10") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - -@fruitsWithCitrus = @{ Seq( - Fruit(1L, "Apple", false), - Fruit(2L, "Orange", true), - Fruit(3L, "Pear", false), - Fruit(4L, "Lemon", true), - Fruit(5L, "Banana", false) -)} - - -@main("Documentation", tab = "docs") { - -
-
- @b4.form(routes.Application.docs) { - -

- Documentation @versionBadge(explicit = true) -

-

This page explains each component in more details.

- - -

Field Constructors

-

Vertical forms

-

Horizontal forms

-

Inline forms

-

Clear field constructor

-

Specific field constructors

- -

Arguments (args)

- @bsExampleWithCode { - @b4.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - }{ - @@b4.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - } - -

Special arguments (the underscored ones)

- -

Validation arguments

- @bsExampleWithCode { -
- @b4.text( validationForm("username"), '_label -> "Username", '_help -> "A username between 1 and 20 characters" ) - @b4.email( validationForm("email"), '_label -> "Email" ) - @b4.number( validationForm("age"), '_label -> "Age", '_help -> "From 18 to 99 years old" ) - @b4.text( validationForm("color"), '_label -> "Hexadecimal color", '_help -> "Format is #CCC or #CCCCCC" ) -
- }{ - @@b4.text( validationForm("username"), '_label -> "Username", '_help -> "A username between 1 and 20 characters" ) - @@b4.email( validationForm("email"), '_label -> "Email" ) - @@b4.number( validationForm("age"), '_label -> "Age", '_help -> "From 18 to 99 years old" ) - @@b4.text( validationForm("color"), '_label -> "Hexadecimal color", '_help -> "Format is #CCC or #CCCCCC" ) - } - - -

Optional arguments

-

Boolean arguments

-

Arguments with dashes (e.g. data-* attributes)

- - -

ARIA attributes

- - -

Forms @@(action: Call, args: (Symbol, Any)*)(body: => Html)(implicit fc: BSFieldConstructor)

-

Forms with a specific BSFieldConstructor

-

Forms with CSRF token

- - -

Input helpers

- -

About disabled and readonly attributes

-

Validation states & feedback tooltips

- @bsExampleWithCode { - @b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", '_help -> "A help text", 'placeholder -> "Success text..." ) - @b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_help -> "A help text", 'placeholder -> "Warning text..." ) - @b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "A help text", 'placeholder -> "Error text..." ) - }{ - @@b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", '_help -> "A help text", 'placeholder -> "Success text..." ) - @@b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_help -> "A help text", 'placeholder -> "Warning text..." ) - @@b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "A help text", 'placeholder -> "Error text..." ) - } - @bsExampleWithCode { - @b4.vertical.form(routes.Application.vertical, '_feedbackTooltip -> true) { implicit vfc => - @b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", '_help -> "A help text", 'placeholder -> "Success text...", '_class -> "position-relative" ) - @b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_help -> "A help text", 'placeholder -> "Warning text...", '_class -> "position-relative" ) - @b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "A help text", 'placeholder -> "Error text...", '_class -> "position-relative" ) - } - }{ - @@b4.vertical.form(routes.Application.vertical, '_feedbackTooltip -> true) { implicit vfc => - @@b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", '_help -> "A help text", 'placeholder -> "Success text...", '_class -> "position-relative" ) - @@b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_help -> "A help text", 'placeholder -> "Warning text...", '_class -> "position-relative" ) - @@b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "A help text", 'placeholder -> "Error text...", '_class -> "position-relative" ) - } - } - - - -

b4.inputType @@(inputType: String, field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It renders a simple input with a specific type attribute and it adds class="form-control" by default, but you can add an extra class with 'class -> "extra_class". -

- @bsExampleWithCode { - @b4.inputType( "text", fooForm("name"), 'class -> "extra_class", '_label -> "Name", 'placeholder -> "John Doe" ) - @b4.inputType( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - @b4.inputType( "password", fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - }{ - @@b4.inputType( "text", fooForm("name"), 'class -> "extra_class", '_label -> "Name", 'placeholder -> "John Doe" ) - @@b4.inputType( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b4.inputType( "password", fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - } - - -

b4.text @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="text". -

- @bsExampleWithCode { - @b4.text( fooForm("name"), '_label -> "Name", 'placeholder -> "John Doe" ) - }{ - @@b4.text( fooForm("name"), '_label -> "Name", 'placeholder -> "John Doe" ) - } - - -

b4.password @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="password". -

-

- For security reasons, this helper doesn't display the possible value the field could have (for example when the form is reloaded after a validation failure). -

- @bsExampleWithCode { - @b4.password( fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - }{ - @@b4.password( fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - } - - -

b4.file @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="file". -

- @bsExampleWithCode { - @b4.file( fooForm("file"), '_label -> "File" ) - @b4.file( fooForm("file"), '_label -> "File", 'class -> "form-control" ) - }{ - @@b4.file( fooForm("file"), '_label -> "File" ) - @@b4.file( fooForm("file"), '_label -> "File", 'class -> "form-control" ) - } -
Bootstrap 4 custom file
-

- For new Bootstrap 4 custom file, you only need to add '_custom -> true. - Additionally, you can use the argument 'placeholder. -

- @bsExampleWithCode { - @b4.file( fooForm("file_custom"), '_label -> "File", '_custom -> true, 'placeholder -> "Select a file" ) - }{ - @@b4.file( fooForm("file"), '_label -> "File", '_custom -> true, 'placeholder -> "Select a file" ) - } - - -

b4.textarea @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It renders a textarea and it adds class="form-control" by default. -

- @bsExampleWithCode { - @b4.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - }{ - @@b4.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - } - - -

b4.checkbox @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It renders a checkbox. It has the attribute value set to true by default, - but you can use another one using the 'value argument. -

-

- The special '_text argument lets you put a text after the checkbox. -

-

- Regarding to the checked attribute, if you want to set it to true as default, use '_default -> true. - And if you need to force its value use directly the 'checked argument. -

-

- It supports readonly attribute adding an additional disabled one and a - <input type="hidden">. -

- @bsExampleWithCode { - @b4.checkbox( fooForm("foo"), '_text -> "Remember me" ) - }{ - @@b4.checkbox( fooForm("foo"), '_text -> "Remember me" ) - - // uses "bar" as value for the checkbox - @@b4.checkbox( fooForm("foo"), '_text -> "Remember me", 'value -> "bar" ) - - // checked by default (if the form is filled, this value will be taken) - @@b4.checkbox( fooForm("foo"), '_text -> "Remember me", '_default -> true ) - - // always checked (even if the form has been filled with a false) - @@b4.checkbox( fooForm("foo"), '_text -> "Remember me", 'checked -> true ) - - // disabled -> it will NOT be sent within the POST request - @@b4.checkbox( fooForm("foo"), '_text -> "Remember me", 'disabled -> true ) - - // readonly -> it will be sent within the POST request - @@b4.checkbox( fooForm("foo"), '_text -> "Remember me", 'readonly -> true ) - } -

- Note you can use any value for the _text argument. -

- @bsExampleWithCode { - @b4.checkbox( fooForm("foo"), '_text -> Html("""Do you want a beer? """) ) - }{ - @@b4.checkbox( fooForm("foo"), '_text -> Html("Do you want a beer? ") ) - } -
Bootstrap 4 custom checkbox
-

- For new Bootstrap 4 custom checkbox, you only need to add '_custom -> true. -

- @bsExampleWithCode { - @b4.checkbox( fooForm("foo_checkbox_custom"), '_custom -> true, '_text -> Html("""Do you want a beer? """) ) - }{ - @@b4.checkbox( fooForm("foo"), '_custom -> true, '_text -> Html("Do you want a beer? ") ) - } - - -

b4.radio @@(field: Field, options: Seq[(String, Any)], args: (Symbol, Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It renders a radio. It supports readonly attribute adding an additional disabled - one and a <input type="hidden">. -

-

- It has an additional special _inline argument to make it an inline radio (for vertical and horizontal forms). -

- @bsExampleWithCode { - @b4.radio( fooForm("foo_radio1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - }{ - @@opts = @@{ Seq("M"->"Male","F"->"Female") } - - @@b4.radio( fooForm("foo"), options = opts, '_label -> "Radio Group" ) - - // an inline radio within a vertical or horizontal form - @@b4.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", '_inline -> true ) - - // with value "F" by default (if the form is filled, this value will be taken) - @@b4.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", 'value -> "F" ) - - // disabled -> it will NOT be sent within the POST request - @@b4.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", 'disabled -> true ) - - // readonly -> it will be sent within the POST request - @@b4.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", 'readonly -> true ) - } -

- Note you can use any value for the options argument. -

- @bsExampleWithCode { - @b4.radio( fooForm("foo_radio2"), options = Seq("B" -> Html("""Beer """), "C" -> Html("""Coffee """)), '_label -> "What do you prefer?" ) - }{ - @@b4.radio( fooForm("foo"), options = Seq("B" -> Html("Beer "), "C" -> Html("Coffee ")), '_label -> "What do you prefer?" ) - } -
Bootstrap 4 custom radio
-

- For new Bootstrap 4 custom radio, you only need to add '_custom -> true. -

- @bsExampleWithCode { - @b4.radio( fooForm("foo_radio_custom"), options = Seq("B" -> Html("""Beer """), "C" -> Html("""Coffee """)), '_custom -> true, '_label -> "What do you prefer?" ) - }{ - @@b4.radio( fooForm("foo"), options = Seq("B" -> Html("""Beer """), "C" -> Html("""Coffee """)), '_custom -> true, '_label -> "What do you prefer?" ) - } - -
b4.radio @@(field: Field, args: (Symbol, Any)*)(content: Tuple6[Boolean, Boolean, String, String, Option[String], Map[Symbol, Any]] => Html)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)
-
b4.radioOption @@(inputValue: Any, label: Any, args: (Symbol, Any)*)(implicit extraInfo: (Boolean, Boolean, String, String, Option[String], Map[Symbol,Any]))
-

- If you need more versatility you can fully customize your radio options: -

- @bsExampleWithCode { - @b4.radio( fooForm("foo_radio3"), '_label -> "Ok, now that we're alone, what do you really prefer?" ) { implicit extraInfo => - @b4.radioOption("B", Html("""Beer """)) - @b4.radioOption("B", Html("""Coffee """), 'disabled -> true) - } - }{ - @@b4.radio( fooForm("foo3"), '_label -> "Ok, now that we're alone, what do you really prefer?" ) { implicit extraInfo => - @@b4.radioOption("B", Html("Beer ")) - @@b4.radioOption("B", Html("Coffee "), 'disabled -> true) - } - } - - - - -

b4.select @@(field: Field, options: Seq[(String,String)], args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It renders a select. It supports readonly attribute adding an additional disabled - one and a <input type="hidden">. -

- @bsExampleWithCode { - @b4.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @b4.select( fooForm("foo"), options = fruits, '_label -> "Disabled", 'disabled -> true ) - @b4.select( fooForm("foo"), options = fruits, '_label -> "Readonly", 'readonly -> true ) - }{ - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - - // disabled -> it will NOT be sent within the POST request - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Select", 'disabled -> true ) - - // readonly -> it will be sent within the POST request - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Select", 'readonly -> true ) - } -

- You can add a default first value using the argument '_default with a string. - It will add a first option to the select with an empty string value. So you could add a - required constraint to the field to force the user to select one - other option. In addition, this default option is always disable to avoid the user to select it, - and if any other option is selected this default one will not appear at all. -

- @bsExampleWithCode { - @b4.select( fooForm("foo"), options = fruits, '_label -> "With default", '_default -> "Select an option" ) - @b4.select( fooForm("foo"), options = fruits, '_label -> "With default and Pears as value", '_default -> "Select an option", 'value -> "P" ) - }{ - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Select", '_default -> "Select an option" ) - @@b4.select( fooForm("foo"), options = fruits, '_label -> "With default and Pears as value", '_default -> "Select an option", 'value -> "P" ) - } - -

- For a multiple select you only need to add the 'multiple argument. - In that case, the '_default argument will be ignored. -

- @bsExampleWithCode { - @b4.select( fooForm("foo"), options = fruits, '_label -> "Select Multiple", 'multiple -> true ) - }{ - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Fruits", 'multiple -> true ) - - // with value "A" and "B" by default - // it is a string with every value separated by commas - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Fruits", 'multiple -> true, 'value -> "A,B" ) - } -
Bootstrap 4 custom select
-

- For new Bootstrap 4 custom select, you only need to add '_custom -> true. -

- @bsExampleWithCode { - @b4.select( fooForm("foo_select_custom"), options = fruits, '_custom -> true, '_label -> "Custom Select" ) - }{ - @@b4.select( fooForm("foo"), options = fruits, '_custom -> true, '_label -> "Custom Select" ) - } - -
b4.select @@(field: Field, args: (Symbol,Any)*)(content: Set[String] => Html)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)
-
b4.selectOption @@(value: Any, name: Any, args: (Symbol, Any)*)(implicit values: Set[String])
-

- If you need more versatility you can fully customize your select options: -

- @bsExampleWithCode { - @b4.select( fooForm("foo"), '_label -> "Grouped select" ) { implicit values => - - @b4.selectOption("opt_1-1", "Option 1.1") - @b4.selectOption("opt_1-2", "Option 1.2", 'disabled -> true) - @b4.selectOption("opt_1-3", "Option 1.3") - - - @b4.selectOption("opt_2-1", "Option 2.1", 'disabled -> true) - @b4.selectOption("opt_2-2", "Option 2.2") - - } - - @b4.select( fooForm("foo"), '_label -> "Fruits select (lemon preselected)" ) { implicit values => - - @fruitsWithCitrus.filter(_.isCitrus).map { citrus => - @b4.selectOption(citrus.id, citrus.name, 'selected -> (citrus.name == "Lemon")) - } - - - @fruitsWithCitrus.filterNot(_.isCitrus).map { fruit => - @b4.selectOption(fruit.id, fruit.name) - } - - } - }{ - @@b4.select( fooForm("foo"), '_label -> "Grouped select" ) { implicit values => - - @@b4.selectOption("opt_1-1", "Option 1.1") - @@b4.selectOption("opt_1-2", "Option 1.2", 'disabled -> true) - @@b4.selectOption("opt_1-3", "Option 1.3") - - - @@b4.selectOption("opt_2-1", "Option 2.1", 'disabled -> true) - @@b4.selectOption("opt_2-2", "Option 2.2") - - } - - class Fruit (id: Long, name: String, isCitrus: Boolean) - - @@fruitsWithCitrus = @@{ Seq( - Fruit(1L, "Apple", false), - Fruit(2L, "Orange", true), - Fruit(3L, "Pear", false), - Fruit(4L, "Lemon", true), - Fruit(5L, "Banana", false) - )} - - @@b4.select( fooForm("foo"), '_label -> "Fruits select (lemon preselected)" ) { implicit values => - - @@fruitsWithCitrus.filter(_.isCitrus).map { citrus => - @@b4.selectOption(citrus.id, citrus.name, 'selected -> (citrus.name == "Lemon")) - } - - - @@fruitsWithCitrus.filterNot(_.isCitrus).map { fruit => - @@b4.selectOption(fruit.id, fruit.name) - } - - } - } - - -

b4.hidden @@(name: String, value: Any, args: (Symbol, Any)*)

-

- It simply renders a hidden input. -

- @code { - @@b4.hidden("fooName", "fooValue", 'fooAttr -> "fooAttrValue") - } -

Renders to:

- @code { - - } -
b4.hidden @@(field: Field, args: (Symbol, Any)*)
-

- You can also render a hidden input directly with a Field as you could do with a b4.text helper, for example. - It lets you be able to simply change a b4.text for a b4.hidden to hide it. -

-

- It will automatically take the name of the Field and it's value if present. You can set a default value using the argument - 'value. Finally, take into account that every "underscored" argument (with "_" as preffix) will be removed. -

- @code { - @@b4.hidden( fooForm("name"), '_label -> "Name", 'value -> "defaultValue", 'placeholder -> "John Doe" ) - } -

Renders to:

- @code { - - } - -

b4.hiddens @@(namesAndValues: (Any, Any)*)

-

- Render a list of hidden inputs. -

- @code { - @@b4.hiddens("fooId" -> 1L, "barId" -> 2L) - } -

Renders to:

- @code { - - - } - - - - -

New HTML5 helpers

-

- Important note: the new HTML5 input types are not fully supported for web browsers. Those not supported by old web browsers, will behave as input type text. -

- -

b4.color @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="color". -

- @bsExampleWithCode { - @b4.color( fooForm("color"), '_label -> "Color", 'value -> "#3264c8" ) - }{ - @@b4.color( fooForm("color"), '_label -> "Color", 'value -> "#3264c8" ) - } - -

b4.date @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="date". -

- @bsExampleWithCode { - @b4.date( fooForm("date"), '_label -> "Date" ) - }{ - @@b4.date( fooForm("date"), '_label -> "Date" ) - } - -

b4.datetime @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="datetime". -

- @bsExampleWithCode { - @b4.datetime( fooForm("datetime"), '_label -> "Datetime" ) - }{ - @@b4.datetime( fooForm("datetime"), '_label -> "Datetime" ) - } - -

b4.datetimeLocal @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="datetime-local". -

- @bsExampleWithCode { - @b4.datetimeLocal( fooForm("datetimeLocal"), '_label -> "Datetime-Local" ) - }{ - @@b4.datetimeLocal( fooForm("datetimeLocal"), '_label -> "Datetime-Local" ) - } - -

b4.email @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="email". -

- @bsExampleWithCode { - @b4.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com", 'required -> true ) - }{ - @@b4.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - } - -

b4.month @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="month". -

- @bsExampleWithCode { - @b4.month( fooForm("month"), '_label -> "Month" ) - }{ - @@b4.month( fooForm("month"), '_label -> "Month" ) - } - -

b4.number @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="number". -

- @bsExampleWithCode { - @b4.number( fooForm("number"), '_label -> "Number (0 to 50 with intervals of 5)", 'min -> 0, 'max -> 50, 'step -> 5 ) - }{ - @@b4.number( fooForm("number"), '_label -> "Number", 'min -> 0, 'max -> 50, 'step -> 5 ) - } - -

b4.range @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="range". -

- @bsExampleWithCode { - @b4.range( fooForm("range"), '_label -> "Range (0 to 50)", 'min -> 0, 'max -> 50 ) - }{ - @@b4.range( fooForm("range"), '_label -> "Range", 'min -> 0, 'max -> 50 ) - } - - -

- It is a short version of b4.inputType for type="search". -

- @bsExampleWithCode { - @b4.search( fooForm("search"), '_label -> "Search" ) - }{ - @@b4.search( fooForm("search"), '_label -> "Search" ) - } - -

b4.tel @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="tel". -

- @bsExampleWithCode { - @b4.tel( fooForm("tel"), '_label -> "Telephone" ) - }{ - @@b4.tel( fooForm("tel"), '_label -> "Telephone" ) - } - -

b4.time @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="time". -

- @bsExampleWithCode { - @b4.time( fooForm("time"), '_label -> "Time" ) - }{ - @@b4.time( fooForm("time"), '_label -> "Time" ) - } - -

b4.url @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="url". -

- @bsExampleWithCode { - @b4.url( fooForm("url"), '_label -> "URL" ) - }{ - @@b4.url( fooForm("url"), '_label -> "URL" ) - } - -

b4.week @@(field: Field, args: (Symbol,Any)*)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b4.inputType for type="week". -

- @bsExampleWithCode { - @b4.week( fooForm("week"), '_label -> "Week" ) - }{ - @@b4.week( fooForm("week"), '_label -> "Week" ) - } - - - - - -

More helpers

-

- The following helpers use an auxiliar helper that creates a form-group without a field. - Here are the special arguments they use: -

    -
  • _id: the id for the form-group.
  • -
  • _class: the class for the form-group (the form-group class is always added).
  • -
  • _label: the text for the label.
  • -
  • _help: a help text below the input.
  • -
-

- -

b4.static @@(label: String, args: (Symbol,Any)*)(text: => Html)(implicit fc: BSFieldConstructor)

-

- It renders a static control to place within your form. It takes a HTML as parameter, so you can - render whatever you want. Actually, it is like a wrapper for a static HTML. -

- @bsExampleWithCode { - @b4.static("Static HTML"){ This is a link } - }{ - @@b4.static("Static HTML"){ This is a link } - } -

- There are two equivalent more versions of b4.static helper: one for labels with HTML, and another one to omit the label. Note that you can also have a hidden label using '_hideLabel' argument. -

- @bsExampleWithCode { - @b4.static(Html("Label with icon ")){ Basic control with label } - @b4.static("Hidden label", '_hideLabel -> true){ Basic control with hidden label } - @b4.static(){ Basic control without label } - }{ - @@b4.static(Html("Label with icon ")){ Basic control with label } - @@b4.static("Hidden label", '_hideLabel -> true){ Basic control with hidden label } - @@b4.static(){ Basic control without label } - } - - -

b4.buttonType @@(buttonType: String, args: (Symbol,Any)*)(text: => Html)(implicit fc: b4.BSFieldConstructor)

-

- It renders a simple button to place within your form. It takes a HTML as parameter, so you can - render whatever you want. -

- @bsExampleWithCode { - @b4.buttonType("submit", 'class -> "btn btn-secondary"){ Sign in } - }{ - @@b4.buttonType("submit", 'class -> "btn btn-secondary"){ Sign in } - } - -

b4.submit @@(args: (Symbol,Any)*)(text: => Html)(implicit fc: BSFieldConstructor)

-

- It is a short version of b4.buttonType for type="submit". -

- @bsExampleWithCode { - @b4.submit('class -> "btn btn-primary"){ Sign in } - }{ - @@b4.submit('class -> "btn btn-primary"){ Sign in } - } - - -

b4.reset @@(args: (Symbol,Any)*)(text: => Html)(implicit fc: BSFieldConstructor)

-

- It is a short version of b4.buttonType for type="reset". -

- @bsExampleWithCode { - @b4.reset('class -> "btn btn-danger"){ Reset } - }{ - @@b4.reset('class -> "btn btn-danger"){ Reset } - } - -

b4.button @@(args: (Symbol,Any)*)(text: => Html)(implicit fc: BSFieldConstructor)

-

- It is a short version of b4.buttonType for type="button". -

- @bsExampleWithCode { - @b4.button('class -> "btn btn-secondary"){ Favorite } - }{ - @@b4.button('class -> "btn btn-secondary"){ Favorite } - } - - -

b4.free @@(args: (Symbol,Any)*)(content: => Html)(implicit fc: BSFieldConstructor)

-

- It renders whatever you want within a form-group div. -

- @bsExampleWithCode { - @b4.free('_id -> "idFormGroup") { - - Cancel - } - }{ - @@b4.free('_id -> "idFormGroup") { - - Cancel - } - } - - - - - - - - -

Your own custom helpers

-

- The purpose of these helpers is to be a tool for creating your own helpers. Please see more about creating new helpers - here. -

- -

b4.inputWrapped @@(inputType: String, field: Field, args: (Symbol,Any)*)(inputGroup: Html => Html)(implicit handler: BSFieldConstructor, @BSVersion.msgsArg)

-

- This is the same as b4.inputType but specifying a custom wrapper for the input tag. - It is useful for input groups and inputs with validation states and feedback tooltips. -

- @bsExampleWithCode { - @b4.inputWrapped( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) { input => -
-
- @@ -
- @input - -
- } - }{ - @@b4.inputWrapped( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) { input => -
-
- @@@@ -
- @@input - -
- } - } - -

b4.multifield @@(fields: Field*)(args: (Symbol,Any)*)(inputsHtml: (BSFieldConstructor, @BSVersion.msgsClass) => Html)(implicit fc: BSFieldConstructor, @BSVersion.msgsArg)

-

- Sometimes you may need two or more fields within the same line in a horizontal or vertical form (for a set of checkboxes, a date range, ...). -

-

- The helper b4.multifield tries to: -

    -
  • Manage a set of fields and group them within the same form-group.
  • -
  • Manage all of their validation texts, help texts and constraints at the end of the form-group as if they were only one.
  • -
  • Take advantage of the helpers that are already implemented.
  • -
  • Be a tool to create your custom multifield helpers.
  • -
-

-

- To know how it works and how to use it go the the Multifield section. -

- - } -
- - - -
- -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/extendIt.scala.html b/play25-bootstrap4/sample/app/views/extendIt.scala.html deleted file mode 100644 index 1fd732e..0000000 --- a/play25-bootstrap4/sample/app/views/extendIt.scala.html +++ /dev/null @@ -1,80 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@import helper.Implicits._ -@implicitFieldConstructor = @{ b4.vertical.fieldConstructor() } - - -@main("Extend it", tab = "extendit") { - - @b4.form(routes.Application.extendIt) { - -

Implement your own helpers or field constructors

-

- This library tries to be an out-of-the-box plugin. You simply need to install the library and you can - start to write your forms. However, although it is a very versatile library, you may have different - necessities. Thus, let's see some examples to know how you could extend it. -

- -

Create your own helper

- @bsExample { - @b4.my.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - } - @code { - @@b4.my.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - } - -

The use of b4.inputWrapped

- @bsExampleWithCode { - @b4.my.number( fooForm("foo"), '_label -> "Number", 'value -> 0 ) - }{ - @@b4.my.number( fooForm("foo"), '_label -> "Number", 'value -> 0 ) - } - -

Create your multifield helper

- - } - - -

Create your own field constructor

- @bsExampleWithCode { - @b4.my.vertical.form(routes.Application.extendIt) { implicit myfc => - @b4.my.email( fooForm("foo"), '_label -> "Email", '_error -> "And error occurred!", '_showConstraints -> true, 'placeholder -> "example@mail.com" ) - } - }{ -
-
- -
-
- @@ -
- -
-
- -
- } -

- And that's all, you now can use your own field constructor as any other with: -

- @code { - @@import b4.my.vertical.fieldConstructor // Declare it as default - - @@b4.my.email( fooForm("foo"), '_label -> "Email", '_error -> "And error occurred!", '_showConstraints -> true, 'placeholder -> "example@@mail.com" ) - } -

- Or even using it for specific forms: -

- @code { - @@b4.my.vertical.form(routes.Application.extendIt) { implicit myfc => - @@b4.my.email( fooForm("foo"), '_label -> "Email", '_error -> "And error occurred!", '_showConstraints -> true, 'placeholder -> "example@@mail.com" ) - } - } - -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/horizontal.scala.html b/play25-bootstrap4/sample/app/views/horizontal.scala.html deleted file mode 100644 index 5ace94e..0000000 --- a/play25-bootstrap4/sample/app/views/horizontal.scala.html +++ /dev/null @@ -1,256 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@implicitFC = @{ b4.horizontal.fieldConstructor("col-md-4", "col-md-8") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Horizontal Form", tab = "horizontal") { - -

Horizontal Form

- -

Simple inputs

- @bsExampleWithCode { -
-
- @b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b4.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@mail.com" ) -
-
- @b4.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @b4.file( fooForm("foo"), '_label -> "File" ) -
-
- }{ - @@b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b4.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b4.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @@b4.file( fooForm("foo"), '_label -> "File" ) - } - -

More options

- @bsExampleWithCode { -
-
- @b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b4.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @b4.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) -
-
- @b4.text( fooForm("foo"), 'placeholder -> "Without label" ) - @b4.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control form-control-lg", 'placeholder -> "An awesome field..." ) -
-
- }{ - @@b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b4.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @@b4.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @@b4.text( fooForm("foo"), 'placeholder -> "Without label" ) - @@b4.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control form-control-lg", 'placeholder -> "An awesome field..." ) - } - - -

Textareas, checkboxes, radio buttons and selects

- @bsExampleWithCode { -
-
- @b4.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @b4.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b4.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) -
-
- @b4.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @b4.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) -
-
- }{ - @@b4.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @@b4.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b4.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - ... - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) - } - -

Disabled and readonly attributes

- @bsExampleWithCode { -
-
- @b4.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @b4.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) -
-
- @b4.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) -
-
- }{ - @@b4.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @@b4.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - } - -

Validation states

- @bsExampleWithCode { -
-
- @b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "Another help text", 'placeholder -> "Error text..." ) -
-
- @b4.horizontal.form(routes.Application.horizontal, "col-md-4", "col-md-8", '_feedbackTooltip -> true) { implicit fc => - @b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text...", '_class -> "position-relative" ) - @b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text...", '_class -> "position-relative" ) - @b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "Another help text", 'placeholder -> "Error text...", '_class -> "position-relative" ) - } -
-
- }{ - @@b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @@b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "Another help text", 'placeholder -> "Error text..." ) - - // With feedback tooltips - @@b4.horizontal.form(routes.Application.horizontal, "col-md-4", "col-md-8", '_feedbackTooltip -> true) { implicit fc => - @@b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text...", '_class -> "position-relative" ) - @@b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text...", '_class -> "position-relative" ) - @@b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "Another help text", 'placeholder -> "Error text...", '_class -> "position-relative" ) - } - } - -

Bootstrap 4 custom forms

- @bsExampleWithCode { -
-
- @b4.checkbox( fooForm("foo_check_custom_1"), '_text -> "Checkbox", 'checked -> true, '_custom -> true ) - @b4.radio( fooForm("foo_radio_custom_1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group", '_custom -> true ) -
-
- @b4.horizontal.form(routes.Application.horizontal, "col-md-4", "col-md-8", '_custom -> true) { implicit fc => - @b4.select( fooForm("foo_select_custom_1"), options = fruits, '_label -> "Select" ) - @b4.file( fooForm("foo_file_custom_1"), '_label -> "File", 'placeholder -> "Select a file..." ) - } -
-
-}{ - @@b4.checkbox( fooForm("foo_check_custom_1"), '_text -> "Checkbox", 'checked -> true, '_custom -> true ) - @@b4.radio( fooForm("foo_radio_custom_1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group", '_custom -> true ) - @@b4.select( fooForm("foo_select_custom_1"), options = fruits, '_label -> "Select", '_custom -> true ) - @@b4.file( fooForm("foo_file_custom_1"), '_label -> "File", 'placeholder -> "Select a file...", '_custom -> true ) - - Or - - @@b4.horizontal.form(routes.Application.horizontal, "col-md-4", "col-md-8", '_custom -> true) { implicit fc => - @@b4.checkbox( fooForm("foo_check_custom_1"), '_text -> "Checkbox", 'checked -> true ) - @@b4.radio( fooForm("foo_radio_custom_1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - @@b4.select( fooForm("foo_select_custom_1"), options = fruits, '_label -> "Select" ) - @@b4.file( fooForm("foo_file_custom_1"), '_label -> "File", 'placeholder -> "Select a file..." ) - } -} - -

Customize them

- @bsExampleWithCode { -
-
- @b4.inputWrapped( "email", fooForm("foo"), '_label -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
-
- @@ -
- @input -
- } - @b4.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
-
- -
- @input -
- -
-
- } -
-
- @b4.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
-
- -
- @input -
- - - -
-
- } -
-
- }{ - @@b4.inputWrapped( "email", fooForm("foo"), '_label -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
-
- @@@@ -
- @@input -
- } - @@b4.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
-
- -
- @@input -
- -
-
- } - @@b4.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
-
- -
- @@input -
- -
-
- } - } - -

More helpers

- @bsExampleWithCode { -
-
- @b4.static("Static HTML"){ This is a link } - @b4.submit('class -> "btn btn-secondary"){ Submit me! } - @b4.free() { - - Cancel - } -
-
- }{ - @@b4.static("Static HTML"){ This is a link } - @@b4.submit('class -> "btn btn-secondary"){ Submit me! } - @@b4.free() { - - Cancel - } - } - -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/index.scala.html b/play25-bootstrap4/sample/app/views/index.scala.html deleted file mode 100644 index d7f1ba7..0000000 --- a/play25-bootstrap4/sample/app/views/index.scala.html +++ /dev/null @@ -1,92 +0,0 @@ -@(fooForm: Form[String], validationForm: Form[(String, String, Int, String)])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@import helper.Implicits._ - -@main("Play-Bootstrap", tab = "index") { - - - -

- This is a collection of input helpers and field constructors for - Play Framework to render - Bootstrap HTML code. -

- -
- - - - -
- - - -
-
- @bsExampleWithCode { - @b4.vertical.form(routes.Application.index) { implicit vfc => - @b4.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - @b4.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @b4.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @b4.submit('class -> "btn btn-secondary"){ Sign in } - } - }{ - @@b4.vertical.form(routes.Application.index) { implicit vfc => - @@b4.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b4.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @@b4.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @@b4.submit('class -> "btn btn-secondary"){ Sign in } - } - } -
-
- @bsExampleWithCode { - @b4.horizontal.form(routes.Application.index, "col-md-2", "col-md-10") { implicit hfc => - @b4.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - @b4.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @b4.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @b4.submit('class -> "btn btn-secondary"){ Sign in } - } - }{ - @@b3.horizontal.form(routes.Application.index, "col-md-2", "col-md-10") { implicit hfc => - @@b4.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b4.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @@b4.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @@b4.submit('class -> "btn btn-secondary"){ Sign in } - } - } -
-
- @bsExampleWithCode { - @b4.inline.form(routes.Application.index) { implicit ifc => - @b4.email( fooForm("email"), '_hiddenLabel -> "Email", 'placeholder -> "example@mail.com" ) - @b4.password( fooForm("password"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @b4.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @b4.submit('class -> "btn btn-secondary"){ Sign in } - } - }{ - @@b4.inline.form(routes.Application.index) { implicit ifc => - @@b4.email( fooForm("email"), '_hiddenLabel -> "Email", 'placeholder -> "example@@mail.com" ) - @@b4.password( fooForm("password"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @@b4.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @@b4.submit('class -> "btn btn-secondary"){ Sign in } - } - } -
-
-} diff --git a/play25-bootstrap4/sample/app/views/inline.scala.html b/play25-bootstrap4/sample/app/views/inline.scala.html deleted file mode 100644 index 26f52fe..0000000 --- a/play25-bootstrap4/sample/app/views/inline.scala.html +++ /dev/null @@ -1,212 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@implicitFieldConstructor = @{ b4.inline.fieldConstructor() } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Inline Form", tab = "inline") { - -

Inline Form

- -

More options

- @bsExampleWithCode { -
- @b4.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @b4.text( fooForm("foo"), '_label -> "Show label", '_showLabel -> true, 'placeholder -> "Show label" ) - @b4.text( fooForm("foo"), '_hiddenLabel -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @b4.text( fooForm("foo"), '_hiddenLabel -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @b4.text( fooForm("foo"), 'placeholder -> "Without label" ) - @b4.text( fooForm("foo"), '_hiddenLabel -> "A big text", 'class -> "form-control form-control-lg", 'placeholder -> "An awesome field..." ) -
- }{ - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @@b4.text( fooForm("foo"), '_label -> "Show label", '_showLabel -> true, 'placeholder -> "Show label" ) - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @@b4.text( fooForm("foo"), 'placeholder -> "Without label" ) - @@b4.text( fooForm("foo"), '_hiddenLabel -> "A big text", 'class -> "form-control form-control-lg", 'placeholder -> "An awesome field..." ) - } - - -

Textareas, checkboxes, radio buttons and selects

- @bsExampleWithCode { -
- @b4.textarea( fooForm("foo"), '_hiddenLabel -> "Textarea", 'rows -> 3 ) - @b4.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b4.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female") ) - @b4.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select" ) - @b4.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Multiple Select", 'multiple -> true ) -
- }{ - @@b4.textarea( fooForm("foo"), '_hiddenLabel -> "Textarea", 'rows -> 3 ) - @@b4.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b4.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female") ) - - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - ... - @@b4.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select" ) - @@b4.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Multiple Select", 'multiple -> true ) - } - -

Disabled and readonly attributes

- @bsExampleWithCode { -
- @b4.text( fooForm("foo"), '_hiddenLabel -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @b4.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @b4.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) -
- }{ - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @@b4.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @@b4.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - } - -

Validation states

- @bsExampleWithCode { -
-
- @b4.text( fooForm("foo"), '_hiddenLabel -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b4.text( fooForm("foo"), '_hiddenLabel -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b4.text( fooForm("foo"), '_hiddenLabel -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
-
-
- @b4.inline.form(routes.Application.inline, '_feedbackTooltip -> true) { implicit fc => - @b4.text( fooForm("foo"), '_hiddenLabel -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b4.text( fooForm("foo"), '_hiddenLabel -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b4.text( fooForm("foo"), '_hiddenLabel -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } -
-
- - }{ - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - // With feedback tooltips - @@b4.inline.form(routes.Application.inline, '_feedbackTooltip -> true) { implicit fc => - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Success", '_success -> true, 'placeholder -> "Success text...", '_class -> "position-relative" ) - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text...", '_class -> "position-relative" ) - @@b4.text( fooForm("foo"), '_hiddenLabel -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text...", '_class -> "position-relative" ) - } - } - -

Bootstrap 4 custom forms

- @bsExampleWithCode { -
-
- @b4.checkbox( fooForm("foo_check_custom_1"), '_text -> "Checkbox", 'checked -> true, '_custom -> true ) - @b4.radio( fooForm("foo_radio_custom_1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group", '_custom -> true ) -
-
- @b4.inline.form(routes.Application.inline, '_custom -> true) { implicit fc => - @b4.select( fooForm("foo_select_custom_1"), options = fruits, '_label -> "Select" ) - @b4.file( fooForm("foo_file_custom_1"), '_label -> "File", 'placeholder -> "Select a file..." ) - } -
-
-}{ - @@b4.checkbox( fooForm("foo_check_custom_1"), '_text -> "Checkbox", 'checked -> true, '_custom -> true ) - @@b4.radio( fooForm("foo_radio_custom_1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group", '_custom -> true ) - @@b4.select( fooForm("foo_select_custom_1"), options = fruits, '_label -> "Select", '_custom -> true ) - @@b4.file( fooForm("foo_file_custom_1"), '_label -> "File", 'placeholder -> "Select a file...", '_custom -> true ) - - Or - - @@b4.inline.form(routes.Application.inline, '_custom -> true) { implicit fc => - @@b4.checkbox( fooForm("foo_check_custom_1"), '_text -> "Checkbox", 'checked -> true ) - @@b4.radio( fooForm("foo_radio_custom_1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - @@b4.select( fooForm("foo_select_custom_1"), options = fruits, '_label -> "Select" ) - @@b4.file( fooForm("foo_file_custom_1"), '_label -> "File", 'placeholder -> "Select a file..." ) - } -} - -

Customize them

- @bsExampleWithCode { -
- @b4.inputWrapped( "email", fooForm("foo"), '_hiddenLabel -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
-
- @@ -
- @input -
- } - @b4.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
-
- -
- @input -
- - - -
-
- } - @b4.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Number", 'value -> 0 ) { input => -
-
- -
- @input -
- -
-
- } -
- }{ - @@b4.inputWrapped( "email", fooForm("foo"), '_hiddenLabel -> "Simple input group", 'placeholder -> "Custom input group for email..." ) { input => -
-
- @@@@ -
- @@input -
- } - @@b4.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
-
- -
- @@input -
- -
-
- } - @@b4.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Number", 'value -> 0 ) { input => -
-
- -
- @@input -
- -
-
- } - } - -

More helpers

- @bsExampleWithCode { - @b4.submit('class -> "btn btn-secondary"){ Submit me! } - }{ - @@b4.submit('class -> "btn btn-secondary"){ Submit me! } - } - -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/main.scala.html b/play25-bootstrap4/sample/app/views/main.scala.html deleted file mode 100644 index b8bae61..0000000 --- a/play25-bootstrap4/sample/app/views/main.scala.html +++ /dev/null @@ -1,65 +0,0 @@ -@(title: String, tab: String = "", styles: Html = Html(""), scripts: Html = Html(""), modals: Html = Html(""))(content: Html) -@import utils.BSVersion -@import tags._ - - - - - @title - - - - - - - @styles - - - - - - - @scripts - - - - -
- @content -
- - - @modals - - diff --git a/play25-bootstrap4/sample/app/views/mixed.scala.html b/play25-bootstrap4/sample/app/views/mixed.scala.html deleted file mode 100644 index 358c69b..0000000 --- a/play25-bootstrap4/sample/app/views/mixed.scala.html +++ /dev/null @@ -1,124 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@implicitFC = @{ b4.horizontal.fieldConstructor("col-md-2", "col-md-10") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Mixed Forms", tab = "mixed") { - -

Mixed Forms

-

This page its an example to show how to mix different forms within the same view.

- -

A simple horizontal form

- @bsExampleWithCode { - @b4.form(routes.Application.mixed) { - @b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b4.select( fooForm("foo"), options = fruits, '_label -> "Select a fruit" ) - @b4.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b4.submit('class -> "btn btn-secondary"){ Save changes } - } - }{ - @@b4.form(routes.Application.mixed) { - @@b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Select a fruit" ) - @@b4.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b4.submit('class -> "btn btn-secondary"){ Save changes } - } - } - - -

The typical inline login form on top

- @bsExampleWithCode { - @b4.inline.form(routes.Application.mixed) { implicit ifc => - @b4.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@mail.com" ) - @b4.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @b4.submit('class -> "btn btn-secondary"){ Sign in } - } - }{ - @@b4.inline.form(routes.Application.mixed) { implicit ifc => - @@b4.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@@mail.com" ) - @@b4.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @@b4.submit('class -> "btn btn-secondary"){ Sign in } - } - } - - -

The typical vertical contact form on one side

- @bsExampleWithCode { -
-
- @b4.vertical.form(routes.Application.mixed) { implicit vfc => - @b4.text( fooForm("foo"), '_label -> "Your name", 'placeholder -> "Your contact name" ) - @b4.email( fooForm("foo"), '_label -> "Your email", 'placeholder -> "example@mail.com" ) - @b4.textarea( fooForm("foo"), '_label -> "What happened?", 'rows -> 3 ) - @b4.checkbox( fooForm("foo"), '_text -> "Send me a copy to my email", 'checked -> true ) - @b4.submit('class -> "btn btn-secondary"){ Send } - } -
-
- }{ - @@b4.vertical.form(routes.Application.mixed) { implicit vfc => - @@b4.text( fooForm("foo"), '_label -> "Your name", 'placeholder -> "Your contact name" ) - @@b4.email( fooForm("foo"), '_label -> "Your email", 'placeholder -> "example@@mail.com" ) - @@b4.textarea( fooForm("foo"), '_label -> "What happened?", 'rows -> 3 ) - @@b4.checkbox( fooForm("foo"), '_text -> "Send me a copy to my email", 'checked -> true ) - @@b4.submit('class -> "btn btn-secondary"){ Send } - } - } - - -

A different horizontal form

- @bsExampleWithCode { - @b4.horizontal.form(routes.Application.mixed, "col-lg-4", "col-lg-8") { implicit hfc => - @b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b4.file( fooForm("foo"), '_label -> "File" ) - @b4.checkbox( fooForm("foo"), '_text -> "Checkbox" ) - @b4.submit('class -> "btn btn-secondary"){ Save changes } - } - }{ - @@b4.horizontal.form(routes.Application.mixed, "col-lg-4", "col-lg-8") { implicit hfc => - @@b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b4.file( fooForm("foo"), '_label -> "File" ) - @@b4.checkbox( fooForm("foo"), '_text -> "Checkbox" ) - @@b4.submit('class -> "btn btn-secondary"){ Save changes } - } - } - - -

A clear field constructor

- @bsExampleWithCode { - @b4.clear.form(routes.Application.mixed) { implicit cfc => - @b4.inputWrapped( "search", fooForm("foo"), 'placeholder -> "Text to search..." ) { input => -
-
- -
- @input -
- -
-
- } - } - }{ - @@b4.clear.form(routes.Application.mixed) { implicit cfc => - @@b4.inputWrapped( "search", fooForm("foo"), 'placeholder -> "Text to search..." ) { input => -
-
- -
- @@input -
- -
-
- } - } - } - - -

Mixed FieldConstructors within the same form

- -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/multifield.scala.html b/play25-bootstrap4/sample/app/views/multifield.scala.html deleted file mode 100644 index 8e7ffd8..0000000 --- a/play25-bootstrap4/sample/app/views/multifield.scala.html +++ /dev/null @@ -1,83 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages) -@import utils.BSVersion -@import tags._ -@import helper.Implicits._ -@implicitFC = @{ b4.horizontal.fieldConstructor("col-md-2", "col-md-10") } - - -@main("Multifield", tab = "multifield") { - - @b4.form(routes.Application.multifield) { - -

Multifield support

-

- Sometimes you may need two or more fields within the same line in a horizontal or vertical form (for a set of - checkboxes, a date range, ...). That is the purpose of the helper b4.multifield. -

- -

Let's see a couple of examples

- -

A date range

- @bsExampleWithCode { - @b4.datepicker( fooForm("dateStart"), 'value -> "15-11-2014" )( - fooForm("dateEnd"), 'value -> "31-12-2014" )( - '_label -> "Date range", "data-date-start-date" -> "10-11-2014", '_help -> "Select a date range from 10-11-2014" ) - }{ - @@b4.datepicker( fooForm("dateStart"), 'value -> "31-10-2014" )( - fooForm("dateEnd"), 'value -> "31-12-2014" )( - '_label -> "Date range", "data-date-start-date" -> "01-01-2014", '_help -> "Select a date range from 10-11-2014" ) - } - -

A set of checkboxes

- @bsExampleWithCode { - @b4.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )( '_label -> "Checkboxes", 'class -> "multi-checkbox-list", '_help -> "Mark what you want" ) - @b4.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )('_label -> "Inline", 'class -> "multi-checkbox-list inline", '_help -> "Mark what you want") - }{ - @@b4.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )('_label -> "Checkboxes", 'class -> "multi-checkbox-list", '_help -> "Mark what you want") - @@b4.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )('_label -> "Inline", 'class -> "multi-checkbox-list inline", '_help -> "Mark what you want") - } - -

A textfield with a checkbox addon

- @bsExampleWithCode { - @b4.textWithCheckbox( fooForm("foo"), 'placeholder -> "a foo value" )( fooForm("fooSelected") )('_label -> "New task" ) - }{ - @@b4.textWithCheckbox( fooForm("foo"), 'placeholder -> "a foo value" )( fooForm("fooSelected") )('_label -> "New task" ) - } - -

Validation states and feedback icons

- @bsExampleWithCode { - @b4.datepicker( fooForm("dateStart"), 'value -> "15-11-2014" )( - fooForm("dateEnd"), 'value -> "31-10-2014", '_error -> "error!" )( - '_label -> "Date range" ) - - @b4.textWithCheckbox( fooForm("foo"), 'value -> "an incorrect value", '_error -> "The value is incorrect" )( - fooForm("fooSelected") )( - '_label -> "New task" ) - }{ - @@b4.datepicker( fooForm("dateStart"), 'value -> "15-11-2014" )( - fooForm("dateEnd"), 'value -> "31-10-2014", '_error -> "error!" )( - '_label -> "Date range" ) - - @@b4.textWithCheckbox( fooForm("foo"), 'value -> "an incorrect value", '_error -> "The value is incorrect" )( - fooForm("fooSelected") )( - '_label -> "New task" ) - } - - } -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/readonly.scala.html b/play25-bootstrap4/sample/app/views/readonly.scala.html deleted file mode 100644 index 42aeba8..0000000 --- a/play25-bootstrap4/sample/app/views/readonly.scala.html +++ /dev/null @@ -1,39 +0,0 @@ -@(fooForm: Form[String])(implicit request: RequestHeader, messages: Messages) -@import utils.BSVersion -@import tags._ -@implicitFC = @{ b4.horizontal.fieldConstructor("col-md-2", "col-md-10") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Demo for Readonly Attributes", tab = "readonly") { - -

Demo for Readonly Attributes

-

- This page its an example to show how to use the readonly attribute for - checkbox, radio and select helpers. -

- - @b4.formCSRF(Call("GET", ""), 'id -> "form-readonly") { - @bsExampleWithCode { - @b4.text( fooForm("text"), '_label -> "Always editable", '_class -> "always-editable", 'value -> "demo text", 'placeholder -> "A simple text..." ) - @b4.checkbox( fooForm("checkbox"), '_text -> "Checkbox", 'value -> true, 'readonly -> true ) - @b4.radio( fooForm("radio"), options = Seq("M"->"Male","F"->"Female"), 'value -> "M", '_label -> "Radio Group", 'readonly -> true ) - @b4.select( fooForm("select"), options = fruits, '_label -> "Select", 'value -> "A", 'readonly -> true ) - @b4.free() { - - Unlock readonly fields - } - }{ - @@b4.text( fooForm("text"), '_label -> "Always editable", '_class -> "always-editable", 'value -> "demo text", 'placeholder -> "A simple text..." ) - @@b4.checkbox( fooForm("checkbox"), '_text -> "Checkbox", 'value -> true, 'readonly -> true ) - @@b4.radio( fooForm("radio"), options = Seq("M"->"Male","F"->"Female"), 'value -> "M", '_label -> "Radio Group", 'readonly -> true ) - @@b4.select( fooForm("select"), options = fruits, '_label -> "Select", 'value -> "A", 'readonly -> true ) - @@b4.free() { - - Unlock readonly fields - } - } - } - -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/bsExample.scala.html b/play25-bootstrap4/sample/app/views/tags/bsExample.scala.html deleted file mode 100644 index a497b7c..0000000 --- a/play25-bootstrap4/sample/app/views/tags/bsExample.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(example: Html) -
- @example -
\ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/bsExampleWithCode.scala.html b/play25-bootstrap4/sample/app/views/tags/bsExampleWithCode.scala.html deleted file mode 100644 index f9cebc8..0000000 --- a/play25-bootstrap4/sample/app/views/tags/bsExampleWithCode.scala.html +++ /dev/null @@ -1,3 +0,0 @@ -@(theExample: Html)(theCode: Html) -@bsExample(theExample) -@code(theCode) \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/code.scala.html b/play25-bootstrap4/sample/app/views/tags/code.scala.html deleted file mode 100644 index a814ab5..0000000 --- a/play25-bootstrap4/sample/app/views/tags/code.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(code: Html) -
-
@utils.SimplePrettifier.prettify(code.toString)
-
\ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/docsReadonlyAttributes.scala.html b/play25-bootstrap4/sample/app/views/tags/docsReadonlyAttributes.scala.html deleted file mode 100644 index 7d38686..0000000 --- a/play25-bootstrap4/sample/app/views/tags/docsReadonlyAttributes.scala.html +++ /dev/null @@ -1,18 +0,0 @@ -@() -

- Both the disabled and readonly attributes for an input prevent the user from modify it. - However, the disabled attribute means this input will NOT be sent within the POST request, whereas - the readonly one means it will. -

-

- Nevertheless, for checkbox, radio and select tags it doesn't happen. To - support the readonly attribute for these tags, the corresponding helpers have been adapted to behave - as would be expected. To do that, when the readonly attribute appears the helper will: -

    -
  • add an additional disabled attribute
  • -
  • add an additional <input type="hidden"> with the desired value
  • -
  • wraps them with in a div (with class checkbox-group, radio-group or select-group)
  • -
- Note it only happens when the readonly attribute is present, even with a false value. - It is done to make it easier to modify its readonly behaviour using javascript. -

\ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/javaMessagesWarning.scala.html b/play25-bootstrap4/sample/app/views/tags/javaMessagesWarning.scala.html deleted file mode 100644 index c5b34d5..0000000 --- a/play25-bootstrap4/sample/app/views/tags/javaMessagesWarning.scala.html +++ /dev/null @@ -1,17 +0,0 @@ -@(id: String = "") -@if(utils.BSVersion.play_code == "2.4") { -
- -
-
- From Play 2.4, the implicit Messages argument defined in your custom template collides with the implicit one taken from PlayMagicForJava object, and it raises - a compilation error. So you only need to remove this implicit argument from your custom template. -
-
-
-} \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/repository/file.scala.html b/play25-bootstrap4/sample/app/views/tags/repository/file.scala.html deleted file mode 100644 index 3264bde..0000000 --- a/play25-bootstrap4/sample/app/views/tags/repository/file.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(file: String, text: String = "") -@resource(utils.BSVersion.repositoryFile(file), text) \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/repository/folder.scala.html b/play25-bootstrap4/sample/app/views/tags/repository/folder.scala.html deleted file mode 100644 index 70698e3..0000000 --- a/play25-bootstrap4/sample/app/views/tags/repository/folder.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(folder: String, text: String = "") -@resource(utils.BSVersion.repositoryFile(folder), text) \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/repository/home.scala.html b/play25-bootstrap4/sample/app/views/tags/repository/home.scala.html deleted file mode 100644 index 57fed4d..0000000 --- a/play25-bootstrap4/sample/app/views/tags/repository/home.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(text: String = "Github", theClass: String = "") -@resource(utils.BSVersion.repository, text, theClass) \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/repository/resource.scala.html b/play25-bootstrap4/sample/app/views/tags/repository/resource.scala.html deleted file mode 100644 index 30ca245..0000000 --- a/play25-bootstrap4/sample/app/views/tags/repository/resource.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(resource: String, text: String = "", theClass: String = "") -@Html(if (text != "") text else resource.replaceAll("^.*/", "")) \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/tags/versionBadge.scala.html b/play25-bootstrap4/sample/app/views/tags/versionBadge.scala.html deleted file mode 100644 index 5d87ba7..0000000 --- a/play25-bootstrap4/sample/app/views/tags/versionBadge.scala.html +++ /dev/null @@ -1,12 +0,0 @@ -@(explicit: Boolean = false) -@import utils.BSVersion._ - - @code - - @if(explicit) { -  @play  @bootstrap  - } else { -  @play_code  @bootstrap_code  - } - - \ No newline at end of file diff --git a/play25-bootstrap4/sample/app/views/vertical.scala.html b/play25-bootstrap4/sample/app/views/vertical.scala.html deleted file mode 100644 index 30522be..0000000 --- a/play25-bootstrap4/sample/app/views/vertical.scala.html +++ /dev/null @@ -1,252 +0,0 @@ -@(fooForm: Form[String])(implicit messages: Messages, request: RequestHeader) -@import utils.BSVersion -@import tags._ -@implicitFieldConstructor = @{ b4.vertical.fieldConstructor() } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Vertical Form", tab = "vertical") { - -

Vertical Form

- -

Simple inputs

- @bsExampleWithCode { -
-
- @b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b4.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@mail.com" ) -
-
- @b4.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @b4.file( fooForm("foo"), '_label -> "File" ) -
-
- }{ - @@b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b4.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b4.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @@b4.file( fooForm("foo"), '_label -> "File" ) - } - -

More options

- @bsExampleWithCode { -
-
- @b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b4.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @b4.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) -
-
- @b4.text( fooForm("foo"), 'placeholder -> "Without label" ) - @b4.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control form-control-lg", 'placeholder -> "An awesome field..." ) -
-
- }{ - @@b4.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b4.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @@b4.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @@b4.text( fooForm("foo"), 'placeholder -> "Without label" ) - @@b4.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control form-control-lg", 'placeholder -> "An awesome field..." ) - } - - -

Textareas, checkboxes, radio buttons and selects

- @bsExampleWithCode { -
-
- @b4.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @b4.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b4.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) -
-
- @b4.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @b4.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) -
-
- }{ - @@b4.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @@b4.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b4.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - ... - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) - } - -

Disabled and readonly attributes

- @bsExampleWithCode { -
-
- @b4.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @b4.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) -
-
- @b4.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) -
-
- }{ - @@b4.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @@b4.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @@b4.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - } - -

Validation states

- @bsExampleWithCode { -
-
- @b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "Another help text", 'placeholder -> "Error text..." ) -
-
- @b4.vertical.form(routes.Application.vertical, '_feedbackTooltip -> true) { implicit fc => - @b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text...", '_class -> "position-relative" ) - @b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text...", '_class -> "position-relative" ) - @b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "Another help text", 'placeholder -> "Error text...", '_class -> "position-relative" ) - } -
-
- }{ - @@b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @@b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "Another help text", 'placeholder -> "Error text..." ) - - // With feedback tooltips - @@b4.vertical.form(routes.Application.vertical, '_feedbackTooltip -> true) { implicit fc => - @@b4.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text...", '_class -> "position-relative" ) - @@b4.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text...", '_class -> "position-relative" ) - @@b4.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", '_help -> "Another help text", 'placeholder -> "Error text...", '_class -> "position-relative" ) - } - } - -

Bootstrap 4 custom forms

- @bsExampleWithCode { -
-
- @b4.checkbox( fooForm("foo_check_custom_1"), '_text -> "Checkbox", 'checked -> true, '_custom -> true ) - @b4.radio( fooForm("foo_radio_custom_1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group", '_custom -> true ) -
-
- @b4.vertical.form(routes.Application.vertical, '_custom -> true) { implicit fc => - @b4.select( fooForm("foo_select_custom_1"), options = fruits, '_label -> "Select" ) - @b4.file( fooForm("foo_file_custom_1"), '_label -> "File", 'placeholder -> "Select a file..." ) - } -
-
-}{ - @@b4.checkbox( fooForm("foo_check_custom_1"), '_text -> "Checkbox", 'checked -> true, '_custom -> true ) - @@b4.radio( fooForm("foo_radio_custom_1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group", '_custom -> true ) - @@b4.select( fooForm("foo_select_custom_1"), options = fruits, '_label -> "Select", '_custom -> true ) - @@b4.file( fooForm("foo_file_custom_1"), '_label -> "File", 'placeholder -> "Select a file...", '_custom -> true ) - - Or - - @@b4.vertical.form(routes.Application.vertical, '_custom -> true) { implicit fc => - @@b4.checkbox( fooForm("foo_check_custom_1"), '_text -> "Checkbox", 'checked -> true ) - @@b4.radio( fooForm("foo_radio_custom_1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - @@b4.select( fooForm("foo_select_custom_1"), options = fruits, '_label -> "Select" ) - @@b4.file( fooForm("foo_file_custom_1"), '_label -> "File", 'placeholder -> "Select a file..." ) - } -} - -

Customize them

- @bsExampleWithCode { -
-
- @b4.inputWrapped( "email", fooForm("foo"), '_label -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
-
- @@ -
- @input -
- } - @b4.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
-
- -
- @input -
- -
-
- } -
-
- @b4.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
-
- -
- @input -
- - - -
-
- } -
-
- }{ - @@b4.inputWrapped( "email", fooForm("foo"), '_label -> "Simple input group", 'placeholder -> "Custom input group for email..." ) { input => -
-
- @@@@ -
- @@input -
- } - @@b4.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
-
- -
- @@input -
- -
-
- } - @@b4.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
-
- -
- @@input -
- -
-
- } - } - -

More helpers

- @bsExampleWithCode { - @b4.static("Static HTML"){ This is a link } - @b4.submit('class -> "btn btn-secondary"){ Submit me! } - @b4.free() { - - Cancel - } - }{ - @@b4.static("Static HTML"){ This is a link } - @@b4.submit('class -> "btn btn-secondary"){ Submit me! } - @@b4.free() { - - Cancel - } - } - -} \ No newline at end of file diff --git a/play25-bootstrap4/sample/build.sbt b/play25-bootstrap4/sample/build.sbt deleted file mode 100644 index 5c39158..0000000 --- a/play25-bootstrap4/sample/build.sbt +++ /dev/null @@ -1,24 +0,0 @@ -name := """play-bootstrap-sample""" - -version := "1.4" - -scalaVersion := "2.11.11" - -routesGenerator := InjectedRoutesGenerator - -lazy val root = (project in file(".")).enablePlugins(PlayScala) - - -resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" - -libraryDependencies ++= Seq( - filters, - "com.adrianhurt" %% "play-bootstrap" % "1.4-P25-B4-SNAPSHOT", - "org.webjars" % "bootstrap" % "4.0.0-1" exclude("org.webjars", "jquery"), - "org.webjars" % "jquery" % "3.3.1-1", - "org.webjars" % "font-awesome" % "4.7.0", - "org.webjars" % "bootstrap-datepicker" % "1.4.0" exclude("org.webjars", "bootstrap") -) - - -scalariformSettings diff --git a/play25-bootstrap4/sample/conf/application.conf b/play25-bootstrap4/sample/conf/application.conf deleted file mode 100644 index 284a047..0000000 --- a/play25-bootstrap4/sample/conf/application.conf +++ /dev/null @@ -1,54 +0,0 @@ -# This is the main configuration file for the application. -# ~~~~~ - -# Secret key -# ~~~~~ -# The secret key is used to secure cryptographics functions. -# -# This must be changed for production, but we recommend not changing it in this file. -# -# See http://www.playframework.com/documentation/latest/ApplicationSecret for more details. -play.crypto.secret="AQD]D`KQXB4Bx`bSG9v1n[Piq;Q4d=BB>SxEJfo01DeQd9;0`cgc" - -# The application languages -# ~~~~~ -play.i18n.langs=[ "en" ] - -# The filters -# ~~~~~ -play.http.filters = "Filters" - -# Global object class -# ~~~~~ -# Define the Global object class for this application. -# Default to Global in the root package. -# application.global=Global - -# Router -# ~~~~~ -# Define the Router object to use for this application. -# This router will be looked up first when the application is starting up, -# so make sure this is the entry point. -# Furthermore, it's assumed your route file is named properly. -# So for an application router like `my.application.Router`, -# you may need to define a router file `conf/my.application.routes`. -# Default to Routes in the root package (and conf/routes) -# play.http.router=my.application.Routes - -# Database configuration -# ~~~~~ -# You can declare as many datasources as you want. -# By convention, the default datasource is named `default` -# -# db.default.driver=org.h2.Driver -# db.default.url="jdbc:h2:mem:play" -# db.default.user=sa -# db.default.password="" - -# Evolutions -# ~~~~~ -# You can disable evolutions if needed -# evolutionplugin=disabled - - - diff --git a/play25-bootstrap4/sample/conf/routes b/play25-bootstrap4/sample/conf/routes deleted file mode 100644 index 080c7cb..0000000 --- a/play25-bootstrap4/sample/conf/routes +++ /dev/null @@ -1,21 +0,0 @@ -# Routes -# This file defines all application routes (Higher priority routes first) -# ~~~~ - -# Home page -GET / controllers.Application.index -GET /vertical controllers.Application.vertical -GET /horizontal controllers.Application.horizontal -GET /inline controllers.Application.inline -GET /mixed controllers.Application.mixed -GET /readonly controllers.Application.readonly -GET /multifield controllers.Application.multifield -GET /extend-it controllers.Application.extendIt -GET /docs controllers.Application.docs - - -GET /changelog controllers.Default.redirect(to = "http://adrianhurt.github.io/play-bootstrap/changelog") - - -# Map static resources from the /public folder to the /assets URL path -GET /assets/*file controllers.Assets.at(path="/public", file) diff --git a/play25-bootstrap4/sample/project/build.properties b/play25-bootstrap4/sample/project/build.properties deleted file mode 100644 index 016511b..0000000 --- a/play25-bootstrap4/sample/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Activator-generated Properties -#Sun Aug 03 14:36:39 BST 2014 -template.uuid=688014f0-0585-43e3-a9fa-d62f7d12f1ab -sbt.version=0.13.11 diff --git a/play25-bootstrap4/sample/project/plugins.sbt b/play25-bootstrap4/sample/project/plugins.sbt deleted file mode 100644 index 66eed52..0000000 --- a/play25-bootstrap4/sample/project/plugins.sbt +++ /dev/null @@ -1,12 +0,0 @@ -resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" - -// The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.18") - -// web plugins - -addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0") - -addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6") - -addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") diff --git a/play25-bootstrap4/sample/public/images/favicon.ico b/play25-bootstrap4/sample/public/images/favicon.ico deleted file mode 100644 index ac4bf59..0000000 Binary files a/play25-bootstrap4/sample/public/images/favicon.ico and /dev/null differ diff --git a/play25-bootstrap4/sample/public/images/logo.gif b/play25-bootstrap4/sample/public/images/logo.gif deleted file mode 100644 index db8eced..0000000 Binary files a/play25-bootstrap4/sample/public/images/logo.gif and /dev/null differ diff --git a/play25-bootstrap4/sample/public/images/please_star.png b/play25-bootstrap4/sample/public/images/please_star.png deleted file mode 100644 index d9489ba..0000000 Binary files a/play25-bootstrap4/sample/public/images/please_star.png and /dev/null differ diff --git a/play25-bootstrap4/sample/public/javascripts/old_bootstrap_affix.js b/play25-bootstrap4/sample/public/javascripts/old_bootstrap_affix.js deleted file mode 100755 index f4958c8..0000000 --- a/play25-bootstrap4/sample/public/javascripts/old_bootstrap_affix.js +++ /dev/null @@ -1,188 +0,0 @@ -/*! - * Bootstrap v3.3.5 (http://getbootstrap.com) - * Copyright 2011-2015 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ - -/*! - * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=cba7c07e2313d0b36cce) - * Config saved to config.json and https://gist.github.com/cba7c07e2313d0b36cce - */ -if (typeof jQuery === 'undefined') { - throw new Error('Bootstrap\'s JavaScript requires jQuery') -} -+function ($) { - 'use strict'; - var version = $.fn.jquery.split(' ')[0].split('.') - if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) { - throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher') - } -}(jQuery); - -/* ======================================================================== - * Bootstrap: affix.js v3.3.5 - * http://getbootstrap.com/javascript/#affix - * ======================================================================== - * Copyright 2011-2015 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // AFFIX CLASS DEFINITION - // ====================== - - var Affix = function (element, options) { - this.options = $.extend({}, Affix.DEFAULTS, options) - - this.$target = $(this.options.target) - .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) - .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) - - this.$element = $(element) - this.affixed = null - this.unpin = null - this.pinnedOffset = null - - this.checkPosition() - } - - Affix.VERSION = '3.3.5' - - Affix.RESET = 'affix affix-top affix-bottom' - - Affix.DEFAULTS = { - offset: 0, - target: window - } - - Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { - console.log("getState") - var scrollTop = this.$target.scrollTop() - var position = this.$element.offset() - var targetHeight = this.$target.height() - - if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false - - if (this.affixed == 'bottom') { - if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' - return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' - } - - var initializing = this.affixed == null - var colliderTop = initializing ? scrollTop : position.top - var colliderHeight = initializing ? targetHeight : height - - if (offsetTop != null && scrollTop <= offsetTop) return 'top' - if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' - - return false - } - - Affix.prototype.getPinnedOffset = function () { - console.log("getPinnedOffset") - if (this.pinnedOffset) return this.pinnedOffset - this.$element.removeClass(Affix.RESET).addClass('affix') - var scrollTop = this.$target.scrollTop() - var position = this.$element.offset() - return (this.pinnedOffset = position.top - scrollTop) - } - - Affix.prototype.checkPositionWithEventLoop = function () { - console.log("checkPositionWithEventLoop") - setTimeout($.proxy(this.checkPosition, this), 1) - } - - Affix.prototype.checkPosition = function () { - console.log("checkPosition") - if (!this.$element.is(':visible')) return - - var height = this.$element.height() - var offset = this.options.offset - var offsetTop = offset.top - var offsetBottom = offset.bottom - var scrollHeight = Math.max($(document).height(), $(document.body).height()) - - if (typeof offset != 'object') offsetBottom = offsetTop = offset - if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) - if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) - - var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) - console.log(" -> " + affix) - - if (this.affixed != affix) { - if (this.unpin != null) this.$element.css('top', '') - - var affixType = 'affix' + (affix ? '-' + affix : '') - var e = $.Event(affixType + '.bs.affix') - - this.$element.trigger(e) - - if (e.isDefaultPrevented()) return - - this.affixed = affix - this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null - - this.$element - .removeClass(Affix.RESET) - .addClass(affixType) - .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') - } - - if (affix == 'bottom') { - this.$element.offset({ - top: scrollHeight - height - offsetBottom - }) - } - } - - - // AFFIX PLUGIN DEFINITION - // ======================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.affix') - var options = typeof option == 'object' && option - - if (!data) $this.data('bs.affix', (data = new Affix(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.affix - - $.fn.affix = Plugin - $.fn.affix.Constructor = Affix - - - // AFFIX NO CONFLICT - // ================= - - $.fn.affix.noConflict = function () { - $.fn.affix = old - return this - } - - - // AFFIX DATA-API - // ============== - - $(window).on('load', function () { - $('[data-spy="affix"]').each(function () { - var $spy = $(this) - var data = $spy.data() - - data.offset = data.offset || {} - - if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom - if (data.offsetTop != null) data.offset.top = data.offsetTop - - Plugin.call($spy, data) - }) - }) - -}(jQuery); diff --git a/play25-bootstrap4/sample/public/stylesheets/docs.min.css b/play25-bootstrap4/sample/public/stylesheets/docs.min.css deleted file mode 100644 index 7da4e4a..0000000 --- a/play25-bootstrap4/sample/public/stylesheets/docs.min.css +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Bootstrap Docs (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under the Creative Commons Attribution 3.0 Unported License. For - * details, see http://creativecommons.org/licenses/by/3.0/. - */body{position:relative}.table code{font-size:13px;font-weight:400}.btn-outline{color:#563d7c;background-color:transparent;border-color:#563d7c}.btn-outline:hover,.btn-outline:focus,.btn-outline:active{color:#fff;background-color:#563d7c;border-color:#563d7c}.btn-outline-inverse{color:#fff;background-color:transparent;border-color:#cdbfe3}.btn-outline-inverse:hover,.btn-outline-inverse:focus,.btn-outline-inverse:active{color:#563d7c;text-shadow:none;background-color:#fff;border-color:#fff}.bs-docs-booticon{display:block;font-weight:500;color:#fff;text-align:center;cursor:default;background-color:#563d7c;border-radius:15%}.bs-docs-booticon-sm{width:30px;height:30px;font-size:20px;line-height:28px}.bs-docs-booticon-lg{width:144px;height:144px;font-size:108px;line-height:140px}.bs-docs-booticon-inverse{color:#563d7c;background-color:#fff}.bs-docs-booticon-outline{background-color:transparent;border:1px solid #cdbfe3}.bs-docs-nav{margin-bottom:0;background-color:#fff;border-bottom:0}.bs-home-nav .bs-nav-b{display:none}.bs-docs-nav .navbar-brand,.bs-docs-nav .navbar-nav>li>a{font-weight:500;color:#563d7c}.bs-docs-nav .navbar-nav>li>a:hover,.bs-docs-nav .navbar-nav>.active>a,.bs-docs-nav .navbar-nav>.active>a:hover{color:#463265;background-color:#f9f9f9}.bs-docs-nav .navbar-toggle .icon-bar{background-color:#563d7c}.bs-docs-nav .navbar-header .navbar-toggle{border-color:#fff}.bs-docs-nav .navbar-header .navbar-toggle:hover,.bs-docs-nav .navbar-header .navbar-toggle:focus{background-color:#f9f9f9;border-color:#f9f9f9}.bs-docs-footer{padding-top:40px;padding-bottom:40px;margin-top:100px;color:#777;text-align:center;border-top:1px solid #e5e5e5}.bs-docs-footer-links{padding-left:0;margin-top:20px;color:#999}.bs-docs-footer-links li{display:inline;padding:0 2px}.bs-docs-footer-links li:first-child{padding-left:0}@media (min-width:768px){.bs-docs-footer p{margin-bottom:0}}.bs-docs-social{margin-bottom:20px;text-align:center}.bs-docs-social-buttons{display:inline-block;padding-left:0;margin-bottom:0;list-style:none}.bs-docs-social-buttons li{display:inline-block;padding:5px 8px;line-height:1}.bs-docs-social-buttons .twitter-follow-button{width:225px!important}.bs-docs-social-buttons .twitter-share-button{width:98px!important}.github-btn{overflow:hidden;border:0}.bs-docs-masthead,.bs-docs-header{position:relative;padding:30px 15px;color:#cdbfe3;text-align:center;text-shadow:0 1px 0 rgba(0,0,0,.1);background-color:#6f5499;background-image:-webkit-gradient(linear,left top,left bottom,from(#563d7c),to(#6f5499));background-image:-webkit-linear-gradient(top,#563d7c 0,#6f5499 100%);background-image:-o-linear-gradient(top,#563d7c 0,#6f5499 100%);background-image:linear-gradient(to bottom,#563d7c 0,#6f5499 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#563d7c', endColorstr='#6F5499', GradientType=0);background-repeat:repeat-x}.bs-docs-masthead .bs-docs-booticon{margin:0 auto 30px}.bs-docs-masthead h1{font-weight:300;line-height:1;color:#fff}.bs-docs-masthead .lead{margin:0 auto 30px;font-size:20px;color:#fff}.bs-docs-masthead .version{margin-top:-15px;margin-bottom:30px;color:#9783b9}.bs-docs-masthead .btn{width:100%;padding:15px 30px;font-size:20px}@media (min-width:480px){.bs-docs-masthead .btn{width:auto}}@media (min-width:768px){.bs-docs-masthead{padding:80px 0}.bs-docs-masthead h1{font-size:60px}.bs-docs-masthead .lead{font-size:24px}}@media (min-width:992px){.bs-docs-masthead .lead{width:80%;font-size:30px}}.bs-docs-header{margin-bottom:40px;font-size:20px}.bs-docs-header h1{margin-top:0;color:#fff}.bs-docs-header p{margin-bottom:0;font-weight:300;line-height:1.4}.bs-docs-header .container{position:relative}@media (min-width:768px){.bs-docs-header{padding-top:60px;padding-bottom:60px;font-size:24px;text-align:left}.bs-docs-header h1{font-size:60px;line-height:1}}@media (min-width:992px){.bs-docs-header h1,.bs-docs-header p{margin-right:380px}}.carbonad{width:auto!important;height:auto!important;padding:20px!important;margin:30px -30px -31px!important;overflow:hidden;font-size:13px!important;line-height:16px!important;text-align:left;background:transparent!important;border:solid #866ab3!important;border-width:1px 0!important}.carbonad-img{margin:0!important}.carbonad-text,.carbonad-tag{display:block!important;float:none!important;width:auto!important;height:auto!important;margin-left:145px!important;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif!important}.carbonad-text{padding-top:0!important}.carbonad-tag{color:inherit!important;text-align:left!important}.carbonad-text a,.carbonad-tag a{color:#fff!important}.carbonad #azcarbon>img{display:none}@media (min-width:480px){.carbonad{width:330px!important;margin:20px auto!important;border-width:1px!important;border-radius:4px}.bs-docs-masthead .carbonad{margin:50px auto 0!important}}@media (min-width:768px){.carbonad{margin-right:0!important;margin-left:0!important}}@media (min-width:992px){.carbonad{position:absolute;top:0;right:15px;width:330px!important;padding:15px!important;margin:0!important}.bs-docs-masthead .carbonad{position:static}}.bs-docs-featurette{padding-top:40px;padding-bottom:40px;font-size:16px;line-height:1.5;color:#555;text-align:center;background-color:#fff;border-bottom:1px solid #e5e5e5}.bs-docs-featurette+.bs-docs-footer{margin-top:0;border-top:0}.bs-docs-featurette-title{margin-bottom:5px;font-size:30px;font-weight:400;color:#333}.half-rule{width:100px;margin:40px auto}.bs-docs-featurette h3{margin-bottom:5px;font-weight:400;color:#333}.bs-docs-featurette-img{display:block;margin-bottom:20px;color:#333}.bs-docs-featurette-img:hover{color:#428bca;text-decoration:none}.bs-docs-featurette-img img{display:block;margin-bottom:15px}@media (min-width:480px){.bs-docs-featurette .img-responsive{margin-top:30px}}@media (min-width:768px){.bs-docs-featurette{padding-top:100px;padding-bottom:100px}.bs-docs-featurette-title{font-size:40px}.bs-docs-featurette .lead{max-width:80%;margin-right:auto;margin-left:auto}.bs-docs-featured-sites .col-sm-3:first-child img{border-top-left-radius:4px;border-bottom-left-radius:4px}.bs-docs-featured-sites .col-sm-3:last-child img{border-top-right-radius:4px;border-bottom-right-radius:4px}.bs-docs-featurette .img-responsive{margin-top:0}}.bs-docs-featured-sites{margin-right:-1px;margin-left:-1px}.bs-docs-featured-sites .col-sm-3{padding-right:1px;padding-left:1px}.bs-docs-featured-sites .img-responsive{margin-bottom:15px}@media (min-width:480px){.bs-docs-featured-sites .img-responsive{margin-bottom:0}}@media (max-width:480px){.bs-examples{margin-right:-10px;margin-left:-10px}.bs-examples>[class^=col-]{padding-right:10px;padding-left:10px}}.bs-docs-sidebar.affix{position:static}@media (min-width:768px){.bs-docs-sidebar{padding-left:20px}}.bs-docs-sidenav{margin-top:20px;margin-bottom:20px}.bs-docs-sidebar .nav>li>a{display:block;padding:4px 20px;font-size:13px;font-weight:500;color:#999}.bs-docs-sidebar .nav>li>a:hover,.bs-docs-sidebar .nav>li>a:focus{padding-left:19px;color:#563d7c;text-decoration:none;background-color:transparent;border-left:1px solid #563d7c}.bs-docs-sidebar .nav>.active>a,.bs-docs-sidebar .nav>.active:hover>a,.bs-docs-sidebar .nav>.active:focus>a{padding-left:18px;font-weight:700;color:#563d7c;background-color:transparent;border-left:2px solid #563d7c}.bs-docs-sidebar .nav .nav{display:none;padding-bottom:10px}.bs-docs-sidebar .nav .nav>li>a{padding-top:1px;padding-bottom:1px;padding-left:30px;font-size:12px;font-weight:400}.bs-docs-sidebar .nav .nav>li>a:hover,.bs-docs-sidebar .nav .nav>li>a:focus{padding-left:29px}.bs-docs-sidebar .nav .nav>.active>a,.bs-docs-sidebar .nav .nav>.active:hover>a,.bs-docs-sidebar .nav .nav>.active:focus>a{padding-left:28px;font-weight:500}.back-to-top,.bs-docs-theme-toggle{display:none;padding:4px 10px;margin-top:10px;margin-left:10px;font-size:12px;font-weight:500;color:#999}.back-to-top:hover,.bs-docs-theme-toggle:hover{color:#563d7c;text-decoration:none}.bs-docs-theme-toggle{margin-top:0}@media (min-width:768px){.back-to-top,.bs-docs-theme-toggle{display:block}}@media (min-width:992px){.bs-docs-sidebar .nav>.active>ul{display:block}.bs-docs-sidebar.affix,.bs-docs-sidebar.affix-bottom{width:213px}.bs-docs-sidebar.affix{position:fixed;top:20px}.bs-docs-sidebar.affix-bottom{position:absolute}.bs-docs-sidebar.affix-bottom .bs-docs-sidenav,.bs-docs-sidebar.affix .bs-docs-sidenav{margin-top:0;margin-bottom:0}}@media (min-width:1200px){.bs-docs-sidebar.affix-bottom,.bs-docs-sidebar.affix{width:263px}}.bs-docs-section{margin-bottom:60px}.bs-docs-section:last-child{margin-bottom:0}h1[id]{padding-top:20px;margin-top:0}.bs-callout{padding:20px;margin:20px 0;border:1px solid #eee;border-left-width:5px;border-radius:3px}.bs-callout h4{margin-top:0;margin-bottom:5px}.bs-callout p:last-child{margin-bottom:0}.bs-callout code{border-radius:3px}.bs-callout+.bs-callout{margin-top:-5px}.bs-callout-danger{border-left-color:#d9534f}.bs-callout-danger h4{color:#d9534f}.bs-callout-warning{border-left-color:#f0ad4e}.bs-callout-warning h4{color:#f0ad4e}.bs-callout-info{border-left-color:#5bc0de}.bs-callout-info h4{color:#5bc0de}.color-swatches{margin:0 -5px;overflow:hidden}.color-swatch{float:left;width:60px;height:60px;margin:0 5px;border-radius:3px}@media (min-width:768px){.color-swatch{width:100px;height:100px}}.color-swatches .gray-darker{background-color:#222}.color-swatches .gray-dark{background-color:#333}.color-swatches .gray{background-color:#555}.color-swatches .gray-light{background-color:#999}.color-swatches .gray-lighter{background-color:#eee}.color-swatches .brand-primary{background-color:#428bca}.color-swatches .brand-success{background-color:#5cb85c}.color-swatches .brand-warning{background-color:#f0ad4e}.color-swatches .brand-danger{background-color:#d9534f}.color-swatches .brand-info{background-color:#5bc0de}.color-swatches .bs-purple{background-color:#563d7c}.color-swatches .bs-purple-light{background-color:#c7bfd3}.color-swatches .bs-purple-lighter{background-color:#e5e1ea}.color-swatches .bs-gray{background-color:#f9f9f9}.bs-team .team-member{line-height:32px;color:#555}.bs-team .team-member:hover{color:#333;text-decoration:none}.bs-team .github-btn{float:right;width:180px;height:20px;margin-top:6px}.bs-team img{float:left;width:32px;margin-right:10px;border-radius:4px}.show-grid{margin-bottom:15px}.show-grid [class^=col-]{padding-top:10px;padding-bottom:10px;background-color:#eee;background-color:rgba(86,61,124,.15);border:1px solid #ddd;border:1px solid rgba(86,61,124,.2)}.bs-example{position:relative;padding:45px 15px 15px;margin:0 -15px 15px;border-color:#e5e5e5 #eee #eee;border-style:solid;border-width:1px 0;-webkit-box-shadow:inset 0 3px 6px rgba(0,0,0,.05);box-shadow:inset 0 3px 6px rgba(0,0,0,.05)}.bs-example:after{position:absolute;top:15px;left:15px;font-size:12px;font-weight:700;color:#959595;text-transform:uppercase;letter-spacing:1px;content:"Example"}.bs-example+.highlight{margin:-15px -15px 15px;border-width:0 0 1px;border-radius:0}@media (min-width:768px){.bs-example{margin-right:0;margin-left:0;background-color:#fff;border-color:#ddd;border-width:1px;border-radius:4px 4px 0 0;-webkit-box-shadow:none;box-shadow:none}.bs-example+.highlight{margin-top:-16px;margin-right:0;margin-left:0;border-width:1px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}}.bs-example .container{width:auto}.bs-example>p:last-child,.bs-example>ul:last-child,.bs-example>ol:last-child,.bs-example>blockquote:last-child,.bs-example>.form-control:last-child,.bs-example>.table:last-child,.bs-example>.navbar:last-child,.bs-example>.jumbotron:last-child,.bs-example>.alert:last-child,.bs-example>.panel:last-child,.bs-example>.list-group:last-child,.bs-example>.well:last-child,.bs-example>.progress:last-child,.bs-example>.table-responsive:last-child>.table{margin-bottom:0}.bs-example>p>.close{float:none}.bs-example-type .table .type-info{color:#999;vertical-align:middle}.bs-example-type .table td{padding:15px 0;border-color:#eee}.bs-example-type .table tr:first-child td{border-top:0}.bs-example-type h1,.bs-example-type h2,.bs-example-type h3,.bs-example-type h4,.bs-example-type h5,.bs-example-type h6{margin:0}.bs-example-bg-classes p{padding:15px}.bs-example>.img-circle,.bs-example>.img-rounded,.bs-example>.img-thumbnail{margin:5px}.bs-example>.table-responsive>.table{background-color:#fff}.bs-example>.btn,.bs-example>.btn-group{margin-top:5px;margin-bottom:5px}.bs-example>.btn-toolbar+.btn-toolbar{margin-top:10px}.bs-example-control-sizing select,.bs-example-control-sizing input[type=text]+input[type=text]{margin-top:10px}.bs-example-form .input-group{margin-bottom:10px}.bs-example>textarea.form-control{resize:vertical}.bs-example>.list-group{max-width:400px}.bs-example .navbar:last-child{margin-bottom:0}.bs-navbar-top-example,.bs-navbar-bottom-example{z-index:1;padding:0;overflow:hidden}.bs-navbar-top-example .navbar-header,.bs-navbar-bottom-example .navbar-header{margin-left:0}.bs-navbar-top-example .navbar-fixed-top,.bs-navbar-bottom-example .navbar-fixed-bottom{position:relative;margin-right:0;margin-left:0}.bs-navbar-top-example{padding-bottom:45px}.bs-navbar-top-example:after{top:auto;bottom:15px}.bs-navbar-top-example .navbar-fixed-top{top:-1px}.bs-navbar-bottom-example{padding-top:45px}.bs-navbar-bottom-example .navbar-fixed-bottom{bottom:-1px}.bs-navbar-bottom-example .navbar{margin-bottom:0}@media (min-width:768px){.bs-navbar-top-example .navbar-fixed-top,.bs-navbar-bottom-example .navbar-fixed-bottom{position:absolute}}.bs-example .pagination{margin-top:10px;margin-bottom:10px}.bs-example>.pager{margin-top:0}.bs-example-modal{background-color:#f5f5f5}.bs-example-modal .modal{position:relative;top:auto;right:auto;bottom:auto;left:auto;z-index:1;display:block}.bs-example-modal .modal-dialog{left:auto;margin-right:auto;margin-left:auto}.bs-example>.dropdown>.dropdown-toggle{float:left}.bs-example>.dropdown>.dropdown-menu{position:static;display:block;margin-bottom:5px;clear:left}.bs-example-tabs .nav-tabs{margin-bottom:15px}.bs-example-tooltips{text-align:center}.bs-example-tooltips>.btn{margin-top:5px;margin-bottom:5px}.bs-example-popover{padding-bottom:24px;background-color:#f9f9f9}.bs-example-popover .popover{position:relative;display:block;float:left;width:260px;margin:20px}.scrollspy-example{position:relative;height:200px;margin-top:10px;overflow:auto}.highlight{padding:9px 14px;margin-bottom:14px;background-color:#f7f7f9;border:1px solid #e1e1e8;border-radius:4px}.highlight pre{padding:0;margin-top:0;margin-bottom:0;word-break:normal;word-wrap:nowrap;white-space:nowrap;background-color:transparent;border:0}.highlight pre code{font-size:inherit;color:#333}.highlight pre code:first-child{display:inline-block;padding-right:45px}.table-responsive .highlight pre{white-space:normal}.bs-table th small,.responsive-utilities th small{display:block;font-weight:400;color:#999}.responsive-utilities tbody th{font-weight:400}.responsive-utilities td{text-align:center}.responsive-utilities td.is-visible{color:#468847;background-color:#dff0d8!important}.responsive-utilities td.is-hidden{color:#ccc;background-color:#f9f9f9!important}.responsive-utilities-test{margin-top:5px}.responsive-utilities-test .col-xs-6{margin-bottom:10px}.responsive-utilities-test span{display:block;padding:15px 10px;font-size:14px;font-weight:700;line-height:1.1;text-align:center;border-radius:4px}.visible-on .col-xs-6 .hidden-xs,.visible-on .col-xs-6 .hidden-sm,.visible-on .col-xs-6 .hidden-md,.visible-on .col-xs-6 .hidden-lg,.hidden-on .col-xs-6 .hidden-xs,.hidden-on .col-xs-6 .hidden-sm,.hidden-on .col-xs-6 .hidden-md,.hidden-on .col-xs-6 .hidden-lg{color:#999;border:1px solid #ddd}.visible-on .col-xs-6 .visible-xs-block,.visible-on .col-xs-6 .visible-sm-block,.visible-on .col-xs-6 .visible-md-block,.visible-on .col-xs-6 .visible-lg-block,.hidden-on .col-xs-6 .visible-xs-block,.hidden-on .col-xs-6 .visible-sm-block,.hidden-on .col-xs-6 .visible-md-block,.hidden-on .col-xs-6 .visible-lg-block{color:#468847;background-color:#dff0d8;border:1px solid #d6e9c6}.bs-glyphicons{margin:0 -10px 20px;overflow:hidden}.bs-glyphicons-list{padding-left:0;list-style:none}.bs-glyphicons li{float:left;width:25%;height:115px;padding:10px;font-size:10px;line-height:1.4;text-align:center;background-color:#f9f9f9;border:1px solid #fff}.bs-glyphicons .glyphicon{margin-top:5px;margin-bottom:10px;font-size:24px}.bs-glyphicons .glyphicon-class{display:block;text-align:center;word-wrap:break-word}.bs-glyphicons li:hover{color:#fff;background-color:#563d7c}@media (min-width:768px){.bs-glyphicons{margin-right:0;margin-left:0}.bs-glyphicons li{width:12.5%;font-size:12px}}.bs-customizer .toggle{float:right;margin-top:25px}.bs-customizer label{margin-top:10px;font-weight:500;color:#555}.bs-customizer h2{padding-top:30px;margin-top:0;margin-bottom:5px}.bs-customizer h3{margin-bottom:0}.bs-customizer h4{margin-top:15px;margin-bottom:0}.bs-customizer .bs-callout h4{margin-top:0;margin-bottom:5px}.bs-customizer input[type=text]{font-family:Menlo,Monaco,Consolas,"Courier New",monospace;background-color:#fafafa}.bs-customizer .help-block{margin-bottom:5px;font-size:12px}#less-section label{font-weight:400}.bs-customizer-input{float:left;width:33.333333%;padding-right:15px;padding-left:15px}.bs-customize-download .btn-outline{padding:20px}.bs-customizer-alert{position:fixed;top:0;right:0;left:0;z-index:1030;padding:15px 0;color:#fff;background-color:#d9534f;border-bottom:1px solid #b94441;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25);box-shadow:inset 0 1px 0 rgba(255,255,255,.25)}.bs-customizer-alert .close{margin-top:-4px;font-size:24px}.bs-customizer-alert p{margin-bottom:0}.bs-customizer-alert .glyphicon{margin-right:5px}.bs-customizer-alert pre{margin:10px 0 0;color:#fff;background-color:#a83c3a;border-color:#973634;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 2px 4px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}.bs-brand-logos{display:table;width:100%;margin-bottom:15px;overflow:hidden;color:#563d7c;background-color:#f9f9f9;border-radius:4px}.bs-brand-item{padding:60px 0;text-align:center}.bs-brand-item+.bs-brand-item{border-top:1px solid #fff}.bs-brand-logos .inverse{color:#fff;background-color:#563d7c}.bs-brand-item .svg{width:144px;height:144px}.bs-brand-item h1,.bs-brand-item h3{margin-top:0;margin-bottom:0}.bs-brand-item .bs-docs-booticon{margin-right:auto;margin-left:auto}.bs-brand-item .glyphicon{width:30px;height:30px;margin:10px auto -10px;line-height:30px;color:#fff;border-radius:50%}.bs-brand-item .glyphicon-ok{background-color:#5cb85c}.bs-brand-item .glyphicon-remove{background-color:#d9534f}@media (min-width:768px){.bs-brand-item{display:table-cell;width:1%}.bs-brand-item+.bs-brand-item{border-top:0;border-left:1px solid #fff}.bs-brand-item h1{font-size:60px}}.bs-examples .thumbnail{margin-bottom:10px}.bs-examples h4{margin-bottom:5px}.bs-examples p{margin-bottom:20px}#focusedInput{border-color:#ccc;border-color:rgba(82,168,236,.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:0 0 8px rgba(82,168,236,.6);box-shadow:0 0 8px rgba(82,168,236,.6)}.zero-clipboard{position:relative;display:none}.btn-clipboard{position:absolute;top:0;right:0;z-index:10;display:block;padding:5px 8px;font-size:12px;color:#777;cursor:pointer;background-color:#fff;border:1px solid #e1e1e8;border-radius:0 4px 0 4px}.btn-clipboard-hover{color:#fff;background-color:#563d7c;border-color:#563d7c}@media (min-width:768px){.zero-clipboard{display:block}}.hll{background-color:#ffc}.c{color:#999}.err{color:#A00;background-color:#FAA}.k{color:#069}.o{color:#555}.cm{color:#999}.cp{color:#099}.c1{color:#999}.cs{color:#999}.gd{background-color:#FCC;border:1px solid #C00}.ge{font-style:italic}.gr{color:red}.gh{color:#030}.gi{background-color:#CFC;border:1px solid #0C0}.go{color:#AAA}.gp{color:#009}.gu{color:#030}.gt{color:#9C6}.kc{color:#069}.kd{color:#069}.kn{color:#069}.kp{color:#069}.kr{color:#069}.kt{color:#078}.m{color:#F60}.s{color:#d44950}.na{color:#4f9fcf}.nb{color:#366}.nc{color:#0A8}.no{color:#360}.nd{color:#99F}.ni{color:#999}.ne{color:#C00}.nf{color:#C0F}.nl{color:#99F}.nn{color:#0CF}.nt{color:#2f6f9f}.nv{color:#033}.ow{color:#000}.w{color:#bbb}.mf{color:#F60}.mh{color:#F60}.mi{color:#F60}.mo{color:#F60}.sb{color:#C30}.sc{color:#C30}.sd{color:#C30;font-style:italic}.s2{color:#C30}.se{color:#C30}.sh{color:#C30}.si{color:#A00}.sx{color:#C30}.sr{color:#3AA}.s1{color:#C30}.ss{color:#FC3}.bp{color:#366}.vc{color:#033}.vg{color:#033}.vi{color:#033}.il{color:#F60}.css .o,.css .o+.nt,.css .nt+.nt{color:#999} \ No newline at end of file diff --git a/play25-bootstrap4/sample/system.properties b/play25-bootstrap4/sample/system.properties deleted file mode 100644 index 916c446..0000000 --- a/play25-bootstrap4/sample/system.properties +++ /dev/null @@ -1 +0,0 @@ -java.runtime.version=1.8 \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/bsFieldConstructorCommon.scala.html b/play26-bootstrap3/module/app/views/b3/bsFieldConstructorCommon.scala.html deleted file mode 100644 index 7056c03..0000000 --- a/play26-bootstrap3/module/app/views/b3/bsFieldConstructorCommon.scala.html +++ /dev/null @@ -1,9 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html)(wrap: Html => Html)(implicit fc: b3.B3FieldConstructor) -
- @wrap { - @inputHtml - @fieldInfo.errorsAndInfos.map { case (id, text) => - @text - } - } -
\ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/bsFormGroupCommon.scala.html b/play26-bootstrap3/module/app/views/b3/bsFormGroupCommon.scala.html deleted file mode 100644 index a554825..0000000 --- a/play26-bootstrap3/module/app/views/b3/bsFormGroupCommon.scala.html +++ /dev/null @@ -1,11 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(wrap: Html => Html)(implicit messages: MessagesProvider) -@defining(argsMap.get('_id).map(_.toString).orElse(argsMap.get('id).map(_.toString + "_field"))) { idFormField => -
id="@id"}> - @wrap { - @contentHtml - @argsMap.get('_help).map { help => - @bs.Args.msg(help)(messages) - } - } -
-} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/buttonType.scala.html b/play26-bootstrap3/module/app/views/b3/buttonType.scala.html deleted file mode 100644 index cd2ea09..0000000 --- a/play26-bootstrap3/module/app/views/b3/buttonType.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(buttonType: String, args: (Symbol,Any)*)(text: => Html)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@freeFormGroup(args) { innerArgsMap => - -}(fc, messages) \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/checkbox.scala.html b/play26-bootstrap3/module/app/views/b3/checkbox.scala.html deleted file mode 100644 index f032580..0000000 --- a/play26-bootstrap3/module/app/views/b3/checkbox.scala.html +++ /dev/null @@ -1,22 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@defining({ - val argsMap = args.toMap - val value = argsMap.get('value).getOrElse("true").toString - val checked = argsMap.get('checked).orElse(field.value.map(_ == value).orElse(argsMap.get('_default))).map(_.toString == "true").getOrElse(false) - val containsReadonly = argsMap.contains('readonly) - val readonly = bs.ArgsMap.isTrue(argsMap, 'readonly) - val disabled = readonly || bs.ArgsMap.isTrue(argsMap, 'disabled) - (argsMap, value, checked, containsReadonly, readonly, disabled) -}){ case (argsMap, value, checked, containsReadonly, readonly, disabled) => - @inputFormGroup(field, withFeedback = false, withLabelFor = false, bs.Args.withDefault(args.filterNot(_._1 == 'checked), 'checked -> checked, 'disabled -> disabled)) { fieldInfo => -
- - @if(containsReadonly) { - - } -
- }(fc, messages) -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/clear/package.scala b/play26-bootstrap3/module/app/views/b3/clear/package.scala deleted file mode 100644 index f7bed79..0000000 --- a/play26-bootstrap3/module/app/views/b3/clear/package.scala +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -package object clear { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.MessagesProvider - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Clear FieldConstructor. - */ - class ClearFieldConstructor(val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* Define the class of the corresponding form */ - val formClass = "form-clear" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit msgsProv: MessagesProvider) = inputHtml - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit msgsProv: MessagesProvider) = contentHtml - } - - /** - * Creates a new ClearFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific ClearFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(withFeedbackIcons: Boolean = false): ClearFieldConstructor = - new ClearFieldConstructor(withFeedbackIcons) - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - def fieldConstructor(withFeedbackIcons: Boolean = false): B3FieldConstructor = - fieldConstructorSpecific(withFeedbackIcons) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: ClearFieldConstructor => Html) = { - val cfc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.form(action, inner(args): _*)(body(cfc))(cfc) - } - def formCSRF(action: Call, args: (Symbol, Any)*)(body: ClearFieldConstructor => Html)(implicit request: RequestHeader) = { - val cfc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.formCSRF(action, inner(args): _*)(body(cfc))(cfc, request) - } - -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/file.scala.html b/play26-bootstrap3/module/app/views/b3/file.scala.html deleted file mode 100644 index 8024e6c..0000000 --- a/play26-bootstrap3/module/app/views/b3/file.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@inputFormGroup(field, withFeedback = true, withLabelFor = true, args) { fieldInfo => - -}(fc, messages) \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/form.scala.html b/play26-bootstrap3/module/app/views/b3/form.scala.html deleted file mode 100644 index 53d938c..0000000 --- a/play26-bootstrap3/module/app/views/b3/form.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(action: Call, args: (Symbol, Any)*)(body: => Html)(implicit fc: b3.B3FieldConstructor) -
"form"), 'class).toMap)> - @body -
\ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/formCSRF.scala.html b/play26-bootstrap3/module/app/views/b3/formCSRF.scala.html deleted file mode 100644 index e85f92f..0000000 --- a/play26-bootstrap3/module/app/views/b3/formCSRF.scala.html +++ /dev/null @@ -1,5 +0,0 @@ -@(action: Call, args: (Symbol, Any)*)(body: => Html)(implicit fc: b3.B3FieldConstructor, request: RequestHeader) -@form(action, args:_*) { - @helper.CSRF.formField - @body -}(fc) \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/hiddenInput.scala.html b/play26-bootstrap3/module/app/views/b3/hiddenInput.scala.html deleted file mode 100644 index 5ae08f3..0000000 --- a/play26-bootstrap3/module/app/views/b3/hiddenInput.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(name: Any, value: Any, args: (Symbol, Any)*) - \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/hiddens.scala.html b/play26-bootstrap3/module/app/views/b3/hiddens.scala.html deleted file mode 100644 index 6c7d022..0000000 --- a/play26-bootstrap3/module/app/views/b3/hiddens.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(namesAndValues: (Any, Any)*) -@namesAndValues.map { case (name, value) => - -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/horizontal/bsFieldConstructor.scala.html b/play26-bootstrap3/module/app/views/b3/horizontal/bsFieldConstructor.scala.html deleted file mode 100644 index 1f222e4..0000000 --- a/play26-bootstrap3/module/app/views/b3/horizontal/bsFieldConstructor.scala.html +++ /dev/null @@ -1,13 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html, colLabel: String, colOffset: String, colInput: String)(implicit fc: b3.B3FieldConstructor, msgsProv: MessagesProvider) -@b3.bsFieldConstructorCommon(fieldInfo, inputHtml) { content => - @fieldInfo.labelOpt.map { label => - -
- @content -
- }.getOrElse { -
- @content -
- } -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/horizontal/bsFormGroup.scala.html b/play26-bootstrap3/module/app/views/b3/horizontal/bsFormGroup.scala.html deleted file mode 100644 index 762605e..0000000 --- a/play26-bootstrap3/module/app/views/b3/horizontal/bsFormGroup.scala.html +++ /dev/null @@ -1,13 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any], colLabel: String, colOffset: String, colInput: String)(implicit messages: MessagesProvider) -@b3.bsFormGroupCommon(contentHtml, argsMap) { content => - @argsMap.get('_label).map { label => - -
- @content -
- }.getOrElse { -
- @content -
- } -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/horizontal/package.scala b/play26-bootstrap3/module/app/views/b3/horizontal/package.scala deleted file mode 100644 index 9d411da..0000000 --- a/play26-bootstrap3/module/app/views/b3/horizontal/package.scala +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -package object horizontal { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.MessagesProvider - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Horizontal FieldConstructor. - * It needs the column widths for the corresponding Bootstrap3 form-group - */ - case class HorizontalFieldConstructor(colLabel: String, colInput: String, val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* The equivalent offset if label is not present (ex: colLabel = "col-md-2" => colOffset = "col-md-offset-2") */ - val colOffset: String = { - val chunks = colLabel.split("-") - (chunks.init :+ "offset" :+ chunks.last).mkString("-") - } - /* Define the class of the corresponding form */ - val formClass = "form-horizontal" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit msgsProv: MessagesProvider) = bsFieldConstructor(fieldInfo, inputHtml, colLabel, colOffset, colInput)(this, msgsProv) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit msgsProv: MessagesProvider) = bsFormGroup(contentHtml, argsMap, colLabel, colOffset, colInput)(msgsProv) - } - - /** - * Returns a new HorizontalFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific HorizontalFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(colLabel: String, colInput: String, withFeedbackIcons: Boolean = false): HorizontalFieldConstructor = - new HorizontalFieldConstructor(colLabel, colInput, withFeedbackIcons) - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - def fieldConstructor(colLabel: String, colInput: String, withFeedbackIcons: Boolean = false): B3FieldConstructor = - fieldConstructorSpecific(colLabel, colInput, withFeedbackIcons) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, colLabel: String, colInput: String, args: (Symbol, Any)*)(body: HorizontalFieldConstructor => Html) = { - val hfc = fieldConstructorSpecific(colLabel, colInput, withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.form(action, inner(args): _*)(body(hfc))(hfc) - } - def formCSRF(action: Call, colLabel: String, colInput: String, args: (Symbol, Any)*)(body: HorizontalFieldConstructor => Html)(implicit request: RequestHeader) = { - val hfc = fieldConstructorSpecific(colLabel, colInput, withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.formCSRF(action, inner(args): _*)(body(hfc))(hfc, request) - } - -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/inline/bsFieldConstructor.scala.html b/play26-bootstrap3/module/app/views/b3/inline/bsFieldConstructor.scala.html deleted file mode 100644 index 5bef86d..0000000 --- a/play26-bootstrap3/module/app/views/b3/inline/bsFieldConstructor.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html)(implicit fc: b3.B3FieldConstructor, msgsProv: MessagesProvider) -@b3.bsFieldConstructorCommon(fieldInfo, inputHtml) { content => - @fieldInfo.labelOpt.map { label => - - } - @content -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/inline/bsFormGroup.scala.html b/play26-bootstrap3/module/app/views/b3/inline/bsFormGroup.scala.html deleted file mode 100644 index f78da2a..0000000 --- a/play26-bootstrap3/module/app/views/b3/inline/bsFormGroup.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: MessagesProvider) -@b3.bsFormGroupCommon(contentHtml, argsMap) { content => - @argsMap.get('_label).map { label => - - } - @content -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/inline/package.scala b/play26-bootstrap3/module/app/views/b3/inline/package.scala deleted file mode 100644 index b7d0571..0000000 --- a/play26-bootstrap3/module/app/views/b3/inline/package.scala +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -package object inline { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.MessagesProvider - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Inline FieldConstructor. - */ - class InlineFieldConstructor(val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* Define the class of the corresponding form */ - val formClass = "form-inline" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit msgsProv: MessagesProvider) = bsFieldConstructor(fieldInfo, inputHtml)(this, msgsProv) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit msgsProv: MessagesProvider) = bsFormGroup(contentHtml, argsMap)(msgsProv) - } - - /** - * Creates a new InlineFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific InlineFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(withFeedbackIcons: Boolean = false): InlineFieldConstructor = - new InlineFieldConstructor(withFeedbackIcons) - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - def fieldConstructor(withFeedbackIcons: Boolean = false): B3FieldConstructor = - fieldConstructorSpecific(withFeedbackIcons) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: InlineFieldConstructor => Html) = { - val ifc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackTooltip)) - views.html.b3.form(action, inner(args): _*)(body(ifc))(ifc) - } - def formCSRF(action: Call, args: (Symbol, Any)*)(body: InlineFieldConstructor => Html)(implicit request: RequestHeader) = { - val ifc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackTooltip)) - views.html.b3.formCSRF(action, inner(args): _*)(body(ifc))(ifc, request) - } - -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/inputWrapped.scala.html b/play26-bootstrap3/module/app/views/b3/inputWrapped.scala.html deleted file mode 100644 index bfc1a51..0000000 --- a/play26-bootstrap3/module/app/views/b3/inputWrapped.scala.html +++ /dev/null @@ -1,10 +0,0 @@ -@(inputType: String, field: Field, args: (Symbol,Any)*)(inputGroup: Html => Html)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@inputFormGroup(field, withFeedback = true, withLabelFor = true, bs.Args.withAddingStringValue(args, 'class, "form-control")) { fieldInfo => - @inputGroup { - - @if(fieldInfo.hasFeedback) { - - (@fieldInfo.status) - } - } -}(fc, messages) \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/multifield.scala.html b/play26-bootstrap3/module/app/views/b3/multifield.scala.html deleted file mode 100644 index f763f8b..0000000 --- a/play26-bootstrap3/module/app/views/b3/multifield.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(fields: Field*)(globalArgs: Seq[(Symbol,Any)], fieldsArgs: Seq[(Symbol,Any)])(inputsHtml: b3.clear.ClearFieldConstructor => Html)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@multifieldFormGroup(fields, globalArgs, fieldsArgs) { multifieldInfo => - @inputsHtml(b3.clear.fieldConstructorSpecific()) - @multifieldInfo.errorsAndInfos.map { errorOrInfo => - @errorOrInfo - } -}(fc, messages) \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/package.scala b/play26-bootstrap3/module/app/views/b3/package.scala deleted file mode 100644 index 5b33278..0000000 --- a/play26-bootstrap3/module/app/views/b3/package.scala +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html - -package object b3 { - - import play.api.data.{ Field, FormError } - import play.twirl.api.Html - import play.api.i18n.MessagesProvider - import bs._ - import bs.ArgsMap.isTrue - import play.api.mvc.Call - - /** - * Class with relevant variables for a field to pass it to the helper and field constructor - * - withFeedbak: indicates if the feedback icons are allowed - * - withLabelFor: indicates if the label's "for" attribute should be shown - * - args: list of available arguments for the helper and field constructor - */ - case class B3FieldInfo(field: Field, withFeedback: Boolean, withLabelFor: Boolean, args: Seq[(Symbol, Any)], override val msgsProv: MessagesProvider) extends BSFieldInfo(field, args, msgsProv) { - - /* List with every "info" and its corresponding ARIA id. Ex: ("foo_info_0" -> "foo constraint") */ - val infos: Seq[(String, String)] = { - val feedbackInfosButErrors = BSFieldInfo.feedbackInfosButErrors(argsMap, msgsProv).zipWithIndex.map { - case (info, i) => (id + "_info_" + i, info) - } - if (feedbackInfosButErrors.size > 0) - feedbackInfosButErrors - else - BSFieldInfo.helpInfos(Some(field), argsMap, msgsProv).zipWithIndex.map { - case (info, i) => (id + "_info_" + i, info) - } - } - - /* List with the errors and infos */ - def errorsAndInfos = errors ++ infos - - /* The optional validation state ("success", "warning" or "error") */ - override lazy val status: Option[String] = B3FieldInfo.status(hasErrors, argsMap) - - /* Each boolean indicate if a any of the corresponding feedback icons should be shown */ - val (showIconError, showIconWarning, showIconValid) = { - if (!withFeedback) (false, false, false) - else if (hasErrors) (isTrue(argsMap, '_showIconOnError), false, false) - else if (isTrue(argsMap, '_showIconWarning)) (false, true, false) - else (false, false, isTrue(argsMap, '_showIconValid)) - } - - /* Indicates if any of the previous feedback icons should be shown */ - def hasFeedback(implicit fc: B3FieldConstructor): Boolean = withFeedback && (fc.withFeedbackIcons || showIconError || showIconWarning || showIconValid) - - /* The optional validation state for the form-group ("has-success", "has-warning", "has-error") with the optional "has-feedback" */ - def statusWithFeedback(implicit fc: B3FieldConstructor): Option[String] = B3FieldInfo.statusWithFeedback(status, hasFeedback) - - /* Returns the corresponding icon from the validation status */ - def feedbackIcon: Option[String] = status.map { - _ match { - case "error" => "glyphicon-remove" - case "warning" => "glyphicon-warning-sign" - case "success" => "glyphicon-ok" - } - } - - /* ARIA id for the feedback icons (ex: "foo_status") */ - def ariaFeedbackId: String = id + "_status" - - /* List of every ARIA id */ - def ariaIds(implicit fc: B3FieldConstructor): Seq[String] = (if (hasFeedback) Seq(ariaFeedbackId) else Nil) ++ infos.map(_._1) ++ errors.map(_._1) - - /* - * Map with the inner args, i.e. those args for the helper itself removing those ones reserved for the field constructor. - * It adds the ARIA attributes and removes the underscored reserved for the field constructor and the `id and `value ones that are - * managed independently. - */ - def innerArgsMap(implicit fc: B3FieldConstructor): Map[Symbol, Any] = ( - (if (ariaIds.size > 0) Seq(Symbol("aria-describedby") -> ariaIds.mkString(" ")) else Nil) ++ - (if (hasErrors) Seq(Symbol("aria-invalid") -> "true") else Nil) ++ - BSFieldInfo.constraintsArgs(field, msgsProv) ++ - Args.inner( - Args.remove(args, 'id, 'value).map { - case arg if arg._1 == 'placeholder => Args.msg(arg)(msgsProv.messages) - case other => other - } - ) - ).toMap - } - - /** - * Companion object for class B3FieldInfo - */ - object B3FieldInfo { - /* The optional validation state ("success", "warning" or "error") */ - def status(hasErrors: Boolean, argsMap: Map[Symbol, Any]): Option[String] = { - if (hasErrors) - Some("error") - else if (ArgsMap.isNotFalse(argsMap, '_warning) || isTrue(argsMap, '_showIconWarning)) - Some("warning") - else if (ArgsMap.isNotFalse(argsMap, '_success) || isTrue(argsMap, '_showIconValid)) - Some("success") - else - None - } - - /* The optional validation state for the form-group ("has-success", "has-warning", "has-error") with the optional "has-feedback" */ - def statusWithFeedback(status: Option[String], hasFeedback: Boolean): Option[String] = status.map { "has-" + _ + (if (hasFeedback) " has-feedback" else "") } - - } - - /** - * Class with relevant variables for the global information of a multifield - * - fields: list of Fields - * - args: list of available arguments for the helper and the form-group - */ - case class B3MultifieldInfo(fields: Seq[Field], globalArguments: Seq[(Symbol, Any)], fieldsArguments: Seq[(Symbol, Any)], override val msgsProv: MessagesProvider) extends BSMultifieldInfo(fields, globalArguments, fieldsArguments, msgsProv) { - - /* List with every "info" */ - val infos: Seq[String] = { - val globalFeedbackInfosButErrors = BSFieldInfo.feedbackInfosButErrors(argsMap, msgsProv) - if (globalFeedbackInfosButErrors.size > 0) - globalFeedbackInfosButErrors - else { - val globalHelpInfos = BSFieldInfo.helpInfos(None, argsMap, msgsProv) - if (globalHelpInfos.size > 0) - globalHelpInfos - else { - fields.flatMap { field => - BSFieldInfo.helpInfos(Some(field), argsMap, msgsProv) - } - } - } - } - - /* List with the errors and infos */ - def errorsAndInfos: Seq[String] = errors ++ infos - - /* The optional validation state ("success", "warning" or "error") */ - override lazy val status: Option[String] = B3FieldInfo.status(hasErrors, argsMap) - - /* The optional validation state for the form-group ("has-success", "has-warning", "has-error") with the optional "has-feedback" */ - def statusWithFeedback: Option[String] = B3FieldInfo.statusWithFeedback(status, hasFeedback = isTrue(argsMap, '_hasFeedback)) - - override lazy val globalArgs = { - val withoutHelp = Args.remove(globalArguments, '_help) - val withStatus = status.map(s => Args.withDefault(withoutHelp, '_class -> statusWithFeedback)).getOrElse(withoutHelp) - withStatus - } - } - - /** - * Custom FieldConstructor for the library. Every FieldConstructor must extend this functionality. - */ - trait B3FieldConstructor extends BSFieldConstructor[B3FieldInfo] { - /* Define the class of the corresponding form (ex: "form-horizontal", "form-inline", ...) */ - val formClass: String - val withFeedbackIcons: Boolean - } - - /** - * Renders an input form-group using the B3FieldConstructor. - * - withFeedbak: indicates if the feedback icons are allowed - * - withLabelFor: indicates if the label's "for" attribute should be shown - * - args: list of available arguments for the helper and field constructor - * - inputDef: function that returns a Html from a B3FieldInfo that contains all the information about the field - */ - def inputFormGroup(field: Field, withFeedback: Boolean, withLabelFor: Boolean, args: Seq[(Symbol, Any)])(inputDef: B3FieldInfo => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = - inputFormField(B3FieldInfo(field, withFeedback, withLabelFor, Args.withoutNones(args), msgsProv))(inputDef)(fc) - - /** - * Renders a form-group using the B3FieldConstructor. - * - args: list of available arguments for the helper and the form-group - * - contentDef: function that returns a Html from a map of arguments - */ - def freeFormGroup(args: Seq[(Symbol, Any)])(contentDef: Map[Symbol, Any] => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = - freeFormField(args)(contentDef)(fc, msgsProv) - - def multifieldFormGroup(fields: Seq[Field], globalArgs: Seq[(Symbol, Any)], fieldsArgs: Seq[(Symbol, Any)])(contentDef: B3MultifieldInfo => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = - multifieldFormField(B3MultifieldInfo(fields, globalArgs, fieldsArgs, msgsProv))(contentDef)(fc) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def inputType(inputType: String, field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputWrapped(inputType, field, args: _*)(html => html)(fc, msgsProv) - - def text(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("text", field, args: _*)(fc, msgsProv) - def password(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("password", field.copy(value = Some("")), args: _*)(fc, msgsProv) - def color(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("color", field, args: _*)(fc, msgsProv) - def date(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("date", field, args: _*)(fc, msgsProv) - def datetime(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("datetime", field, args: _*)(fc, msgsProv) - def datetimeLocal(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("datetime-local", field, args: _*)(fc, msgsProv) - def email(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("email", field, args: _*)(fc, msgsProv) - def month(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("month", field, args: _*)(fc, msgsProv) - def number(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("number", field, args: _*)(fc, msgsProv) - def range(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("range", field, args: _*)(fc, msgsProv) - def search(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("search", field, args: _*)(fc, msgsProv) - def tel(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("tel", field, args: _*)(fc, msgsProv) - def time(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("time", field, args: _*)(fc, msgsProv) - def url(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("url", field, args: _*)(fc, msgsProv) - def week(field: Field, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = inputType("week", field, args: _*)(fc, msgsProv) - - def hidden(name: String, value: Any, args: (Symbol, Any)*) = hiddenInput(name, value, args: _*) - def hidden(field: Field, args: (Symbol, Any)*) = hiddenInput(name = field.name, value = field.value.orElse(bs.Args.get(args, 'value)), (bs.Args.inner(bs.Args.remove(args, 'value))): _*) - - def radio(field: Field, args: (Symbol, Any)*)(content: Tuple3[Boolean, Boolean, B3FieldInfo] => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = radioWithContent(field, args: _*)(content)(fc, msgsProv) - def radio(field: Field, options: Seq[(String, Any)], args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = radioWithOptions(field, options, args: _*)(fc, msgsProv) - - def select(field: Field, args: (Symbol, Any)*)(content: Set[String] => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = selectWithContent(field, args: _*)(content)(fc, msgsProv) - def select(field: Field, options: Seq[(String, String)], args: (Symbol, Any)*)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = selectWithOptions(field, options, args: _*)(fc, msgsProv) - - def submit(args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = buttonType("submit", args: _*)(text)(fc, msgsProv) - def reset(args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = buttonType("reset", args: _*)(text)(fc, msgsProv) - def button(args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = buttonType("button", args: _*)(text)(fc, msgsProv) - - def static(args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = staticBasic(args: _*)(text)(fc, msgsProv) - def static(label: String, args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = staticBasic(Args.withDefault(args, '_label -> label): _*)(text)(fc, msgsProv) - def static(label: Html, args: (Symbol, Any)*)(text: => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = staticBasic(Args.withDefault(args, '_label -> label): _*)(text)(fc, msgsProv) - - def free(args: (Symbol, Any)*)(content: => Html)(implicit fc: B3FieldConstructor, msgsProv: MessagesProvider) = freeFormGroup(args)(_ => content)(fc, msgsProv) -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/radioOption.scala.html b/play26-bootstrap3/module/app/views/b3/radioOption.scala.html deleted file mode 100644 index 3209309..0000000 --- a/play26-bootstrap3/module/app/views/b3/radioOption.scala.html +++ /dev/null @@ -1,16 +0,0 @@ -@(inputValue: Any, label: Any, args: (Symbol, Any)*)(implicit extraInfo: (Boolean, Boolean, B3FieldInfo), fc: B3FieldConstructor, messages: MessagesProvider) -@displayInput(labelClass: String, fieldInfo: b3.B3FieldInfo) = { - -} -@defining(extraInfo) { case (inline, disabled, fieldInfo) => - @if(inline) { - @displayInput(labelClass = "radio-inline" + (if (disabled) " disabled" else ""), fieldInfo) - } else { -
- @displayInput(labelClass = "", fieldInfo) -
- } -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/radioWithContent.scala.html b/play26-bootstrap3/module/app/views/b3/radioWithContent.scala.html deleted file mode 100644 index c94cfe1..0000000 --- a/play26-bootstrap3/module/app/views/b3/radioWithContent.scala.html +++ /dev/null @@ -1,22 +0,0 @@ -@(field: Field, args: (Symbol, Any)*)(content: Tuple3[Boolean, Boolean, b3.B3FieldInfo] => Html)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@readonlyWrapper(name: String, value: Option[String], argsMap: Map[Symbol, Any], disabled: Boolean)(contentWrapped: Html) = { - @if(argsMap.contains('readonly)) { -
- @contentWrapped - -
- } else { @contentWrapped } -} -@defining({ - val argsMap = args.toMap - val inline = bs.ArgsMap.isTrue(argsMap, '_inline) || fc.formClass == "form-inline" - val readonly = bs.ArgsMap.isTrue(argsMap, 'readonly) - val disabled = readonly || bs.ArgsMap.isTrue(argsMap, 'disabled) - (argsMap, inline, disabled) -}) { case (argsMap, inline, disabled) => - @inputFormGroup(field, withFeedback = false, withLabelFor = false, bs.Args.withDefault(args, 'disabled -> disabled)) { fieldInfo => - @readonlyWrapper(fieldInfo.name, fieldInfo.value, argsMap, disabled) { - @content(inline, disabled, fieldInfo) - } - }(fc, messages) -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/radioWithOptions.scala.html b/play26-bootstrap3/module/app/views/b3/radioWithOptions.scala.html deleted file mode 100644 index f44bbee..0000000 --- a/play26-bootstrap3/module/app/views/b3/radioWithOptions.scala.html +++ /dev/null @@ -1,6 +0,0 @@ -@(field: Field, options: Seq[(String, Any)], args: (Symbol, Any)*)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@radioWithContent(field, bs.Args.withDefault(args, '_hiddenValue -> options.headOption.map(_._1)):_*) { implicit extraInfo => - @options.map { v => - @radioOption(v._1, bs.Args.msg(v._2)(messages)) - } -}(fc, messages) \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/selectOption.scala.html b/play26-bootstrap3/module/app/views/b3/selectOption.scala.html deleted file mode 100644 index b32cf24..0000000 --- a/play26-bootstrap3/module/app/views/b3/selectOption.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(value: Any, name: Any, args: (Symbol, Any)*)(implicit values: Set[String], messages: MessagesProvider) - \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/selectWithContent.scala.html b/play26-bootstrap3/module/app/views/b3/selectWithContent.scala.html deleted file mode 100644 index 5300b35..0000000 --- a/play26-bootstrap3/module/app/views/b3/selectWithContent.scala.html +++ /dev/null @@ -1,35 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(content: Set[String] => Html)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@readonlyWrapper(selectName: String, value: Option[String], disabled: Boolean, argsMap: Map[Symbol, Any])(contentWrapped: Html) = { - @if(argsMap.contains('readonly)) { -
- @contentWrapped - -
- } else { @contentWrapped } -} -@defining({ - val argsMap = args.toMap - val readonly = bs.ArgsMap.isTrue(argsMap, 'readonly) - val disabled = readonly || bs.ArgsMap.isTrue(argsMap, 'disabled) - val multiple = bs.ArgsMap.isTrue(argsMap, 'multiple) - (argsMap, disabled, multiple) -}) { case (argsMap, disabled, multiple) => - @inputFormGroup(field, withFeedback = false, withLabelFor = true, bs.Args.withDefault(bs.Args.withAddingStringValue(args, 'class, "form-control"), 'disabled -> disabled)) { fieldInfo => - @defining( if(multiple) "%s[]".format(fieldInfo.name) else fieldInfo.name ) { selectName => - @defining( ( !field.indexes.isEmpty && multiple ) match { - case true => field.indexes.map( i => field("[%s]".format(i)).value ).flatten.toSet - case _ if multiple && fieldInfo.value.isDefined => fieldInfo.value.get.split(",").toSet - case _ => fieldInfo.value.toSet - }){ implicit values => - @readonlyWrapper(selectName, fieldInfo.value, disabled, argsMap) { - - } - } - } - }(fc, messages) -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/selectWithOptions.scala.html b/play26-bootstrap3/module/app/views/b3/selectWithOptions.scala.html deleted file mode 100644 index 1b81b79..0000000 --- a/play26-bootstrap3/module/app/views/b3/selectWithOptions.scala.html +++ /dev/null @@ -1,6 +0,0 @@ -@(field: Field, options: Seq[(String,String)], args: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@selectWithContent(field, bs.Args.withDefault(args, '_hiddenValue -> bs.Args.get(args, '_default).map(bs.Args.msg(_)(messages)).orElse(options.headOption.map(_._1))):_*) { implicit values => - @options.map { v => - @selectOption(v._1, bs.Args.msg(v._2)(messages)) - } -}(fc, messages) \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/staticBasic.scala.html b/play26-bootstrap3/module/app/views/b3/staticBasic.scala.html deleted file mode 100644 index 6e72d44..0000000 --- a/play26-bootstrap3/module/app/views/b3/staticBasic.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(args: (Symbol,Any)*)(text: => Html)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@freeFormGroup(bs.Args.withAddingStringValue(args, 'class, "form-control-static")) { innerArgsMap => -

@text

-}(fc, messages) \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/textarea.scala.html b/play26-bootstrap3/module/app/views/b3/textarea.scala.html deleted file mode 100644 index b1370eb..0000000 --- a/play26-bootstrap3/module/app/views/b3/textarea.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, messages: MessagesProvider) -@inputFormGroup(field, withFeedback = false, withLabelFor = true, bs.Args.withAddingStringValue(args, 'class, "form-control")) { fieldInfo => - -}(fc, messages) \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/vertical/bsFieldConstructor.scala.html b/play26-bootstrap3/module/app/views/b3/vertical/bsFieldConstructor.scala.html deleted file mode 100644 index 5bef86d..0000000 --- a/play26-bootstrap3/module/app/views/b3/vertical/bsFieldConstructor.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html)(implicit fc: b3.B3FieldConstructor, msgsProv: MessagesProvider) -@b3.bsFieldConstructorCommon(fieldInfo, inputHtml) { content => - @fieldInfo.labelOpt.map { label => - - } - @content -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/vertical/bsFormGroup.scala.html b/play26-bootstrap3/module/app/views/b3/vertical/bsFormGroup.scala.html deleted file mode 100644 index f78da2a..0000000 --- a/play26-bootstrap3/module/app/views/b3/vertical/bsFormGroup.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit messages: MessagesProvider) -@b3.bsFormGroupCommon(contentHtml, argsMap) { content => - @argsMap.get('_label).map { label => - - } - @content -} \ No newline at end of file diff --git a/play26-bootstrap3/module/app/views/b3/vertical/package.scala b/play26-bootstrap3/module/app/views/b3/vertical/package.scala deleted file mode 100644 index cdc7442..0000000 --- a/play26-bootstrap3/module/app/views/b3/vertical/package.scala +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -package object vertical { - - import play.twirl.api.Html - import play.api.mvc.{ Call, RequestHeader } - import play.api.i18n.MessagesProvider - import views.html.helper._ - import views.html.bs.Args.{ inner, isTrue } - - /** - * Declares the class for the Vertical FieldConstructor. - */ - class VerticalFieldConstructor(val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* Define the class of the corresponding form */ - val formClass = "form-vertical" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit msgsProv: MessagesProvider) = bsFieldConstructor(fieldInfo, inputHtml)(this, msgsProv) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit msgsProv: MessagesProvider) = bsFormGroup(contentHtml, argsMap)(msgsProv) - } - - /** - * Creates a new VerticalFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific VerticalFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - def fieldConstructorSpecific(withFeedbackIcons: Boolean = false): VerticalFieldConstructor = - new VerticalFieldConstructor(withFeedbackIcons) - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - def fieldConstructor(withFeedbackIcons: Boolean = false): B3FieldConstructor = - fieldConstructorSpecific(withFeedbackIcons) - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: VerticalFieldConstructor => Html) = { - val vfc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.form(action, args: _*)(body(vfc))(vfc) - } - def formCSRF(action: Call, args: (Symbol, Any)*)(body: VerticalFieldConstructor => Html)(implicit request: RequestHeader) = { - val vfc = fieldConstructorSpecific(withFeedbackIcons = isTrue(args, '_feedbackIcons)) - views.html.b3.formCSRF(action, args: _*)(body(vfc))(vfc, request) - } - -} \ No newline at end of file diff --git a/play26-bootstrap3/module/build.sbt b/play26-bootstrap3/module/build.sbt deleted file mode 100644 index 055712b..0000000 --- a/play26-bootstrap3/module/build.sbt +++ /dev/null @@ -1,70 +0,0 @@ -name := """play-bootstrap""" - -version := "1.4-P26-B3-SNAPSHOT" - -scalaVersion := "2.12.4" - -crossScalaVersions := Seq("2.12.4", "2.11.12") - -resolvers ++= Seq( - "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases", - "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" -) - -libraryDependencies ++= Seq( - filters % "provided", - "com.adrianhurt" %% "play-bootstrap-core" % "1.4-P26-SNAPSHOT", - specs2 % Test -) - -lazy val root = (project in file(".")).enablePlugins(PlayScala).disablePlugins(PlayFilters) - - - -scalariformSettings - -//******************************* -// Maven settings -//******************************* - -sonatypeSettings - -publishMavenStyle := true - -organization := "com.adrianhurt" - -description := "This is a collection of input helpers and field constructors for Play Framework to render Bootstrap HTML code." - -homepage := Some(url("https://adrianhurt.github.io/play-bootstrap")) - -licenses := Seq("Apache License" -> url("https://github.com/adrianhurt/play-bootstrap/blob/master/LICENSE")) - -startYear := Some(2014) - -publishTo := { - val nexus = "https://oss.sonatype.org/" - if (isSnapshot.value) - Some("snapshots" at nexus + "content/repositories/snapshots") - else - Some("releases" at nexus + "service/local/staging/deploy/maven2") -} - -publishArtifact in Test := false - -pomIncludeRepository := { _ => false } - -pomExtra := ( - - git@github.com:adrianhurt/play-bootstrap.git - scm:git:git@github.com:adrianhurt/play-bootstrap.git - - - - adrianhurt - Adrian Hurtado - https://github.com/adrianhurt - - -) - -credentials += Credentials(Path.userHome / ".sbt" / "sonatype.credentials") diff --git a/play26-bootstrap3/module/project/build.properties b/play26-bootstrap3/module/project/build.properties deleted file mode 100644 index 249672c..0000000 --- a/play26-bootstrap3/module/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Activator-generated Properties -#Mon Aug 11 18:06:16 BST 2014 -template.uuid=688014f0-0585-43e3-a9fa-d62f7d12f1ab -sbt.version=0.13.17 diff --git a/play26-bootstrap3/module/project/plugins.sbt b/play26-bootstrap3/module/project/plugins.sbt deleted file mode 100644 index 69d2bb6..0000000 --- a/play26-bootstrap3/module/project/plugins.sbt +++ /dev/null @@ -1,12 +0,0 @@ -resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" - -// The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12") - -// web plugins - -addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") - -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.2") - -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") diff --git a/play26-bootstrap3/module/test/FieldConstructorsSpec.scala b/play26-bootstrap3/module/test/FieldConstructorsSpec.scala deleted file mode 100644 index 36f418c..0000000 --- a/play26-bootstrap3/module/test/FieldConstructorsSpec.scala +++ /dev/null @@ -1,232 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -import views.html.b3 -import TestUtils._ -import org.specs2.mutable.Specification -import views.html.helper.FieldConstructor -import play.api.data.Forms._ -import play.api.data._ -import play.api.{ Configuration, Environment } -import play.api.http.HttpConfiguration -import play.api.i18n.{ DefaultLangsProvider, DefaultMessagesApiProvider, MessagesProvider } -import play.twirl.api.Html -import play.api.mvc.Call - -object FieldConstructorsSpec extends Specification { - - val environment = Environment.simple() - val conf = Configuration.reference - val langs = new DefaultLangsProvider(conf).get - - val httpConfiguration = HttpConfiguration.fromConfiguration(conf, environment) - val messagesApi = new DefaultMessagesApiProvider(environment, conf, langs, httpConfiguration).get - implicit val msgsProv: MessagesProvider = messagesApi.preferred(Seq.empty) - - def testFielConstructor(fcDefault: B3FieldConstructor, fcWithFeedbackIcons: B3FieldConstructor) = { - implicit val fc = fcDefault - val testInputString = "" - def testInput(field: Field, args: (Symbol, Any)*) = - b3.inputFormGroup(field, false, true, args) { _ => Html(testInputString) } - - val fooForm = Form(single("foo" -> Forms.nonEmptyText(maxLength = 8))) - val fooField = fooForm("foo") - - val simpleInput = testInput(fooField).body - def simpleInputWithArgs(args: (Symbol, Any)*)(implicit fc: B3FieldConstructor) = b3.text(fooField, args: _*).body - def simpleInputWithError(args: (Symbol, Any)*)(implicit fc: B3FieldConstructor) = b3.text(fooForm.withError("foo", "test-error-0").withError("foo", "test-error-1")("foo"), args: _*).body - - val labelExtraClasses = fc match { - case hfc: b3.horizontal.HorizontalFieldConstructor => " " + hfc.colLabel - case _ => "" - } - - "have the basic structure" in { - simpleInput must contain("class=\"form-group") - simpleInput must not contain ("has-error") - simpleInput must not contain ("aria-invalid") - simpleInput must contain(testInputString) - simpleInput must not contain ("class=\"help-block\"") - } - - "have a default id" in { - simpleInput must contain("id=\"foo_field\"") - } - - "allow setting a custom id" in { - simpleInputWithArgs('_id -> "customid") must contain("id=\"customid\"") - } - - "allow setting extra classes form-group" in { - clean(simpleInputWithArgs('_class -> "extra_class another_class")) must contain(s"""
"theLabel")) must contain(s"""""") - } - - "allow hide the label" in { - val labelString = s"""""" - clean(simpleInputWithArgs('_label -> "theLabel", '_hideLabel -> true)) must contain(labelString) - clean(simpleInputWithArgs('_hiddenLabel -> "theLabel")) must contain(labelString) - } - - "allow render without label" in { - simpleInputWithArgs() must not contain ("label") - } - - "allow rendering errors" in { - val test = simpleInputWithError() - test must contain("has-error") - test must contain("test-error-0") - test must contain("test-error-1") - } - - "allow showing constraints" in { - val test = simpleInputWithArgs('_showConstraints -> true) - test must contain("") - test must contain("") - test must contain("class=\"help-block\">" + msgsProv.messages("constraint.required") + "") - test must contain("class=\"help-block\">" + msgsProv.messages("constraint.maxLength", 8) + "") - } - - "allow showing help info" in { - simpleInputWithArgs('_help -> "test-help") must contain("test-help") - simpleInputWithArgs('_success -> "test-help") must contain("test-help") - simpleInputWithArgs('_warning -> "test-help") must contain("test-help") - simpleInputWithArgs('_error -> "test-help") must contain("test-help") - } - - "allow rendering erros and hide constraints when help info is present" in { - val test = simpleInputWithError('_showConstraints -> true, '_help -> "test-help") - test must contain("test-error-0") - test must contain("test-error-1") - test must contain("test-help") - test must not contain (" "ok" - case "warning" => "warning-sign" - case "error" => "remove" - } - - def withFeedbackIcon(status: String) = contain(clean(s""" - - ($status)""" - )) - def testStatus(status: String, withIcon: Boolean, args: (Symbol, Any)*)(implicit fc: B3FieldConstructor) = { - val test = clean(simpleInputWithArgs(args: _*)) - test must withStatus(status, withIcon) - if (withIcon) { - test must withFeedbackIcon(status) - } else { - test must not(withFeedbackIcon(status)) - } - } - - testStatus("success", withIcon = false, '_success -> true) - testStatus("success", withIcon = false, '_success -> "test-help") - testStatus("warning", withIcon = false, '_warning -> true) - testStatus("warning", withIcon = false, '_warning -> "test-help") - testStatus("error", withIcon = false, '_error -> true) - testStatus("error", withIcon = false, '_error -> "test-help") - - "with feedback icons" in { - testStatus("success", withIcon = true, '_showIconValid -> true) - testStatus("success", withIcon = true, '_success -> "test-help", '_showIconValid -> true) - testStatus("warning", withIcon = true, '_showIconWarning -> true) - testStatus("warning", withIcon = true, '_warning -> "test-help", '_showIconWarning -> true) - testStatus("error", withIcon = true, '_error -> true, '_showIconOnError -> true) - testStatus("error", withIcon = true, '_error -> "test-help", '_showIconOnError -> true) - } - - "with automatic feedback icons" in { - testStatus("success", withIcon = true, '_success -> "test-help")(fcWithFeedbackIcons) - testStatus("warning", withIcon = true, '_warning -> "test-help")(fcWithFeedbackIcons) - testStatus("error", withIcon = true, '_error -> true)(fcWithFeedbackIcons) - testStatus("error", withIcon = true, '_error -> "test-help")(fcWithFeedbackIcons) - } - } - - "render aria attributes" in { - val test0 = simpleInputWithArgs() - test0 must not contain ("aria-invalid") - test0 must not contain ("aria-describedby") - test0 must not contain (" true, '_showIconOnError -> true) - test1 must contain("aria-invalid=\"true\"") - test1 must contain("aria-describedby=\"foo_status foo_info_0 foo_info_1 foo_error_0 foo_error_1\"") - test1 must contain(" "test-help", '_showIconValid -> true) - test2 must not contain ("aria-invalid") - test2 must contain("aria-describedby=\"foo_status foo_info_0\"") - test2 must contain(" Forms.text))("foo"), '_label -> "theLabel").body - body must contain(colLabel) - body must contain(colInput) - } - } - - "vertical field constructor" should { - implicit val verticalFieldConstructor = new b3.vertical.VerticalFieldConstructor() - val fcWithFeedbackIcons = new b3.vertical.VerticalFieldConstructor(withFeedbackIcons = true) - testFielConstructor(verticalFieldConstructor, fcWithFeedbackIcons) - } - - "inline field constructor" should { - implicit val inlineFieldConstructor = new b3.inline.InlineFieldConstructor() - val fcWithFeedbackIcons = new b3.inline.InlineFieldConstructor(withFeedbackIcons = true) - testFielConstructor(inlineFieldConstructor, fcWithFeedbackIcons) - } - - "clear field constructor" should { - implicit val clearFieldConstructor = b3.clear.fieldConstructor() - - "simply render the input" in { - val simpleInput = b3.text(Form(single("foo" -> Forms.text))("foo")).body.trim - simpleInput must startWith("") - // Make sure it doesn't have it twice - simpleInput.substring(simpleInput.indexOf(">") + 1) must not contain (">") - } - } -} diff --git a/play26-bootstrap3/module/test/FormsSpec.scala b/play26-bootstrap3/module/test/FormsSpec.scala deleted file mode 100644 index eaf29d3..0000000 --- a/play26-bootstrap3/module/test/FormsSpec.scala +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -import views.html.b3 -import TestUtils._ -import org.specs2.mutable.Specification -import play.api.data.Forms._ -import play.api.data._ -import play.api.{ Configuration, Environment } -import play.api.http.HttpConfiguration -import play.api.i18n.{ DefaultLangsProvider, DefaultMessagesApiProvider, MessagesProvider } -import play.twirl.api.Html -import play.api.mvc.Call - -object FormsSpec extends Specification { - - val environment = Environment.simple() - val conf = Configuration.reference - val langs = new DefaultLangsProvider(conf).get - - val httpConfiguration = HttpConfiguration.fromConfiguration(conf, environment) - val messagesApi = new DefaultMessagesApiProvider(environment, conf, langs, httpConfiguration).get - implicit val msgsProv: MessagesProvider = messagesApi.preferred(Seq.empty) - - val vfc = b3.vertical.fieldConstructor() - val (colLabel, colInput) = ("col-md-2", "col-md-10") - val hfc = b3.horizontal.fieldConstructor(colLabel, colInput) - val ifc = b3.inline.fieldConstructor() - val cfc = b3.clear.fieldConstructor() - - val testContentString = "" - - val (method, action) = ("POST", "/handleRequest") - val fooCall = Call(method, action) - def fooFormBody(args: (Symbol, Any)*)(fc: b3.B3FieldConstructor) = b3.form(fooCall, args: _*)(Html(testContentString))(fc).body - - "@form" should { - - val simple = fooFormBody()(vfc) - - "have action and method" in { - simple must contain("action=\"" + action + "\"") - simple must contain("method=\"" + method + "\"") - } - - "add default class for each field constructor" in { - fooFormBody()(vfc) must contain("class=\"form-vertical") - fooFormBody()(hfc) must contain("class=\"form-horizontal") - fooFormBody()(ifc) must contain("class=\"form-inline") - fooFormBody()(cfc) must contain("class=\"form-clear") - } - - "allow setting custom class" in { - fooFormBody('class -> "customClass")(vfc) must contain("class=\"form-vertical customClass\"") - } - - "add form role as default" in { - simple must contain("role=\"form\"") - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = fooFormBody('extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test")(vfc) - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - - "render the content body" in { - simple must contain("") - } - } -} diff --git a/play26-bootstrap3/module/test/HelpersSpec.scala b/play26-bootstrap3/module/test/HelpersSpec.scala deleted file mode 100644 index b51790b..0000000 --- a/play26-bootstrap3/module/test/HelpersSpec.scala +++ /dev/null @@ -1,741 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -import views.html.b3 -import TestUtils._ -import org.specs2.mutable.Specification -import views.html.helper._ -import play.api.data.Forms._ -import play.api.data._ -import play.api.{ Configuration, Environment } -import play.api.http.HttpConfiguration -import play.api.i18n.{ DefaultLangsProvider, DefaultMessagesApiProvider, MessagesProvider } -import play.twirl.api.{ Html, HtmlFormat } -import play.api.mvc.Call - -object HelpersSpec extends Specification { - - val environment = Environment.simple() - val conf = Configuration.reference - val langs = new DefaultLangsProvider(conf).get - - val httpConfiguration = HttpConfiguration.fromConfiguration(conf, environment) - val messagesApi = new DefaultMessagesApiProvider(environment, conf, langs, httpConfiguration).get - implicit val msgsProv: MessagesProvider = messagesApi.preferred(Seq.empty) - - val vfc = b3.vertical.fieldConstructor() - val (colLabel, colInput) = ("col-md-2", "col-md-10") - val hfc = b3.horizontal.fieldConstructor(colLabel, colInput) - val ifc = b3.inline.fieldConstructor() - val cfc = b3.clear.fieldConstructor() - - /** - * A test field constructor that simply renders the input - */ - implicit val testFieldConstructor = new B3FieldConstructor { - val formClass = "" - val withFeedbackIcons = false - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit msgsProv: MessagesProvider) = inputHtml - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit msgsProv: MessagesProvider) = contentHtml - } - - val fooField = Form(single("foo" -> Forms.text))("foo") - def fooFieldFilled(v: String) = Form(single("foo" -> Forms.text)).fill(v)("foo") - - "@inputType" should { - - "allow setting a custom id" in { - val body = b3.inputType("text", fooField, 'id -> "someid").body - val idAttr = "id=\"someid\"" - body must contain(idAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(idAttr) + idAttr.length) must not contain (idAttr) - } - - "allow setting a custom type" in { - val body = b3.inputType("email", fooField).body - val typeAttr = "type=\"email\"" - body must contain(typeAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(typeAttr) + typeAttr.length) must not contain (typeAttr) - } - - "add form-control class as default" in { - b3.inputType("text", fooField).body must contain("class=\"form-control\"") - } - - "allow setting additional classes" in { - b3.inputType("text", fooField, 'class -> "extra_class").body must contain("class=\"form-control extra_class\"") - } - - "allow setting a default value" in { - val body = b3.inputType("text", fooField, 'value -> "defaultvalue").body - val valueAttr = "value=\"defaultvalue\"" - body must contain(valueAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(valueAttr) + valueAttr.length) must not contain (valueAttr) - } - - "allow being filled with a value" in { - val body = b3.inputType("text", fooFieldFilled("filledvalue"), 'value -> "defaultvalue").body - val valueAttr = "value=\"filledvalue\"" - body must contain(valueAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(valueAttr) + valueAttr.length) must not contain (valueAttr) - // Make sure it doesn't contain the default value - body must not contain ("value=\"defaultvalue\"") - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = b3.inputType("text", fooField, 'extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test").body - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - } - - val sampleArgs = Seq[(Symbol, Any)]('id -> "someid", 'foo -> "fooValue") - def sampleInputTypeBody(theType: String) = b3.inputType(theType, fooField, sampleArgs: _*).body.trim - - "@text" should { - "be equivalent to inputType with text type" in { - b3.text(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("text") - } - } - "@password" should { - "be equivalent to inputType with password type" in { - b3.password(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("password") - } - "not display its value" in { - b3.password(fooFieldFilled("barValue"), sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("password") - } - } - "@file" should { - "be equivalent to inputType with file type" in { - b3.file(fooField, (('class -> "form-control") +: sampleArgs): _*).body.trim must be equalTo sampleInputTypeBody("file") - } - } - - "@textarea" should { - - "allow setting a custom id" in { - val body = b3.textarea(fooField, 'id -> "someid").body - val idAttr = "id=\"someid\"" - body must contain(idAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(idAttr) + idAttr.length) must not contain (idAttr) - } - - "add form-control class as default" in { - b3.textarea(fooField).body must contain("class=\"form-control\"") - } - - "allow setting additional classes" in { - b3.textarea(fooField, 'class -> "extra_class").body must contain("class=\"form-control extra_class\"") - } - - "allow setting a default value" in { - val body = b3.textarea(fooField, 'value -> "defaultvalue").body - body must contain(">defaultvalue") - body must not contain ("value=\"defaultvalue\"") - } - } - - "@checkbox" should { - - val boolField = Form(single("foo" -> Forms.boolean))("foo") - def boolFieldFilled(v: Boolean) = Form(single("foo" -> Forms.boolean)).fill(v)("foo") - def stringFieldFilled(v: String) = Form(single("foo" -> Forms.text)).fill(v)("foo") - - "allow setting a custom id" in { - val body = b3.checkbox(boolField, 'id -> "someid").body - val idAttr = "id=\"someid\"" - body must contain(idAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(idAttr) + idAttr.length) must not contain (idAttr) - } - - "be unchecked by default" in { - val body = b3.checkbox(boolField).body - body must not contain ("checked") - body must contain("value=\"true\"") - } - - "allow setting a default custom value" in { - val body = b3.checkbox(boolField, 'value -> "bar").body - body must not contain ("checked") - body must contain("value=\"bar\"") - } - - "allow setting a default value for checked attribute" in { - val body = b3.checkbox(boolField, '_default -> true).body - body must contain("checked") - body must contain("value=\"true\"") - } - - "allow setting a default value for checked attribute with a custom value" in { - val body = b3.checkbox(boolField, 'value -> "bar", '_default -> true).body - body must contain("checked") - body must contain("value=\"bar\"") - } - - "allow being filled with a value" in { - val body = b3.checkbox(boolFieldFilled(true)).body - body must contain("checked") - body must contain("value=\"true\"") - } - - "allow being filled with a custom value" in { - val body = b3.checkbox(stringFieldFilled("bar"), 'value -> "bar").body - body must contain("checked") - body must contain("value=\"bar\"") - } - - "ignore default checked value if it is filled" in { - val body1 = b3.checkbox(boolFieldFilled(false), '_default -> true).body - body1 must not contain ("checked") - body1 must contain("value=\"true\"") - val body2 = b3.checkbox(stringFieldFilled(""), 'value -> "bar", '_default -> true).body - body2 must not contain ("checked") - body2 must contain("value=\"bar\"") - } - - "allow setting a forced value for checked attribute (always true)" in { - val body = b3.checkbox(boolField, 'checked -> true).body - body must contain("checked") - body must contain("value=\"true\"") - } - "allow setting a forced value for checked attribute (always false)" in { - val body = b3.checkbox(boolField, 'checked -> false).body - body must not contain ("checked") - body must contain("value=\"true\"") - } - - "add support to readonly attribute" in { - val bodyWithoutReadonly = b3.checkbox(boolField, 'value -> true).body - bodyWithoutReadonly must contain("
false, 'value -> true).body - bodyReadonlyFalse must contain("
") - - val bodyReadonlyTrue = b3.checkbox(boolField, 'readonly -> true, 'value -> true).body - bodyReadonlyTrue must contain("
") - bodyReadonlyTrue must contain("disabled=\"true\"") - bodyReadonlyTrue must contain("") - } - } - - "@radio" should { - - val fruits = Seq("A" -> "Apples", "P" -> "Pears", "B" -> "Bananas") - - "allow setting a custom id" in { - val body = b3.radio(fooField, fruits, 'id -> "someid").body - body must contain("id=\"someid_A\"") - body must contain("id=\"someid_P\"") - body must contain("id=\"someid_B\"") - } - - "be unchecked by default" in { - b3.radio(fooField, fruits).body must not contain ("checked") - } - - "allow setting a default value" in { - val body = b3.radio(fooField, fruits, 'value -> "B").body - val checkedAttr = "checked" - body must contain(checkedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(checkedAttr) + checkedAttr.length) must not contain (checkedAttr) - } - - "allow being filled with a value" in { - val body = b3.radio(fooFieldFilled("B"), fruits).body - val checkedAttr = "checked" - body must contain(checkedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(checkedAttr) + checkedAttr.length) must not contain (checkedAttr) - } - - "not be inline by default" in { - b3.radio(fooField, fruits).body must not contain ("radio-inline") - } - - "allow be inline" in { - b3.radio(fooField, fruits, '_inline -> true).body must contain("radio-inline") - } - - "add support to readonly attribute" in { - val bodyWithoutReadonly = b3.radio(fooField, fruits, 'value -> "B").body - bodyWithoutReadonly must not contain ("radio-group") - bodyWithoutReadonly must not contain ("disabled") - bodyWithoutReadonly must not contain (" false, 'value -> "B").body - bodyReadonlyFalse must contain("
") - bodyReadonlyFalse must not contain ("disabled=\"true\"") - bodyReadonlyFalse must contain("
") - - val bodyReadonlyTrue = b3.radio(fooField, fruits, 'readonly -> true, 'value -> "B").body - bodyReadonlyTrue must contain("
") - bodyReadonlyTrue must contain("disabled=\"true\"") - bodyReadonlyTrue must contain("
") - } - } - - "@select" should { - - val fruits = Seq("A" -> "Apples", "P" -> "Pears", "B" -> "Bananas") - - "allow setting a custom id" in { - val body = b3.select(fooField, fruits, 'id -> "someid").body - body must contain("id=\"someid\"") - } - - "add form-control class as default" in { - b3.select(fooField, fruits).body must contain("class=\"form-control\"") - } - - "allow setting additional classes" in { - b3.select(fooField, fruits, 'class -> "extra_class").body must contain("class=\"form-control extra_class\"") - } - - "be unselected by default" in { - b3.select(fooField, fruits).body must not contain ("selected") - } - - "allow setting a default value" in { - val body = b3.select(fooField, fruits, 'value -> "B").body - val selectedAttr = "selected" - body must contain(selectedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(selectedAttr) + selectedAttr.length) must not contain (selectedAttr) - } - - "allow being filled with a value" in { - val body = b3.select(fooFieldFilled("B"), fruits).body - val selectedAttr = "selected" - body must contain(selectedAttr) - // Make sure it doesn't have it twice - body.substring(body.indexOf(selectedAttr) + selectedAttr.length) must not contain (selectedAttr) - } - - "add support to readonly attribute" in { - val bodyWithoutReadonly = b3.select(fooField, fruits, 'value -> "B").body - bodyWithoutReadonly must not contain ("
") - bodyWithoutReadonly must not contain ("disabled") - bodyWithoutReadonly must not contain (" false, 'value -> "B").body - bodyReadonlyFalse must contain("
") - bodyReadonlyFalse must not contain ("disabled=\"true\"") - bodyReadonlyFalse must contain("") - - val bodyReadonlyTrue = b3.select(fooField, fruits, 'readonly -> true, 'value -> "B").body - bodyReadonlyTrue must contain("
") - bodyReadonlyTrue must contain("disabled=\"true\"") - bodyReadonlyTrue must contain("") - } - - "allow multiple" in { - val body = b3.select(fooField, fruits, 'multiple -> true, 'value -> "P,B").body - body must contain("multiple=\"true\"") - val selectedAttr = "selected" - body must contain(selectedAttr) - // Make sure it has it twice, but not more. - val restBody = body.substring(body.indexOf(selectedAttr) + selectedAttr.length) - restBody must contain(selectedAttr) - restBody.substring(restBody.indexOf(selectedAttr) + selectedAttr.length) must not contain (selectedAttr) - } - } - - "@hidden" should { - "be rendered correctly" in { - val body = clean(b3.hidden("testName", "testValue", 'foo -> "bar").body) - body must be equalTo """""" - } - "with Field object" in { - val body = clean(b3.hidden(fooField, 'value -> "testValue", 'foo -> "bar").body) - body must be equalTo """""" - } - "with filled Field object" in { - val body = clean(b3.hidden(fooFieldFilled("filledValue"), 'value -> "testValue", 'foo -> "bar").body) - body must be equalTo """""" - } - } - "@hiddens" should { - "be rendered correctly" in { - val body = clean(b3.hiddens("fooId" -> 1L, "barId" -> 2L).body) - body must be equalTo """""" - } - } - - "@color" should { - "be equivalent to inputType with date type" in { - b3.color(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("color") - } - } - "@date" should { - "be equivalent to inputType with date type" in { - b3.date(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("date") - } - } - "@datetime" should { - "be equivalent to inputType with date type" in { - b3.datetime(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("datetime") - } - } - "@datetimeLocal" should { - "be equivalent to inputType with date type" in { - b3.datetimeLocal(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("datetime-local") - } - } - "@email" should { - "be equivalent to inputType with email type" in { - b3.email(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("email") - } - } - "@month" should { - "be equivalent to inputType with date type" in { - b3.month(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("month") - } - } - "@number" should { - "be equivalent to inputType with date type" in { - b3.number(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("number") - } - } - "@range" should { - "be equivalent to inputType with date type" in { - b3.range(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("range") - } - } - "@search" should { - "be equivalent to inputType with date type" in { - b3.search(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("search") - } - } - "@tel" should { - "be equivalent to inputType with date type" in { - b3.tel(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("tel") - } - } - "@time" should { - "be equivalent to inputType with date type" in { - b3.time(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("time") - } - } - "@url" should { - "be equivalent to inputType with date type" in { - b3.url(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("url") - } - } - "@week" should { - "be equivalent to inputType with date type" in { - b3.week(fooField, sampleArgs: _*).body.trim must be equalTo sampleInputTypeBody("week") - } - } - - "@formGroup" should { - - def testFormGroup(args: (Symbol, Any)*)(fc: b3.B3FieldConstructor, msgsProv: MessagesProvider) = - clean(b3.freeFormGroup(args)(innerArgs => Html(""))(fc, msgsProv).body) - - "vertical: show label" in { - testFormGroup('_class -> "theClass", '_id -> "theId", '_label -> "theLabel")(vfc, msgsProv) must be equalTo clean(""" -
- - -
- """) - } - "vertical: without label" in { - testFormGroup('_class -> "theClass", '_id -> "theId")(vfc, msgsProv) must be equalTo clean(""" -
- -
- """) - } - "horizontal: show label" in { - testFormGroup('_class -> "theClass", '_id -> "theId", '_label -> "theLabel")(hfc, msgsProv) must be equalTo clean(""" -
- -
- -
-
- """) - } - "horizontal: without label" in { - testFormGroup('_class -> "theClass", '_id -> "theId")(hfc, msgsProv) must be equalTo clean(""" -
-
- -
-
- """) - } - "inline: show label" in { - testFormGroup('_class -> "theClass", '_id -> "theId", '_label -> "theLabel")(ifc, msgsProv) must be equalTo clean(""" -
- - -
- """) - } - "inline: without label" in { - testFormGroup('_class -> "theClass", '_id -> "theId")(ifc, msgsProv) must be equalTo clean(""" -
- -
- """) - } - - "get the inner arguments for the content" in { - val body = b3.freeFormGroup(Seq('_class -> "theClass", '_underscored -> "underscored", 'foo -> "foo"))(innerArgsMap => Html(innerArgsMap.toSeq.map(a => s"""${a._1.name}="${a._2.toString}"""").mkString("")))(vfc, msgsProv).body - body must not contain "_class=\"theClass\"" - body must not contain "_underscored=\"underscored\"" - body must contain("foo=\"foo\"") - } - } - - "@free" should { - "be rendered correctly" in { - clean(b3.free('foo -> "fooValue")(Html(""))(vfc, msgsProv).body) must be equalTo clean(b3.freeFormGroup(Seq('foo -> "fooValue"))(_ => Html(""))(vfc, msgsProv).body) - } - } - - "@static" should { - - "render with form-control-static class as default" in { - b3.static("theLabel")(Html("theText"))(vfc, msgsProv).body must contain("

theText

") - } - - "allow setting additional classes" in { - b3.static("theLabel", 'class -> "extra_class")(Html("theText"))(vfc, msgsProv).body must contain("

theText

") - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = b3.static("theLabel", 'extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test")(Html("theText"))(vfc, msgsProv).body - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - } - - "@buttonType" should { - - val sampleType = "myButtonType" - val sampleContent = "sample-content" - def buttonTypeBody(args: (Symbol, Any)*) = b3.buttonType(sampleType, args: _*)(Html(sampleContent))(vfc, msgsProv).body - - "allow setting a custom type" in { - val body = buttonTypeBody() - val typeAttr = "type=\"" + sampleType + "\"" - body must contain(typeAttr) - // Make sure it doesn't contain it twice - body.substring(body.indexOf(typeAttr) + typeAttr.length) must not contain (typeAttr) - } - "render content" in { - buttonTypeBody() must contain(sampleContent) - } - - "allow setting extra arguments and remove those arguments with false values or with underscored names" in { - val body = buttonTypeBody('extra_attr -> "test", 'true_attr -> true, 'fase_attr -> false, '_underscored_attr -> "test") - body must contain("extra_attr=\"test\"") - body must contain("true_attr=\"true\"") - body must not contain ("false_attr=\"false\"") - body must not contain ("_underscored_attr=\"test\"") - } - - "be rendered correctly" in { - val body = buttonTypeBody('id -> "someid", 'class -> "btn btn-default") - body must contain("") - } - } - - def sampleButtonTypeBody(theType: String) = b3.buttonType(theType, sampleArgs: _*)(Html("content"))(vfc, msgsProv).body.trim - - "@submit" should { - "be equivalent to buttonType with submit type" in { - b3.submit(sampleArgs: _*)(Html("content"))(vfc, msgsProv).body.trim must be equalTo sampleButtonTypeBody("submit") - } - } - "@reset" should { - "be equivalent to buttonType with reset type" in { - b3.reset(sampleArgs: _*)(Html("content"))(vfc, msgsProv).body.trim must be equalTo sampleButtonTypeBody("reset") - } - } - "@button" should { - "be equivalent to buttonType with button type" in { - b3.button(sampleArgs: _*)(Html("content"))(vfc, msgsProv).body.trim must be equalTo sampleButtonTypeBody("button") - } - } - - "@inputWrapped" should { - - "be equivalent to inputType for an empty wrapper" in { - val bodyInputType = clean(b3.inputType("text", fooField, 'id -> "someid").body) - val body = clean(b3.inputWrapped("text", fooField, 'id -> "someid")(x => x).body) - body must be equalTo bodyInputType - } - - "wrap the input" in { - val bodyInputType = clean(b3.inputType("text", fooField, 'id -> "someid").body) - val (wrapperPre, wrapperPost) = ("", "") - def wrap(input: Html) = HtmlFormat.fill(scala.collection.immutable.Seq(Html(wrapperPre), input, Html(wrapperPost))) - val body = clean(b3.inputWrapped("text", fooField, 'id -> "someid")(input => wrap(input)).body) - - val (indexOfWrapperPre, indexOfWrapperPost) = (body.indexOf(wrapperPre), body.indexOf(wrapperPost)) - - body.substring(0, indexOfWrapperPre) must be equalTo bodyInputType.substring(0, indexOfWrapperPre) - body.substring(indexOfWrapperPre, indexOfWrapperPre + wrapperPre.length) must be equalTo wrapperPre - body.substring(indexOfWrapperPre + wrapperPre.length, indexOfWrapperPost) must be equalTo bodyInputType.substring(indexOfWrapperPre, indexOfWrapperPost - wrapperPre.length) - body.substring(indexOfWrapperPost, indexOfWrapperPost + wrapperPost.length) must be equalTo wrapperPost - body.substring(indexOfWrapperPost + wrapperPost.length) must be equalTo bodyInputType.substring(indexOfWrapperPost - wrapperPre.length) - } - } - - "@multifield" should { - - val testInputsString = "" - val fooForm = Form(tuple("foo" -> Forms.nonEmptyText, "bar" -> Forms.nonEmptyText)) - val fooFormWithError = fooForm.withError("foo", "test-error") - - def multifield(form: Form[(String, String)], globalArgs: Seq[(Symbol, Any)] = Seq(), fieldsArgs: Seq[(Symbol, Any)] = Seq())(fc: b3.B3FieldConstructor, msgsProv: MessagesProvider) = - clean(b3.multifield(form("foo"), form("bar"))(globalArgs, fieldsArgs)(cfc => Html(testInputsString))(fc, msgsProv).body) - def fooMultifield(globalArgs: (Symbol, Any)*) = multifield(fooForm, globalArgs)(vfc, msgsProv) - def fooMultifieldWithFielsArgs(fieldsArgs: (Symbol, Any)*) = multifield(fooForm, fieldsArgs = fieldsArgs)(vfc, msgsProv) - - "have the basic structure" in { - val body = fooMultifield('_label -> "theLabel") - body must contain("class=\"form-group") - body must not contain ("has-error") - body must contain("") - body must contain(testInputsString) - body must not contain ("class=\"help-block\"") - } - - "behave as a horizontal field constructor" in { - val body = multifield(fooForm, Seq('_label -> "theLabel"))(hfc, msgsProv) - body must contain("") - body must contain("
") - } - - "allow setting a custom id" in { - fooMultifield('_id -> "customid") must contain("id=\"customid\"") - } - - "allow setting extra classes form-group" in { - fooMultifield('_class -> "extra_class another_class") must contain("class=\"form-group extra_class another_class") - } - - "show label" in { - multifield(fooForm, Seq('_label -> "fooLabel"))(vfc, msgsProv) must contain("") - multifield(fooForm, Seq('_label -> "fooLabel"))(hfc, msgsProv) must contain("") - } - - "without label" in { - multifield(fooForm)(vfc, msgsProv) must not contain ("label") - multifield(fooForm)(hfc, msgsProv) must not contain ("label") - } - - "allow rendering errors" in { - val body = multifield(fooFormWithError)(vfc, msgsProv) - body must contain("has-error") - body must contain("test-error") - } - - "allow showing constraints" in { - multifield(fooForm, fieldsArgs = Seq('_showConstraints -> true))(vfc, msgsProv) must contain("" + msgsProv.messages("constraint.required") + "") - } - - "allow showing help info" in { - fooMultifield('_help -> "test-help") must contain("""test-help""") - fooMultifield('_success -> "test-help") must contain("""test-help""") - fooMultifieldWithFielsArgs('_success -> "test-help") must contain("""test-help""") - fooMultifield('_warning -> "test-help") must contain("""test-help""") - fooMultifieldWithFielsArgs('_warning -> "test-help") must contain("""test-help""") - fooMultifield('_error -> "test-help") must contain("""test-help""") - fooMultifieldWithFielsArgs('_error -> "test-help") must contain("""test-help""") - } - - "render validation states" in { - def withStatus(status: String, withFeedback: Boolean) = contain(s"""
"ok" - case "warning" => "warning-sign" - case "error" => "remove" - } - - def withFeedbackIcon(status: String) = contain(clean(s""" - - ($status)""" - )) - def testStatus(status: String, withIcon: Boolean, withFieldsArgs: Boolean, args: (Symbol, Any)*) = { - val test = if (withFieldsArgs) - clean(b3.multifield(fooForm("foo"))(globalArgs = if (withIcon) Seq('_hasFeedback -> true) else Seq(), fieldsArgs = args)(cfc => b3.text(fooForm("foo"), args: _*))(vfc, msgsProv).body) - else - clean(b3.multifield(fooForm("foo"))(globalArgs = if (withIcon) (('_hasFeedback -> true) +: args) else args, fieldsArgs = Seq())(cfc => b3.text(fooForm("foo"), args: _*))(vfc, msgsProv).body) - test must withStatus(status, withIcon) - if (withIcon) { - test must withFeedbackIcon(status) - } else { - test must not(withFeedbackIcon(status)) - } - } - - testStatus("success", withIcon = false, withFieldsArgs = false, '_success -> true) - testStatus("success", withIcon = false, withFieldsArgs = true, '_success -> true) - testStatus("success", withIcon = false, withFieldsArgs = false, '_success -> "test-help") - testStatus("success", withIcon = false, withFieldsArgs = true, '_success -> "test-help") - testStatus("warning", withIcon = false, withFieldsArgs = false, '_warning -> true) - testStatus("warning", withIcon = false, withFieldsArgs = true, '_warning -> true) - testStatus("warning", withIcon = false, withFieldsArgs = false, '_warning -> "test-help") - testStatus("warning", withIcon = false, withFieldsArgs = true, '_warning -> "test-help") - testStatus("error", withIcon = false, withFieldsArgs = false, '_error -> true) - testStatus("error", withIcon = false, withFieldsArgs = true, '_error -> true) - testStatus("error", withIcon = false, withFieldsArgs = false, '_error -> "test-help") - testStatus("error", withIcon = false, withFieldsArgs = true, '_error -> "test-help") - - "with feedback icons" in { - testStatus("success", withIcon = true, withFieldsArgs = false, '_showIconValid -> true) - testStatus("success", withIcon = true, withFieldsArgs = true, '_showIconValid -> true) - testStatus("success", withIcon = true, withFieldsArgs = false, '_success -> "test-help", '_showIconValid -> true) - testStatus("success", withIcon = true, withFieldsArgs = true, '_success -> "test-help", '_showIconValid -> true) - testStatus("warning", withIcon = true, withFieldsArgs = false, '_showIconWarning -> true) - testStatus("warning", withIcon = true, withFieldsArgs = true, '_showIconWarning -> true) - testStatus("warning", withIcon = true, withFieldsArgs = false, '_warning -> "test-help", '_showIconWarning -> true) - testStatus("warning", withIcon = true, withFieldsArgs = true, '_warning -> "test-help", '_showIconWarning -> true) - testStatus("error", withIcon = true, withFieldsArgs = false, '_error -> true, '_showIconOnError -> true) - testStatus("error", withIcon = true, withFieldsArgs = true, '_error -> true, '_showIconOnError -> true) - testStatus("error", withIcon = true, withFieldsArgs = false, '_error -> "test-help", '_showIconOnError -> true) - testStatus("error", withIcon = true, withFieldsArgs = true, '_error -> "test-help", '_showIconOnError -> true) - } - } - - } -} diff --git a/play26-bootstrap3/module/test/TestUtils.scala b/play26-bootstrap3/module/test/TestUtils.scala deleted file mode 100644 index f189d89..0000000 --- a/play26-bootstrap3/module/test/TestUtils.scala +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package views.html.b3 - -object TestUtils { - - // clean a string removing control characters and extra whitespaces to compare equivalent rendered codes - def clean(str: String) = str.filter(_ >= ' ').replaceAll("\\s+", " ").trim.replaceAll(">\\s+<", "><").replaceAll("\\s+\"", "\"").replaceAll("=\"\\s+", "=\"") - -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/Filters.scala b/play26-bootstrap3/sample/app/Filters.scala deleted file mode 100644 index 578e98d..0000000 --- a/play26-bootstrap3/sample/app/Filters.scala +++ /dev/null @@ -1,7 +0,0 @@ -import play.api.http.HttpFilters -import play.filters.csrf.CSRFFilter -import javax.inject.Inject - -class Filters @Inject() (csrfFilter: CSRFFilter) extends HttpFilters { - def filters = Seq(csrfFilter) -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/assets/javascripts/main.coffee b/play26-bootstrap3/sample/app/assets/javascripts/main.coffee deleted file mode 100644 index 7a9c2a7..0000000 --- a/play26-bootstrap3/sample/app/assets/javascripts/main.coffee +++ /dev/null @@ -1,104 +0,0 @@ - -############################################################################################################ -## Smoth scroll for docs - -scrollWithAnimation = ($id, duration) -> - $('html,body').animate({scrollTop: $id.offset().top - 55}, duration) - -############################################################################################################ -## For readonly example - -disableForm = ($form) -> - $formGroups = $form.find('.form-group:not(.always-editable)') - $formGroups.find('input:not([type="file"], [type="checkbox"], [type="radio"], [type="hidden"])').removeAttr('disabled').attr('readonly', true) - $formGroups.find('input[type="file"], input[type="checkbox"], input[type="radio"], select').attr('disabled', true) - $formGroups.find('.checkbox, .radio, .radio-inline').addClass('disabled') - $formGroups.find('.checkbox-group, .radio-group, .select-group').find('input[type="hidden"]').removeAttr('disabled readonly') - -enableForm = ($form) -> - $formGroups = $form.find('.form-group:not(.always-editable)') - $formGroups.find('input:not([type="file"], [type="checkbox"], [type="radio"], [type="hidden"])').removeAttr('disabled readonly') - $formGroups.find('input[type="file"], input[type="checkbox"], input[type="radio"], select').removeAttr('disabled readonly') - $formGroups.find('.checkbox, .radio, .radio-inline').removeClass('disabled') - $formGroups.find('.checkbox-group, .radio-group, .select-group').find('input[type="hidden"]').removeAttr('readonly').attr('disabled', true) - -############################################################################################################ -## DOCUMENT IS READY - INIT APP -############################################################################################################ -$ -> - - ## For readonly example - $('.btn-readonly-unlock').click (e) -> - if $(this).hasClass('locked') - $(this).removeClass('locked btn-primary').addClass('btn-danger').text('Lock readonly fields') - enableForm($('#form-readonly')) - else - $(this).removeClass('btn-danger').addClass('locked btn-primary').text('Unlock readonly fields') - disableForm($('#form-readonly')) - if /\/readonly\/?\?\w/.test(window.location.href) - params = window.location.href.split('?')[1].split('&') - params = (p.split('=') for p in params) - getParam = (name, params) -> - foundParams = (p for p in params when p[0] == name) - if foundParams.length > 0 then foundParams[0][1] else undefined - text = getParam "text", params - checkbox = getParam "checkbox", params - radio = getParam "radio", params - select = getParam "select", params - if text? or checkbox? or radio? or select? - $data = $('#bound-data') - $data.find('#data-text').text text - $data.find('#data-checkbox').text checkbox - $data.find('#data-radio').text radio - $data.find('#data-select').text select - $data.removeAttr('hidden') - - # Change also the value of its companion input - $('.checkbox-group input[type="checkbox"]').change -> - $(this).parents('.checkbox-group').find('input[type="hidden"]').val $(this).prop('checked') - $('.radio-group input[type="radio"]').change -> - $radioGroup = $(this).parents('.radio-group') - $radioGroup.find('input[type="hidden"]').val $radioGroup.find('input[type="radio"]:checked').val() - $('.select-group select').change -> - $(this).parents('.select-group').find('input[type="hidden"]').val $(this).val() - - $('.input-daterange').datepicker - format: "dd-mm-yyyy" - todayBtn: "linked" - todayHighlight: true - - $('body[tab="docs"]').scrollspy - target: '#sidebar' - offset: 60 - - $('a[href*="#"]:not([href="#"], [href*="#collapse"], [data-toggle])').click (e) -> - if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) - target = $(this.hash) - target = if target.length then target else $('[name=' + this.hash.slice(1) +']') - if (target.length) - scrollWithAnimation(target, 500) - - hash = location.hash - if hash.length > 0 - scrollWithAnimation($(hash), 10) - - - $('.apply-tweak').click (e) -> - if $(this).hasClass('active') - $('.form-inline').removeClass('align-top') - $(this).removeClass('btn-danger').addClass('btn-info') - else - $('.form-inline').addClass('align-top') - $(this).removeClass('btn-info').addClass('btn-danger') - - - - $('.input-number-plus').click (e) -> - $input = $(this).parent().find('input') - current = parseInt $input.val(), 10 - $input.val current+1 - - $('.input-number-minus').click (e) -> - $input = $(this).parent().find('input') - current = parseInt $input.val(), 10 - $input.val current-1 \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/assets/stylesheets/main.less b/play26-bootstrap3/sample/app/assets/stylesheets/main.less deleted file mode 100644 index a791d0c..0000000 --- a/play26-bootstrap3/sample/app/assets/stylesheets/main.less +++ /dev/null @@ -1,286 +0,0 @@ - -@nav-bg-color: #3264C8; -@nav-bg-color-hover: lighten(@nav-bg-color, 5%); -@nav-bg-color-active: lighten(@nav-bg-color, 15%); -@nav-color: #eeeeee; -@nav-color-hover: white; -@nav-color-active: white; -@bg-color: #fbfcfe; -@footer-bg-color: lighten(@nav-bg-color, 45%); - -@code-bg-color: #FFFFF8; - -@play-color: #93D53A; -@boostrap-color: #5C3F83; - -body { - padding-top: 60px; - background-color: @bg-color; -} -.navbar-mixin-active() { - background-color: @nav-bg-color-active; - color: @nav-color-active; -} -.navbar-mixin-hover() { - background-color: @nav-bg-color-hover; - color: white; -} -.navbar-default { - background-color: @nav-bg-color; - .navbar-brand { - color: @nav-color; - &:hover, &:focus { - .navbar-mixin-hover(); - } - &.active { - .navbar-mixin-active(); - } - } - .navbar-nav { - & > li > a { - color: @nav-color; - &:hover, &:focus { - .navbar-mixin-hover(); - } - } - & > .active > a { - &, &:hover, &:focus { - .navbar-mixin-active(); - } - } - & > .open > a { - &, &:hover, &:focus { - .navbar-mixin-active(); - } - } - } - .dropdown-menu { - background-color: @nav-bg-color-active; - & > li > a { - color: @nav-color-active; - &:hover { - .navbar-mixin-hover(); - } - } - } - .github a { - padding-top: 10px; - padding-bottom: 10px; - } - .version-badge .code { - color: white; - } - - a[version] { - padding: 5px 20px; - } - a.legacy { - font-style: italic; - color: #ddd !important; - } -} -.container { - max-width: 960px; -} -.version-badge { - .code { - font-size: 1.1em; - font-weight: bold; - color: @nav-bg-color; - } - .play-bootstrap { - & > span { - font-size: 0.9em; - font-weight: bold; - border: 1px solid @boostrap-color; - padding: 5px; - } - .play { - background-color: white; - color: @play-color; - border-top-left-radius: 5px; - border-bottom-left-radius: 5px; - } - .bootstrap { - background-color: @boostrap-color; - color: white; - border-top-right-radius: 5px; - border-bottom-right-radius: 5px; - } - } - a[version] { - padding: 5px 20px; - } -} -.header-with-logo { - & > div { - display: inline-block; - vertical-align: middle; - margin-right: 15px; - } -} -#github-buttons { - margin-top: 25px; - margin-bottom: 25px; - position: relative; - img { - position: absolute; - top: -5px; - left: 120px; - } -} -i.fa-github { - vertical-align: middle; -} -.footer { - background-color: @footer-bg-color; - margin-top: 20px; - padding: 20px 0; - line-height: 15px; -} - -h3, h4 { margin-top: 35px; } -h1 + h2, h2 + h3, h3 + h4 { margin-top: 15px; } - -input:invalid { color: red !important; } -.example-html5-validation input:valid { color: green !important; } - -.highlight { - background-color: @code-bg-color; -} -pre code { - white-space: pre; -} -span.def { - color: #888; - font-size: 0.75em; - font-style: italic; - margin-left: 20px; -} - -.tab-pane > .bs-example { - border-top: 0; - border-top-left-radius: 0; - border-top-right-radius: 0; -} - -.form-inline { - button.apply-tweak { - width: 100%; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - } - .tweak .highlight { - border-top-left-radius: 0; - border-top-right-radius: 0; - pre code { - color: #aaa; - } - } - &.align-top { - .form-group { - vertical-align: top; - } - .tweak .highlight pre code { - color: #d9534f; - } - } -} - -[data-toggle="collapse"] { - .fa.fa-caret { - float: right; - margin-left: 15px; - &:before { content: "\f0d7" } - } - &[aria-expanded="true"] .fa.fa-caret:before { content: "\f0d8" } -} - -.bs-docs-sidebar { - .nav > .active > a, .nav > .active:hover > a, .nav > .active:focus > a, .nav > li > a:hover { - color: @nav-bg-color; - border-color: @nav-bg-color; - } -} -.bs-docs-sidenav { - min-width: 210px; -} - -.changelog { - h2 { - font-size: 24px; - } - .lead { - font-size: 18px; - font-style: italic; - } - ul { - list-style-type: none; - padding-left: 20px; - & > li { - font-size: 15px; - } - } - .panel ul { list-style-type: square; } -} - - -// For the examples: - -.multi-checkbox-list.inline > div { - display: inline-block; - margin-right: 20px; -} - -.input-text-checkbox > .input-group-addon { - .checkbox { display: inline; } - label { - display: inline; - padding: 0; - input { - position: relative; - margin-left: 0; - } - } -} - -.input-daterange { - #dateStart + .form-control-feedback { right: 395px; } - #dateEnd + .form-control-feedback { right: 0px; } -} -.input-text-checkbox #foo + .form-control-feedback { right: 0px; } - -.input-number-plus, .input-number-minus { cursor: pointer; } - -.input-number { - width: 150px; - input { - text-align: center; - & + .form-control-feedback { - right: 40px; - } - } -} - -.my-form-group { - white-space: nowrap; - & > div.field-container { - width: 50%; - } - & > div { - display: inline-block; - white-space: normal; - vertical-align: middle; - margin: 0; - ul { - padding-left: 0; - list-style-type: none; - } - .help-error { - color: #a94442 - } - .help-info { - color: #8a6d3b; - } - } -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/controllers/Application.scala b/play26-bootstrap3/sample/app/controllers/Application.scala deleted file mode 100644 index 888d8e6..0000000 --- a/play26-bootstrap3/sample/app/controllers/Application.scala +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package controllers - -import javax.inject.Inject -import play.api.i18n.I18nSupport -import play.api._ -import play.api.mvc._ -import play.api.data._ -import play.api.data.Forms._ -import play.api.data.validation.Constraints._ - -class Application @Inject() (mcc: MessagesControllerComponents) extends MessagesAbstractController(mcc) { - - val fooForm = Form(single("foo" -> text(maxLength = 20))) - - val validationForm = Form(tuple( - "username" -> nonEmptyText(maxLength = 20), - "email" -> email, - "age" -> number(min = 18, max = 99), - "color" -> nonEmptyText.verifying(pattern("^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$".r)) - )) - - def index = Action { implicit request => Ok(views.html.index(fooForm, validationForm)) } - def vertical = Action { implicit request => Ok(views.html.vertical(fooForm)) } - def horizontal = Action { implicit request => Ok(views.html.horizontal(fooForm)) } - def inline = Action { implicit request => Ok(views.html.inline(fooForm)) } - def mixed = Action { implicit request => Ok(views.html.mixed(fooForm)) } - def readonly = Action { implicit request => Ok(views.html.readonly(fooForm)) } - def multifield = Action { implicit request => Ok(views.html.multifield(fooForm)) } - def extendIt = Action { implicit request => Ok(views.html.extendIt(fooForm)) } - def docs = Action { implicit request => Ok(views.html.docs(fooForm, validationForm)) } - -} diff --git a/play26-bootstrap3/sample/app/models/Fruit.scala b/play26-bootstrap3/sample/app/models/Fruit.scala deleted file mode 100644 index b3f2df2..0000000 --- a/play26-bootstrap3/sample/app/models/Fruit.scala +++ /dev/null @@ -1,3 +0,0 @@ -package models - -case class Fruit(id: Long, name: String, isCitrus: Boolean) \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/utils/BSVersion.scala b/play26-bootstrap3/sample/app/utils/BSVersion.scala deleted file mode 100644 index 8479b6a..0000000 --- a/play26-bootstrap3/sample/app/utils/BSVersion.scala +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package utils - -object BSVersion { - final val code = "1.1.2-P26-B3" - final val library = "1.1" - final val play = "Play 2.6" - final val play_code = "2.6" - final val bootstrap = "Bootstrap 3" - final val bootstrap_code = "3" - - final val repositoryBase = "master/play26-bootstrap3/module" - - final val repository = "https://github.com/adrianhurt/play-bootstrap" - def repositoryPath(path: String) = s"$repository/$path" - def repositoryFile(file: String) = s"$repository/blob/$repositoryBase/$file" - def repositoryFolder(folder: String) = s"$repository/tree/$repositoryBase/$folder" - - final val msgsName = "msgsProv" - final val msgsClass = "MessagesProvider" - final val msgsArg = s"$msgsName: $msgsClass" -} diff --git a/play26-bootstrap3/sample/app/utils/SimplePrettifier.scala b/play26-bootstrap3/sample/app/utils/SimplePrettifier.scala deleted file mode 100644 index f5b93db..0000000 --- a/play26-bootstrap3/sample/app/utils/SimplePrettifier.scala +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2015 Adrian Hurtado (adrianhurt) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package utils - -object SimplePrettifier { - - /** - * Counts how many tabs there are at the begining of the first line and - * removes this number of tabs at the begining of every line. After, it - * replaces all tabs by two spaces. - */ - def prettify(str: String): String = { - val i = str.indexOf('\n') + 1 - var n = 0 - while (str.charAt(i + n) == '\t') n += 1 - str.replaceAll(s"\n\t{$n}", "\n").replaceAll("\t", " ").trim - } -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/b3/datepicker.scala.html b/play26-bootstrap3/sample/app/views/b3/datepicker.scala.html deleted file mode 100644 index 2df2ec3..0000000 --- a/play26-bootstrap3/sample/app/views/b3/datepicker.scala.html +++ /dev/null @@ -1,8 +0,0 @@ -@(startField: Field, startArgs: (Symbol,Any)*)(endField: Field, endArgs: (Symbol,Any)*)(globalArgs: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, msgsProv: MessagesProvider) -@b3.multifield( startField, endField )(globalArgs, startArgs ++ endArgs) { implicit cfc => -
- @b3.text(startField, startArgs:_*) - to - @b3.text(endField, endArgs:_*) -
-} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/b3/multiCheckbox.scala.html b/play26-bootstrap3/sample/app/views/b3/multiCheckbox.scala.html deleted file mode 100644 index d523caf..0000000 --- a/play26-bootstrap3/sample/app/views/b3/multiCheckbox.scala.html +++ /dev/null @@ -1,8 +0,0 @@ -@(fieldsWithArgs: (Field, Seq[(Symbol,Any)])*)(globalArgs: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, msgsProv: MessagesProvider) -@b3.multifield( fieldsWithArgs.map(_._1):_* )(globalArgs, fieldsWithArgs.map(_._2).flatten) { implicit cfc => -
- @fieldsWithArgs.map { case (field, fieldArgs) => - @b3.checkbox(field, fieldArgs:_*) - } -
-} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/b3/my/email.scala.html b/play26-bootstrap3/sample/app/views/b3/my/email.scala.html deleted file mode 100644 index 6c5dd8e..0000000 --- a/play26-bootstrap3/sample/app/views/b3/my/email.scala.html +++ /dev/null @@ -1,7 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit handler: b3.B3FieldConstructor, msgsProv: MessagesProvider) -@b3.inputFormGroup(field, withFeedback = false, withLabelFor = true, bs.Args.withDefault(args, 'class -> "form-control")) { fieldInfo => -
- @@ - -
-} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/b3/my/number.scala.html b/play26-bootstrap3/sample/app/views/b3/my/number.scala.html deleted file mode 100644 index 1ece39e..0000000 --- a/play26-bootstrap3/sample/app/views/b3/my/number.scala.html +++ /dev/null @@ -1,8 +0,0 @@ -@(field: Field, args: (Symbol,Any)*)(implicit handler: b3.B3FieldConstructor, msgsProv: MessagesProvider) -@b3.inputWrapped("text", field, args:_*) { input => -
- - @input - -
-} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/b3/my/vertical/bsFieldConstructor.scala.html b/play26-bootstrap3/sample/app/views/b3/my/vertical/bsFieldConstructor.scala.html deleted file mode 100644 index f299e9c..0000000 --- a/play26-bootstrap3/sample/app/views/b3/my/vertical/bsFieldConstructor.scala.html +++ /dev/null @@ -1,27 +0,0 @@ -@(fieldInfo: b3.B3FieldInfo, inputHtml: Html)(implicit fc: b3.B3FieldConstructor, msgsProv: MessagesProvider) -@alertStatus = @{ - if (fieldInfo.hasErrors) - "alert-danger" - else if (bs.ArgsMap.isTrue(fieldInfo.argsMap, '_success)) - "alert-success" - else - "alert-info" -} -
-
- @fieldInfo.labelOpt.map { label => - - } - @inputHtml -
- -
\ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/b3/my/vertical/bsFormGroup.scala.html b/play26-bootstrap3/sample/app/views/b3/my/vertical/bsFormGroup.scala.html deleted file mode 100644 index 1d1a819..0000000 --- a/play26-bootstrap3/sample/app/views/b3/my/vertical/bsFormGroup.scala.html +++ /dev/null @@ -1,16 +0,0 @@ -@(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit msgsProv: MessagesProvider) -
-
- @argsMap.get('_label).map { label => - - } - @contentHtml -
- -
\ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/b3/my/vertical/package.scala b/play26-bootstrap3/sample/app/views/b3/my/vertical/package.scala deleted file mode 100644 index 0a76704..0000000 --- a/play26-bootstrap3/sample/app/views/b3/my/vertical/package.scala +++ /dev/null @@ -1,43 +0,0 @@ -package views.html.b3.my - -package object vertical { - - import views.html.b3._ - import play.twirl.api.Html - import play.api.mvc.Call - import play.api.i18n.MessagesProvider - import views.html.helper._ - - /** - * Declares the class for the Vertical FieldConstructor. - */ - class VerticalFieldConstructor(val withFeedbackIcons: Boolean = false) extends B3FieldConstructor { - /* Define the default class of the corresponding form */ - val formClass = "form-my-vertical" - /* Renders the corresponding template of the field constructor */ - def apply(fieldInfo: B3FieldInfo, inputHtml: Html)(implicit msgsProv: MessagesProvider) = bsFieldConstructor(fieldInfo, inputHtml)(this, msgsProv) - /* Renders the corresponding template of the form group */ - def apply(contentHtml: Html, argsMap: Map[Symbol, Any])(implicit msgsProv: MessagesProvider) = bsFormGroup(contentHtml, argsMap)(msgsProv) - } - - /** - * Creates a new VerticalFieldConstructor to use for specific forms or scopes (don't use it as a default one). - * If a default B3FieldConstructor and a specific VerticalFieldConstructor are within the same scope, the more - * specific will be chosen. - */ - val fieldConstructorSpecific: VerticalFieldConstructor = new VerticalFieldConstructor() - - /** - * Returns it as a B3FieldConstructor to use it as default within a template - */ - val fieldConstructor: B3FieldConstructor = fieldConstructorSpecific - - /** - * ********************************************************************************************************************************** - * SHORTCUT HELPERS - * ********************************************************************************************************************************* - */ - def form(action: Call, args: (Symbol, Any)*)(body: VerticalFieldConstructor => Html) = - views.html.b3.form(action, args: _*)(body(fieldConstructorSpecific))(fieldConstructorSpecific) - -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/b3/package.scala b/play26-bootstrap3/sample/app/views/b3/package.scala deleted file mode 100644 index 663105c..0000000 --- a/play26-bootstrap3/sample/app/views/b3/package.scala +++ /dev/null @@ -1,8 +0,0 @@ -package views.html.b4 - -package object fc { - /** - * Returns it as a B4FieldConstructor to use it as default within a template - */ - implicit val verticalFieldConstructor: B4FieldConstructor = my.vertical.fieldConstructor -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/b3/textWithCheckbox.scala.html b/play26-bootstrap3/sample/app/views/b3/textWithCheckbox.scala.html deleted file mode 100644 index 29f86b0..0000000 --- a/play26-bootstrap3/sample/app/views/b3/textWithCheckbox.scala.html +++ /dev/null @@ -1,9 +0,0 @@ -@(textField: Field, textArgs: (Symbol,Any)*)(checkboxField: Field, checkboxArgs: (Symbol,Any)*)(globalArgs: (Symbol,Any)*)(implicit fc: b3.B3FieldConstructor, msgsProv: MessagesProvider) -@b3.multifield(textField, checkboxField)(globalArgs, textArgs ++ checkboxArgs) { implicit cfc => -
- - @b3.checkbox(checkboxField, checkboxArgs:_*) - - @b3.text(textField, textArgs:_*) -
-} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/docs.scala.html b/play26-bootstrap3/sample/app/views/docs.scala.html deleted file mode 100644 index c1e3f09..0000000 --- a/play26-bootstrap3/sample/app/views/docs.scala.html +++ /dev/null @@ -1,832 +0,0 @@ -@(fooForm: Form[String], validationForm: Form[(String, String, Int, String)])(implicit request: MessagesRequestHeader) - -@import utils.BSVersion -@import models._ -@import tags._ -@implicitFieldConstructor = @{ b3.vertical.fieldConstructor() } -@horizontalFieldConstructor = @{ b3.horizontal.fieldConstructor("col-md-2", "col-md-10") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - -@fruitsWithCitrus = @{ Seq( - Fruit(1L, "Apple", false), - Fruit(2L, "Orange", true), - Fruit(3L, "Pear", false), - Fruit(4L, "Lemon", true), - Fruit(5L, "Banana", false) -)} - - -@main("Documentation", tab = "docs") { - -
-
- @b3.form(routes.Application.docs) { - -

- Documentation @versionBadge(explicit = true) -

-

This page explains each component in more details.

- - -

Field Constructors

-

Vertical forms

-

Horizontal forms

-

Inline forms

-

Clear field constructor

-

Specific field constructors

- -

Arguments (args)

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - }{ - @@b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - } - -

Special arguments (the underscored ones)

- -

Validation arguments

- @bsExampleWithCode { -
- @b3.text( validationForm("username"), '_label -> "Username", '_help -> "A username between 1 and 20 characters" ) - @b3.email( validationForm("email"), '_label -> "Email" ) - @b3.number( validationForm("age"), '_label -> "Age", '_help -> "From 18 to 99 years old" ) - @b3.text( validationForm("color"), '_label -> "Hexadecimal color", '_help -> "Format is #CCC or #CCCCCC" ) -
- }{ - @@b3.text( validationForm("username"), '_label -> "Username", '_help -> "A username between 1 and 20 characters" ) - @@b3.email( validationForm("email"), '_label -> "Email" ) - @@b3.number( validationForm("age"), '_label -> "Age", '_help -> "From 18 to 99 years old" ) - @@b3.text( validationForm("color"), '_label -> "Hexadecimal color", '_help -> "Format is #CCC or #CCCCCC" ) - } - - -

Optional arguments

-

Boolean arguments

-

Arguments with dashes (e.g. data-* attributes)

- - -

ARIA attributes

- - -

Forms @@(action: Call, args: (Symbol, Any)*)(body: => Html)(implicit fc: B3FieldConstructor)

-

Forms with a specific B3FieldConstructor

-

Forms with CSRF token

- - -

Input helpers

- -

About disabled and readonly attributes

-

Validation states & feedback icons

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_label -> "Success", '_success -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_success -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - @bsExampleWithCode { - @b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - - - -

b3.inputType @@(inputType: String, field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a simple input with a specific type attribute and it adds class="form-control" by default, but you can add an extra class with 'class -> "extra_class". -

- @bsExampleWithCode { - @b3.inputType( "text", fooForm("name"), 'class -> "extra_class", '_label -> "Name", 'placeholder -> "John Doe" ) - @b3.inputType( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - @b3.inputType( "password", fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - }{ - @@b3.inputType( "text", fooForm("name"), 'class -> "extra_class", '_label -> "Name", 'placeholder -> "John Doe" ) - @@b3.inputType( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.inputType( "password", fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - } - - -

b3.text @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="text". -

- @bsExampleWithCode { - @b3.text( fooForm("name"), '_label -> "Name", 'placeholder -> "John Doe" ) - }{ - @@b3.text( fooForm("name"), '_label -> "Name", 'placeholder -> "John Doe" ) - } - - -

b3.password @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="password". -

-

- For security reasons, this helper doesn't display the possible value the field could have (for example when the form is reloaded after a validation failure). -

- @bsExampleWithCode { - @b3.password( fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - }{ - @@b3.password( fooForm("password"), '_label -> "Password", '_help -> "With at least 8 characters" ) - } - - -

b3.file @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="file". -

- @bsExampleWithCode { - @b3.file( fooForm("file"), '_label -> "File" ) - @b3.file( fooForm("file"), '_label -> "File", 'class -> "form-control" ) - }{ - @@b3.file( fooForm("file"), '_label -> "File" ) - @@b3.file( fooForm("file"), '_label -> "File", 'class -> "form-control" ) - } - - - -

b3.textarea @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a textarea and it adds class="form-control" by default. -

- @bsExampleWithCode { - @b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - }{ - @@b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - } - - -

b3.checkbox @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a checkbox. It has the attribute value set to true by default, - but you can use another one using the 'value argument. -

-

- The special '_text argument lets you put a text after the checkbox. -

-

- Regarding to the checked attribute, if you want to set it to true as default, use '_default -> true. - And if you need to force its value use directly the 'checked argument. -

-

- It supports readonly attribute adding an additional disabled one and a - <input type="hidden">. -

- @bsExampleWithCode { - @b3.checkbox( fooForm("foo"), '_text -> "Remember me" ) - }{ - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me" ) - - // uses "bar" as value for the checkbox - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", 'value -> "bar" ) - - // checked by default (if the form is filled, this value will be taken) - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", '_default -> true ) - - // always checked (even if the form has been filled with a false) - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", 'checked -> true ) - - // disabled -> it will NOT be sent within the POST request - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", 'disabled -> true ) - - // readonly -> it will be sent within the POST request - @@b3.checkbox( fooForm("foo"), '_text -> "Remember me", 'readonly -> true ) - } -

- Note you can use any value for the _text argument. -

- @bsExampleWithCode { - @b3.checkbox( fooForm("foo"), '_text -> Html("""Do you want a beer? """) ) - }{ - @@b3.checkbox( fooForm("foo"), '_text -> Html("Do you want a beer? ") ) - } - - -

b3.radio @@(field: Field, options: Seq[(String, Any)], args: (Symbol, Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a radio. It supports readonly attribute adding an additional disabled - one and a <input type="hidden">. -

-

- It has an additional special _inline argument to make it an inline radio (for vertical and horizontal forms). -

- @bsExampleWithCode { - @b3.radio( fooForm("foo_radio1"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - }{ - @@opts = @@{ Seq("M"->"Male","F"->"Female") } - - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group" ) - - // an inline radio within a vertical or horizontal form - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", '_inline -> true ) - - // with value "F" by default (if the form is filled, this value will be taken) - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", 'value -> "F" ) - - // disabled -> it will NOT be sent within the POST request - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", 'disabled -> true ) - - // readonly -> it will be sent within the POST request - @@b3.radio( fooForm("foo"), options = opts, '_label -> "Radio Group", 'readonly -> true ) - } -

- Note you can use any value for the options argument. -

- @bsExampleWithCode { - @b3.radio( fooForm("foo_radio2"), options = Seq("B" -> Html("""Beer """), "C" -> Html("""Coffee """)), '_label -> "What do you prefer?" ) - }{ - @@b3.radio( fooForm("foo"), options = Seq("B" -> Html("Beer "), "C" -> Html("Coffee ")), '_label -> "What do you prefer?" ) - } - -
b3.radio @@(field: Field, args: (Symbol, Any)*)(content: Tuple6[Boolean, Boolean, String, String, Option[String], Map[Symbol, Any]] => Html)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)
-
b3.radioOption @@(inputValue: Any, label: Any, args: (Symbol, Any)*)(implicit extraInfo: (Boolean, Boolean, String, String, Option[String], Map[Symbol,Any]))
-

- If you need more versatility you can fully customize your radio options: -

- @bsExampleWithCode { - @b3.radio( fooForm("foo_radio3"), '_label -> "Ok, now that we're alone, what do you really prefer?" ) { implicit extraInfo => - @b3.radioOption("B", Html("""Beer """)) - @b3.radioOption("B", Html("""Coffee """), 'disabled -> true) - } - }{ - @@b3.radio( fooForm("foo3"), '_label -> "Ok, now that we're alone, what do you really prefer?" ) { implicit extraInfo => - @@b3.radioOption("B", Html("Beer ")) - @@b3.radioOption("B", Html("Coffee "), 'disabled -> true) - } - } - - - - -

b3.select @@(field: Field, options: Seq[(String,String)], args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It renders a select. It supports readonly attribute adding an additional disabled - one and a <input type="hidden">. -

- @bsExampleWithCode { - @b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Disabled", 'disabled -> true ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Readonly", 'readonly -> true ) - }{ - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - - // disabled -> it will NOT be sent within the POST request - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'disabled -> true ) - - // readonly -> it will be sent within the POST request - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'readonly -> true ) - } -

- You can add a default first value using the argument '_default with a string. - It will add a first option to the select with an empty string value. So you could add a - required constraint to the field to force the user to select one - other option. In addition, this default option is always disable to avoid the user to select it, - and if any other option is selected this default one will not appear at all. -

- @bsExampleWithCode { - @b3.select( fooForm("foo"), options = fruits, '_label -> "With default", '_default -> "Select an option" ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "With default and Pears as value", '_default -> "Select an option", 'value -> "P" ) - }{ - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", '_default -> "Select an option" ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "With default and Pears as value", '_default -> "Select an option", 'value -> "P" ) - } - -

- For a multiple select you only need to add the 'multiple argument. - In that case, the '_default argument will be ignored. -

- @bsExampleWithCode { - @b3.select( fooForm("foo"), options = fruits, '_label -> "Select Multiple", 'multiple -> true ) - }{ - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Fruits", 'multiple -> true ) - - // with value "A" and "B" by default - // it is a string with every value separated by commas - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Fruits", 'multiple -> true, 'value -> "A,B" ) - } - -
b3.select @@(field: Field, args: (Symbol,Any)*)(content: Set[String] => Html)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)
-
b3.selectOption @@(value: Any, name: Any, args: (Symbol, Any)*)(implicit values: Set[String])
-

- If you need more versatility you can fully customize your select options: -

- @bsExampleWithCode { - @b3.select( fooForm("foo"), '_label -> "Grouped select" ) { implicit values => - - @b3.selectOption("opt_1-1", "Option 1.1") - @b3.selectOption("opt_1-2", "Option 1.2", 'disabled -> true) - @b3.selectOption("opt_1-3", "Option 1.3") - - - @b3.selectOption("opt_2-1", "Option 2.1", 'disabled -> true) - @b3.selectOption("opt_2-2", "Option 2.2") - - } - - @b3.select( fooForm("foo"), '_label -> "Fruits select (lemon preselected)" ) { implicit values => - - @fruitsWithCitrus.filter(_.isCitrus).map { citrus => - @b3.selectOption(citrus.id, citrus.name, 'selected -> (citrus.name == "Lemon")) - } - - - @fruitsWithCitrus.filterNot(_.isCitrus).map { fruit => - @b3.selectOption(fruit.id, fruit.name) - } - - } - }{ - @@b3.select( fooForm("foo"), '_label -> "Grouped select" ) { implicit values => - - @@b3.selectOption("opt_1-1", "Option 1.1") - @@b3.selectOption("opt_1-2", "Option 1.2", 'disabled -> true) - @@b3.selectOption("opt_1-3", "Option 1.3") - - - @@b3.selectOption("opt_2-1", "Option 2.1", 'disabled -> true) - @@b3.selectOption("opt_2-2", "Option 2.2") - - } - - class Fruit (id: Long, name: String, isCitrus: Boolean) - - @@fruitsWithCitrus = @@{ Seq( - Fruit(1L, "Apple", false), - Fruit(2L, "Orange", true), - Fruit(3L, "Pear", false), - Fruit(4L, "Lemon", true), - Fruit(5L, "Banana", false) - )} - - @@b3.select( fooForm("foo"), '_label -> "Fruits select (lemon preselected)" ) { implicit values => - - @@fruitsWithCitrus.filter(_.isCitrus).map { citrus => - @@b3.selectOption(citrus.id, citrus.name, 'selected -> (citrus.name == "Lemon")) - } - - - @@fruitsWithCitrus.filterNot(_.isCitrus).map { fruit => - @@b3.selectOption(fruit.id, fruit.name) - } - - } - } - - -

b3.hidden @@(name: String, value: Any, args: (Symbol, Any)*)

-

- It simply renders a hidden input. -

- @code { - @@b3.hidden("fooName", "fooValue", 'fooAttr -> "fooAttrValue") - } -

Renders to:

- @code { - - } -
b3.hidden @@(field: Field, args: (Symbol, Any)*)
-

- You can also render a hidden input directly with a Field as you could do with a b3.text helper, for example. - It lets you be able to simply change a b3.text for a b3.hidden to hide it. -

-

- It will automatically take the name of the Field and it's value if present. You can set a default value using the argument - 'value. Finally, take into account that every "underscored" argument (with "_" as preffix) will be removed. -

- @code { - @@b3.hidden( fooForm("name"), '_label -> "Name", 'value -> "defaultValue", 'placeholder -> "John Doe" ) - } -

Renders to:

- @code { - - } - -

b3.hiddens @@(namesAndValues: (Any, Any)*)

-

- Render a list of hidden inputs. -

- @code { - @@b3.hiddens("fooId" -> 1L, "barId" -> 2L) - } -

Renders to:

- @code { - - - } - - - - -

New HTML5 helpers

-

- Important note: the new HTML5 input types are not fully supported for web browsers. Those not supported by old web browsers, will behave as input type text. -

- -

b3.color @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="color". -

- @bsExampleWithCode { - @b3.color( fooForm("color"), '_label -> "Color", 'value -> "#3264c8" ) - }{ - @@b3.color( fooForm("color"), '_label -> "Color", 'value -> "#3264c8" ) - } - -

b3.date @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="date". -

- @bsExampleWithCode { - @b3.date( fooForm("date"), '_label -> "Date" ) - }{ - @@b3.date( fooForm("date"), '_label -> "Date" ) - } - -

b3.datetime @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="datetime". -

- @bsExampleWithCode { - @b3.datetime( fooForm("datetime"), '_label -> "Datetime" ) - }{ - @@b3.datetime( fooForm("datetime"), '_label -> "Datetime" ) - } - -

b3.datetimeLocal @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="datetime-local". -

- @bsExampleWithCode { - @b3.datetimeLocal( fooForm("datetimeLocal"), '_label -> "Datetime-Local" ) - }{ - @@b3.datetimeLocal( fooForm("datetimeLocal"), '_label -> "Datetime-Local" ) - } - -

b3.email @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="email". -

- @bsExampleWithCode { - @b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - }{ - @@b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - } - -

b3.month @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="month". -

- @bsExampleWithCode { - @b3.month( fooForm("month"), '_label -> "Month" ) - }{ - @@b3.month( fooForm("month"), '_label -> "Month" ) - } - -

b3.number @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="number". -

- @bsExampleWithCode { - @b3.number( fooForm("number"), '_label -> "Number (0 to 50 with intervals of 5)", 'min -> 0, 'max -> 50, 'step -> 5 ) - }{ - @@b3.number( fooForm("number"), '_label -> "Number", 'min -> 0, 'max -> 50, 'step -> 5 ) - } - -

b3.range @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="range". -

- @bsExampleWithCode { - @b3.range( fooForm("range"), '_label -> "Range (0 to 50)", 'min -> 0, 'max -> 50 ) - }{ - @@b3.range( fooForm("range"), '_label -> "Range", 'min -> 0, 'max -> 50 ) - } - - -

- It is a short version of b3.inputType for type="search". -

- @bsExampleWithCode { - @b3.search( fooForm("search"), '_label -> "Search" ) - }{ - @@b3.search( fooForm("search"), '_label -> "Search" ) - } - -

b3.tel @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="tel". -

- @bsExampleWithCode { - @b3.tel( fooForm("tel"), '_label -> "Telephone" ) - }{ - @@b3.tel( fooForm("tel"), '_label -> "Telephone" ) - } - -

b3.time @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="time". -

- @bsExampleWithCode { - @b3.time( fooForm("time"), '_label -> "Time" ) - }{ - @@b3.time( fooForm("time"), '_label -> "Time" ) - } - -

b3.url @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="url". -

- @bsExampleWithCode { - @b3.url( fooForm("url"), '_label -> "URL" ) - }{ - @@b3.url( fooForm("url"), '_label -> "URL" ) - } - -

b3.week @@(field: Field, args: (Symbol,Any)*)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- It is a short version of b3.inputType for type="week". -

- @bsExampleWithCode { - @b3.week( fooForm("week"), '_label -> "Week" ) - }{ - @@b3.week( fooForm("week"), '_label -> "Week" ) - } - - - - - -

More helpers

-

- The following helpers use an auxiliar helper that creates a form-group without a field. - Here are the special arguments they use: -

    -
  • _id: the id for the form-group.
  • -
  • _class: the class for the form-group (the form-group class is always added).
  • -
  • _label: the text for the label.
  • -
  • _help: a help text below the input.
  • -
-

- -

b3.static @@(label: String, args: (Symbol,Any)*)(text: => Html)(implicit fc: B3FieldConstructor)

-

- It renders a static control to place within your form. It takes a HTML as parameter, so you can - render whatever you want. Actually, it is like a wrapper for a static HTML. -

- @bsExampleWithCode { - @b3.static("Static HTML"){ This is a link } - }{ - @@b3.static("Static HTML"){ This is a link } - } -

- There are two equivalent more versions of b3.static helper: one for labels with HTML, and another one to omit the label. Note that you can also have a hidden label using '_hideLabel' argument. -

- @bsExampleWithCode { - @b3.static(Html("Label with icon ")){ Basic control with label } - @b3.static("Hidden label", '_hideLabel -> true){ Basic control with hidden label } - @b3.static(){ Basic control without label } - }{ - @@b3.static(Html("Label with icon ")){ Basic control with label } - @@b3.static("Hidden label", '_hideLabel -> true){ Basic control with hidden label } - @@b3.static(){ Basic control without label } - } - - -

b3.buttonType @@(buttonType: String, args: (Symbol,Any)*)(text: => Html)(implicit fc: b3.B3FieldConstructor)

-

- It renders a simple button to place within your form. It takes a HTML as parameter, so you can - render whatever you want. -

- @bsExampleWithCode { - @b3.buttonType("submit", 'class -> "btn btn-default"){ Sign in } - }{ - @@b3.buttonType("submit", 'class -> "btn btn-default"){ Sign in } - } - -

b3.submit @@(args: (Symbol,Any)*)(text: => Html)(implicit fc: B3FieldConstructor)

-

- It is a short version of b3.buttonType for type="submit". -

- @bsExampleWithCode { - @b3.submit('class -> "btn btn-primary"){ Sign in } - }{ - @@b3.submit('class -> "btn btn-primary"){ Sign in } - } - - -

b3.reset @@(args: (Symbol,Any)*)(text: => Html)(implicit fc: B3FieldConstructor)

-

- It is a short version of b3.buttonType for type="reset". -

- @bsExampleWithCode { - @b3.reset('class -> "btn btn-danger"){ Reset } - }{ - @@b3.reset('class -> "btn btn-danger"){ Reset } - } - -

b3.button @@(args: (Symbol,Any)*)(text: => Html)(implicit fc: B3FieldConstructor)

-

- It is a short version of b3.buttonType for type="button". -

- @bsExampleWithCode { - @b3.button('class -> "btn btn-default"){ Favorite } - }{ - @@b3.button('class -> "btn btn-default"){ Favorite } - } - - -

b3.free @@(args: (Symbol,Any)*)(content: => Html)(implicit fc: B3FieldConstructor)

-

- It renders whatever you want within a form-group div. -

- @bsExampleWithCode { - @b3.free('_id -> "idFormGroup") { - - Cancel - } - }{ - @@b3.free('_id -> "idFormGroup") { - - Cancel - } - } - - - - - - - - -

Your own custom helpers

-

- The purpose of these helpers is to be a tool for creating your own helpers. Please see more about creating new helpers - here. -

- -

b3.inputWrapped @@(inputType: String, field: Field, args: (Symbol,Any)*)(inputGroup: Html => Html)(implicit handler: B3FieldConstructor, @BSVersion.msgsArg)

-

- This is the same as b3.inputType but specifying a custom wrapper for the input tag. - It is useful for input groups and inputs with validation states and feedback icons. -

- @bsExampleWithCode { - @b3.inputWrapped( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) { input => -
- @@ - @input - -
- } - }{ - @@b3.inputWrapped( "email", fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) { input => -
- @@@@ - @@input - -
- } - } - -

b3.multifield @@(fields: Field*)(args: (Symbol,Any)*)(inputsHtml: (B3FieldConstructor, @BSVersion.msgsClass) => Html)(implicit fc: B3FieldConstructor, @BSVersion.msgsArg)

-

- Sometimes you may need two or more fields within the same line in a horizontal or vertical form (for a set of checkboxes, a date range, ...). -

-

- The helper b3.multifield tries to: -

    -
  • Manage a set of fields and group them within the same form-group.
  • -
  • Manage all of their errors, infos and constraints at the end of the form-group as if they were only one.
  • -
  • Take advantage of the helpers that are already implemented.
  • -
  • Be a tool to create your custom multifield helpers.
  • -
-

-

- To know how it works and how to use it go the the Multifield section. -

- - } -
- - - -
- -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/extendIt.scala.html b/play26-bootstrap3/sample/app/views/extendIt.scala.html deleted file mode 100644 index 6550315..0000000 --- a/play26-bootstrap3/sample/app/views/extendIt.scala.html +++ /dev/null @@ -1,78 +0,0 @@ -@(fooForm: Form[String])(implicit request: MessagesRequestHeader) -@import utils.BSVersion -@import tags._ -@import helper.Implicits._ -@implicitFieldConstructor = @{ b3.vertical.fieldConstructor() } - - -@main("Extend it", tab = "extendit") { - - @b3.form(routes.Application.extendIt) { - -

Implement your own helpers or field constructors

-

- This library tries to be an out-of-the-box plugin. You simply need to install the library and you can - start to write your forms. However, although it is a very versatile library, you may have different - necessities. Thus, let's see some examples to know how you could extend it. -

- -

Create your own helper

- @bsExample { - @b3.my.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - } - @code { - @@b3.my.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - } - -

The use of b3.inputWrapped

- @bsExampleWithCode { - @b3.my.number( fooForm("foo"), '_label -> "Number", 'value -> 0 ) - }{ - @@b3.my.number( fooForm("foo"), '_label -> "Number", 'value -> 0 ) - } - -

Create your multifield helper

- - } - - -

Create your own field constructor

- @bsExampleWithCode { - @b3.my.vertical.form(routes.Application.extendIt) { implicit myfc => - @b3.my.email( fooForm("foo"), '_label -> "Email", '_error -> "And error occurred!", '_showConstraints -> true, 'placeholder -> "example@mail.com" ) - } - }{ -
-
- -
- @@ - -
-
- -
- } -

- And that's all, you now can use your own field constructor as any other with: -

- @code { - @@import b3.my.vertical.fieldConstructor // Declare it as default - - @@b3.my.email( fooForm("foo"), '_label -> "Email", '_error -> "And error occurred!", '_showConstraints -> true, 'placeholder -> "example@@mail.com" ) - } -

- Or even using it for specific forms: -

- @code { - @@b3.my.vertical.form(routes.Application.extendIt) { implicit myfc => - @@b3.my.email( fooForm("foo"), '_label -> "Email", '_error -> "And error occurred!", '_showConstraints -> true, 'placeholder -> "example@@mail.com" ) - } - } - -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/horizontal.scala.html b/play26-bootstrap3/sample/app/views/horizontal.scala.html deleted file mode 100644 index 848a433..0000000 --- a/play26-bootstrap3/sample/app/views/horizontal.scala.html +++ /dev/null @@ -1,221 +0,0 @@ -@(fooForm: Form[String])(implicit request: MessagesRequestHeader) -@import utils.BSVersion -@import tags._ -@implicitFC = @{ b3.horizontal.fieldConstructor("col-md-4", "col-md-8") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Horizontal Form", tab = "styles") { - -

Horizontal Form

- -

Simple inputs

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@mail.com" ) -
-
- @b3.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @b3.file( fooForm("foo"), '_label -> "File" ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @@b3.file( fooForm("foo"), '_label -> "File" ) - } - -

More options

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) -
-
- @b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @b3.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @@b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @@b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @@b3.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) - } - - -

Textareas, checkboxes, radio buttons and selects

- @bsExampleWithCode { -
-
- @b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) -
-
- @b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) -
-
- }{ - @@b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - ... - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) - } - -

Disabled and readonly attributes

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) -
-
- @b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @@b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - } - -

Validation states

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- @b3.horizontal.form(routes.Application.horizontal, "col-md-4", "col-md-8", '_feedbackIcons -> true) { implicit fc => - @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - @b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - // With feedback icons - @@b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - Or - - // With feedback icons - @@b3.horizontal.form(routes.Application.horizontal, "col-md-4", "col-md-8", '_feedbackIcons -> true) { implicit fc => - @@b3.text( fooForm("foo"), '_label -> "Success", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - } - -

Customize them

- @bsExampleWithCode { -
-
- @b3.inputWrapped( "email", fooForm("foo"), '_label -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@ - @input -
- } - @b3.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
- - @input - -
- } -
-
- @b3.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @input -
- - - -
-
- } -
-
- }{ - @@b3.inputWrapped( "email", fooForm("foo"), '_label -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@@@ - @@input -
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @@input -
- -
-
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
- - @@input - -
- } - } - -

More helpers

- @bsExampleWithCode { -
-
- @b3.static("Static HTML"){ This is a link } - @b3.submit('class -> "btn btn-default"){ Submit me! } - @b3.free() { - - Cancel - } -
-
- }{ - @@b3.static("Static HTML"){ This is a link } - @@b3.submit('class -> "btn btn-default"){ Submit me! } - @@b3.free() { - - Cancel - } - } - -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/index.scala.html b/play26-bootstrap3/sample/app/views/index.scala.html deleted file mode 100644 index 67a7c71..0000000 --- a/play26-bootstrap3/sample/app/views/index.scala.html +++ /dev/null @@ -1,92 +0,0 @@ -@(fooForm: Form[String], validationForm: Form[(String, String, Int, String)])(implicit request: MessagesRequestHeader) -@import utils.BSVersion -@import tags._ -@import helper.Implicits._ - -@main("Play-Bootstrap", tab = "index") { - - - -

- This is a collection of input helpers and field constructors for - Play Framework to render - Bootstrap HTML code. -

- -
- - - - -
- - - -
-
- @bsExampleWithCode { - @b3.vertical.form(routes.Application.index) { implicit vfc => - @b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @b3.submit('class -> "btn btn-default"){ Sign in } - } - }{ - @@b3.vertical.form(routes.Application.index) { implicit vfc => - @@b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @@b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @@b3.submit('class -> "btn btn-default"){ Sign in } - } - } -
-
- @bsExampleWithCode { - @b3.horizontal.form(routes.Application.index, "col-md-2", "col-md-10") { implicit hfc => - @b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @b3.submit('class -> "btn btn-default"){ Sign in } - } - }{ - @@b3.horizontal.form(routes.Application.index, "col-md-2", "col-md-10") { implicit hfc => - @@b3.email( fooForm("email"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("password"), '_label -> "Password", 'placeholder -> "Password" ) - @@b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @@b3.submit('class -> "btn btn-default"){ Sign in } - } - } -
-
- @bsExampleWithCode { - @b3.inline.form(routes.Application.index) { implicit ifc => - @b3.email( fooForm("email"), '_hiddenLabel -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("password"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @b3.submit('class -> "btn btn-default"){ Sign in } - } - }{ - @@b4.inline.form(routes.Application.index) { implicit ifc => - @@b3.email( fooForm("email"), '_hiddenLabel -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("password"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @@b3.checkbox( fooForm("remember"), '_text -> "Remember me", 'value -> true ) - @@b3.submit('class -> "btn btn-default"){ Sign in } - } - } -
-
-} diff --git a/play26-bootstrap3/sample/app/views/inline.scala.html b/play26-bootstrap3/sample/app/views/inline.scala.html deleted file mode 100644 index 4bec8c2..0000000 --- a/play26-bootstrap3/sample/app/views/inline.scala.html +++ /dev/null @@ -1,179 +0,0 @@ -@(fooForm: Form[String])(implicit request: MessagesRequestHeader) -@import utils.BSVersion -@import tags._ -@implicitFieldConstructor = @{ b3.inline.fieldConstructor() } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Inline Form", tab = "styles") { - -

Inline Form

- -

Simple inputs

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @b3.file( fooForm("foo"), '_hiddenLabel -> "File" ) - }{ - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @@b3.file( fooForm("foo"), '_hiddenLabel -> "File" ) - } - -

More options

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.text( fooForm("foo"), '_label -> "Show label", '_showLabel -> true, 'placeholder -> "Show label" ) - @b3.text( fooForm("foo"), '_hiddenLabel -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @b3.text( fooForm("foo"), '_hiddenLabel -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @b3.text( fooForm("foo"), '_hiddenLabel -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) - }{ - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.text( fooForm("foo"), '_label -> "Show label", '_showLabel -> true, 'placeholder -> "Show label" ) - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @@b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @@b3.text( fooForm("foo"), '_hiddenLabel -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) - } - - -

Textareas, checkboxes, radio buttons and selects

- @bsExampleWithCode { - @b3.textarea( fooForm("foo"), '_hiddenLabel -> "Textarea", 'rows -> 3 ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female") ) - @b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select" ) - @b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Multiple Select", 'multiple -> true ) - }{ - @@b3.textarea( fooForm("foo"), '_hiddenLabel -> "Textarea", 'rows -> 3 ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female") ) - - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - ... - @@b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select" ) - @@b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Multiple Select", 'multiple -> true ) - } - -

Disabled and readonly attributes

- @bsExampleWithCode { - @b3.text( fooForm("foo"), '_hiddenLabel -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - }{ - @@b3.text( fooForm("foo"), '_hiddenLabel -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @@b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @@b3.select( fooForm("foo"), options = fruits, '_hiddenLabel -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - } - -

Validation states

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- @b3.inline.form(routes.Application.inline, '_feedbackIcons -> true) { implicit fc => - @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - @b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - // With feedback icons - @@b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - Or - - // With feedback icons - @@b3.inline.form(routes.Application.inline, '_feedbackIcons -> true) { implicit fc => - @@b3.text( fooForm("foo"), '_label -> "Success", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - } - -

Customize them

- @bsExampleWithCode { - @b3.inputWrapped( "email", fooForm("foo"), '_hiddenLabel -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@ - @input -
- } - @b3.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @input -
- - - -
-
- } - @b3.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Number", 'value -> 0 ) { input => -
- - @input - -
- } - }{ - @@b3.inputWrapped( "email", fooForm("foo"), '_hiddenLabel -> "Simple input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@@@ - @@input -
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @@input -
- -
-
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_hiddenLabel -> "Number", 'value -> 0 ) { input => -
- - @@input - -
- } - } - -

More helpers

- @bsExampleWithCode { - @b3.submit('class -> "btn btn-default"){ Submit me! } - }{ - @@b3.submit('class -> "btn btn-default"){ Submit me! } - } - -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/main.scala.html b/play26-bootstrap3/sample/app/views/main.scala.html deleted file mode 100644 index aa9ffdd..0000000 --- a/play26-bootstrap3/sample/app/views/main.scala.html +++ /dev/null @@ -1,69 +0,0 @@ -@(title: String, tab: String = "", styles: Html = Html(""), scripts: Html = Html(""), modals: Html = Html(""))(content: Html) -@import utils.BSVersion -@import tags._ - - - - - @title - - - - - - - @styles - - - - - @scripts - - - - -
- @content -
- - - @modals - - diff --git a/play26-bootstrap3/sample/app/views/mixed.scala.html b/play26-bootstrap3/sample/app/views/mixed.scala.html deleted file mode 100644 index 350ad64..0000000 --- a/play26-bootstrap3/sample/app/views/mixed.scala.html +++ /dev/null @@ -1,121 +0,0 @@ -@(fooForm: Form[String])(implicit request: MessagesRequestHeader) -@import utils.BSVersion -@import tags._ -@implicitFC = @{ b3.horizontal.fieldConstructor("col-md-2", "col-md-10") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Mixed Forms", tab = "styles") { - -

Mixed Forms

-

This page its an example to show how to mix different forms within the same view.

- -

A simple horizontal form

- @bsExampleWithCode { - @b3.form(routes.Application.mixed) { - @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Select a fruit" ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b3.submit('class -> "btn btn-default"){ Save changes } - } - }{ - @@b3.form(routes.Application.mixed) { - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select a fruit" ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b3.submit('class -> "btn btn-default"){ Save changes } - } - } - - -

The typical inline login form on top

- @bsExampleWithCode { - @b3.inline.form(routes.Application.mixed) { implicit ifc => - @b3.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@mail.com" ) - @b3.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @b3.submit('class -> "btn btn-default"){ Sign in } - } - }{ - @@b3.inline.form(routes.Application.mixed) { implicit ifc => - @@b3.email( fooForm("foo"), '_hiddenLabel -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("foo"), '_hiddenLabel -> "Password", 'placeholder -> "Password" ) - @@b3.submit('class -> "btn btn-default"){ Sign in } - } - } - - -

The typical vertical contact form on one side

- @bsExampleWithCode { -
-
- @b3.vertical.form(routes.Application.mixed) { implicit vfc => - @b3.text( fooForm("foo"), '_label -> "Your name", 'placeholder -> "Your contact name" ) - @b3.email( fooForm("foo"), '_label -> "Your email", 'placeholder -> "example@mail.com" ) - @b3.textarea( fooForm("foo"), '_label -> "What happened?", 'rows -> 3 ) - @b3.checkbox( fooForm("foo"), '_text -> "Send me a copy to my email", 'checked -> true ) - @b3.submit('class -> "btn btn-default"){ Send } - } -
-
- }{ - @@b3.vertical.form(routes.Application.mixed) { implicit vfc => - @@b3.text( fooForm("foo"), '_label -> "Your name", 'placeholder -> "Your contact name" ) - @@b3.email( fooForm("foo"), '_label -> "Your email", 'placeholder -> "example@@mail.com" ) - @@b3.textarea( fooForm("foo"), '_label -> "What happened?", 'rows -> 3 ) - @@b3.checkbox( fooForm("foo"), '_text -> "Send me a copy to my email", 'checked -> true ) - @@b3.submit('class -> "btn btn-default"){ Send } - } - } - - -

A different horizontal form

- @bsExampleWithCode { - @b3.horizontal.form(routes.Application.mixed, "col-lg-4", "col-lg-8") { implicit hfc => - @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.file( fooForm("foo"), '_label -> "File" ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox" ) - @b3.submit('class -> "btn btn-default"){ Save changes } - } - }{ - @@b3.horizontal.form(routes.Application.mixed, "col-lg-4", "col-lg-8") { implicit hfc => - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.file( fooForm("foo"), '_label -> "File" ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox" ) - @@b3.submit('class -> "btn btn-default"){ Save changes } - } - } - - -

A clear field constructor

- @bsExampleWithCode { - @b3.clear.form(routes.Application.mixed) { implicit cfc => - @b3.inputWrapped( "search", fooForm("foo"), 'placeholder -> "Text to search..." ) { input => -
- - @input - - - -
- } - } - }{ - @@b3.clear.form(routes.Application.mixed) { implicit cfc => - @@b3.inputWrapped( "search", fooForm("foo"), 'placeholder -> "Text to search..." ) { input => -
- - @@input - - - -
- } - } - } - - -

Mixed FieldConstructors within the same form

- - -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/multifield.scala.html b/play26-bootstrap3/sample/app/views/multifield.scala.html deleted file mode 100644 index 8a675fc..0000000 --- a/play26-bootstrap3/sample/app/views/multifield.scala.html +++ /dev/null @@ -1,91 +0,0 @@ -@(fooForm: Form[String])(implicit request: MessagesRequestHeader) -@import utils.BSVersion -@import tags._ -@import helper.Implicits._ -@implicitFC = @{ b3.horizontal.fieldConstructor("col-md-2", "col-md-10") } - - -@main("Multifield", tab = "multifield") { - - @b3.form(routes.Application.multifield) { - -

Multifield support

-

- Sometimes you may need two or more fields within the same line in a horizontal or vertical form (for a set of - checkboxes, a date range, ...). That is the purpose of the helper b3.multifield. -

- -

Let's see a couple of examples

- -

A date range

- @bsExampleWithCode { - @b3.datepicker( fooForm("dateStart"), 'value -> "15-11-2014" )( - fooForm("dateEnd"), 'value -> "31-12-2014" )( - '_label -> "Date range", "data-date-start-date" -> "10-11-2014", '_help -> "Select a date range from 10-11-2014" ) - }{ - @@b3.datepicker( fooForm("dateStart"), 'value -> "31-10-2014" )( - fooForm("dateEnd"), 'value -> "31-12-2014" )( - '_label -> "Date range", "data-date-start-date" -> "01-01-2014", '_help -> "Select a date range from 10-11-2014" ) - } - -

A set of checkboxes

- @bsExampleWithCode { - @b3.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )( '_label -> "Checkboxes", 'class -> "multi-checkbox-list", '_help -> "Mark what you want" ) - @b3.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )('_label -> "Inline", 'class -> "multi-checkbox-list inline", '_help -> "Mark what you want") - }{ - @@b3.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )('_label -> "Checkboxes", 'class -> "multi-checkbox-list", '_help -> "Mark what you want") - @@b3.multiCheckbox( - (fooForm("foo"), Seq('_text -> "Foo")), - (fooForm("bar"), Seq('_text -> "Bar")), - (fooForm("beer"), Seq('_text -> "Beer")) - )('_label -> "Inline", 'class -> "multi-checkbox-list inline", '_help -> "Mark what you want") - } - -

A textfield with a checkbox addon

- @bsExampleWithCode { - @b3.textWithCheckbox( fooForm("foo"), 'placeholder -> "a foo value" )( fooForm("fooSelected") )('_label -> "New task" ) - }{ - @@b3.textWithCheckbox( fooForm("foo"), 'placeholder -> "a foo value" )( fooForm("fooSelected") )('_label -> "New task" ) - } - -

Validation states and feedback icons

- @bsExampleWithCode { - @b3.datepicker( fooForm("dateStart"), 'value -> "15-11-2014", '_showIconWarning -> true )( - fooForm("dateEnd"), 'value -> "31-10-2014", '_showIconWarning -> true )( - '_label -> "Date range", '_hasFeedback -> true ) - - @b3.textWithCheckbox( fooForm("foo"), 'value -> "an incorrect value", '_error -> "The value is incorrect", '_showIconOnError -> true )( - fooForm("fooSelected") )( - '_label -> "New task", '_hasFeedback -> true ) - }{ - @@b3.datepicker( fooForm("dateStart"), 'value -> "15-11-2014", '_showIconWarning -> true )( - fooForm("dateEnd"), 'value -> "31-10-2014", '_showIconWarning -> true )( - '_label -> "Date range", '_hasFeedback -> true ) - - @@b3.textWithCheckbox( fooForm("foo"), 'value -> "an incorrect value", '_error -> "The value is incorrect", '_showIconOnError -> true )( - fooForm("fooSelected") )( - '_label -> "New task", '_hasFeedback -> true ) - } -

- The CSS needed for this last example: -

- @code { - .input-daterange #dateStart + .form-control-feedback { right: 395px; } - .input-daterange #dateEnd + .form-control-feedback { right: 0px; } - .input-text-checkbox #foo + .form-control-feedback { right: 0px; } - } - - } -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/readonly.scala.html b/play26-bootstrap3/sample/app/views/readonly.scala.html deleted file mode 100644 index 30ccc6c..0000000 --- a/play26-bootstrap3/sample/app/views/readonly.scala.html +++ /dev/null @@ -1,39 +0,0 @@ -@(fooForm: Form[String])(implicit request: MessagesRequestHeader) -@import utils.BSVersion -@import tags._ -@implicitFC = @{ b3.horizontal.fieldConstructor("col-md-2", "col-md-10") } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Demo for Readonly Attributes", tab = "readonly") { - -

Demo for Readonly Attributes

-

- This page its an example to show how to use the readonly attribute for - checkbox, radio and select helpers. -

- - @b3.formCSRF(Call("GET", ""), 'id -> "form-readonly") { - @bsExampleWithCode { - @b3.text( fooForm("text"), '_label -> "Always editable", '_class -> "always-editable", 'value -> "demo text", 'placeholder -> "A simple text..." ) - @b3.checkbox( fooForm("checkbox"), '_text -> "Checkbox", 'value -> true, 'readonly -> true ) - @b3.radio( fooForm("radio"), options = Seq("M"->"Male","F"->"Female"), 'value -> "M", '_label -> "Radio Group", 'readonly -> true ) - @b3.select( fooForm("select"), options = fruits, '_label -> "Select", 'value -> "A", 'readonly -> true ) - @b3.free() { - - Unlock readonly fields - } - }{ - @@b3.text( fooForm("text"), '_label -> "Always editable", '_class -> "always-editable", 'value -> "demo text", 'placeholder -> "A simple text..." ) - @@b3.checkbox( fooForm("checkbox"), '_text -> "Checkbox", 'value -> true, 'readonly -> true ) - @@b3.radio( fooForm("radio"), options = Seq("M"->"Male","F"->"Female"), 'value -> "M", '_label -> "Radio Group", 'readonly -> true ) - @@b3.select( fooForm("select"), options = fruits, '_label -> "Select", 'value -> "A", 'readonly -> true ) - @@b3.free() { - - Unlock readonly fields - } - } - } - -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/bsExample.scala.html b/play26-bootstrap3/sample/app/views/tags/bsExample.scala.html deleted file mode 100644 index 9472aec..0000000 --- a/play26-bootstrap3/sample/app/views/tags/bsExample.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(example: Html) -
- @example -
\ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/bsExampleWithCode.scala.html b/play26-bootstrap3/sample/app/views/tags/bsExampleWithCode.scala.html deleted file mode 100644 index f9cebc8..0000000 --- a/play26-bootstrap3/sample/app/views/tags/bsExampleWithCode.scala.html +++ /dev/null @@ -1,3 +0,0 @@ -@(theExample: Html)(theCode: Html) -@bsExample(theExample) -@code(theCode) \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/code.scala.html b/play26-bootstrap3/sample/app/views/tags/code.scala.html deleted file mode 100644 index a814ab5..0000000 --- a/play26-bootstrap3/sample/app/views/tags/code.scala.html +++ /dev/null @@ -1,4 +0,0 @@ -@(code: Html) -
-
@utils.SimplePrettifier.prettify(code.toString)
-
\ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/docsReadonlyAttributes.scala.html b/play26-bootstrap3/sample/app/views/tags/docsReadonlyAttributes.scala.html deleted file mode 100644 index 7d38686..0000000 --- a/play26-bootstrap3/sample/app/views/tags/docsReadonlyAttributes.scala.html +++ /dev/null @@ -1,18 +0,0 @@ -@() -

- Both the disabled and readonly attributes for an input prevent the user from modify it. - However, the disabled attribute means this input will NOT be sent within the POST request, whereas - the readonly one means it will. -

-

- Nevertheless, for checkbox, radio and select tags it doesn't happen. To - support the readonly attribute for these tags, the corresponding helpers have been adapted to behave - as would be expected. To do that, when the readonly attribute appears the helper will: -

    -
  • add an additional disabled attribute
  • -
  • add an additional <input type="hidden"> with the desired value
  • -
  • wraps them with in a div (with class checkbox-group, radio-group or select-group)
  • -
- Note it only happens when the readonly attribute is present, even with a false value. - It is done to make it easier to modify its readonly behaviour using javascript. -

\ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/javaMessagesWarning.scala.html b/play26-bootstrap3/sample/app/views/tags/javaMessagesWarning.scala.html deleted file mode 100644 index ecf656e..0000000 --- a/play26-bootstrap3/sample/app/views/tags/javaMessagesWarning.scala.html +++ /dev/null @@ -1,19 +0,0 @@ -@(id: String = "") -@if(utils.BSVersion.play_code == "2.4") { -
- -
-
- From Play 2.4, the implicit Messages argument defined in your custom template collides with the implicit one taken from PlayMagicForJava object, and it raises - a compilation error. So you only need to remove this implicit argument from your custom template. -
-
-
-} \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/repository/file.scala.html b/play26-bootstrap3/sample/app/views/tags/repository/file.scala.html deleted file mode 100644 index 3264bde..0000000 --- a/play26-bootstrap3/sample/app/views/tags/repository/file.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(file: String, text: String = "") -@resource(utils.BSVersion.repositoryFile(file), text) \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/repository/folder.scala.html b/play26-bootstrap3/sample/app/views/tags/repository/folder.scala.html deleted file mode 100644 index 70698e3..0000000 --- a/play26-bootstrap3/sample/app/views/tags/repository/folder.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(folder: String, text: String = "") -@resource(utils.BSVersion.repositoryFile(folder), text) \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/repository/home.scala.html b/play26-bootstrap3/sample/app/views/tags/repository/home.scala.html deleted file mode 100644 index 57fed4d..0000000 --- a/play26-bootstrap3/sample/app/views/tags/repository/home.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(text: String = "Github", theClass: String = "") -@resource(utils.BSVersion.repository, text, theClass) \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/repository/resource.scala.html b/play26-bootstrap3/sample/app/views/tags/repository/resource.scala.html deleted file mode 100644 index 30ca245..0000000 --- a/play26-bootstrap3/sample/app/views/tags/repository/resource.scala.html +++ /dev/null @@ -1,2 +0,0 @@ -@(resource: String, text: String = "", theClass: String = "") -@Html(if (text != "") text else resource.replaceAll("^.*/", "")) \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/tags/versionBadge.scala.html b/play26-bootstrap3/sample/app/views/tags/versionBadge.scala.html deleted file mode 100644 index 5d87ba7..0000000 --- a/play26-bootstrap3/sample/app/views/tags/versionBadge.scala.html +++ /dev/null @@ -1,12 +0,0 @@ -@(explicit: Boolean = false) -@import utils.BSVersion._ - - @code - - @if(explicit) { -  @play  @bootstrap  - } else { -  @play_code  @bootstrap_code  - } - - \ No newline at end of file diff --git a/play26-bootstrap3/sample/app/views/vertical.scala.html b/play26-bootstrap3/sample/app/views/vertical.scala.html deleted file mode 100644 index 6809456..0000000 --- a/play26-bootstrap3/sample/app/views/vertical.scala.html +++ /dev/null @@ -1,218 +0,0 @@ -@(fooForm: Form[String])(implicit request: MessagesRequestHeader) -@import utils.BSVersion -@import tags._ -@implicitFieldConstructor = @{ b3.vertical.fieldConstructor() } - -@fruits = @{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - - -@main("Vertical Form", tab = "styles") { - -

Vertical Form

- -

Simple inputs

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@mail.com" ) -
-
- @b3.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @b3.file( fooForm("foo"), '_label -> "File" ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.email( fooForm("foo"), '_label -> "Email", 'placeholder -> "example@@mail.com" ) - @@b3.password( fooForm("foo"), '_label -> "Password", 'placeholder -> "Password" ) - @@b3.file( fooForm("foo"), '_label -> "File" ) - } - -

More options

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @b3.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) -
-
- @b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @b3.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Input Text", 'placeholder -> "A simple text..." ) - @@b3.text( fooForm("foo"), '_label -> "Help", '_help -> "This is a help text", 'placeholder -> "A simple text showing a help..." ) - @@b3.text( fooForm("foo"), '_label -> "Constraints", '_showConstraints -> true, 'placeholder -> "A simple text showing its constraints..." ) - @@b3.text( fooForm("foo"), 'placeholder -> "Without label" ) - @@b3.text( fooForm("foo"), '_label -> "A big text", 'class -> "form-control input-lg", 'placeholder -> "An awesome field..." ) - } - - -

Textareas, checkboxes, radio buttons and selects

- @bsExampleWithCode { -
-
- @b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) -
-
- @b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @b3.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) -
-
- }{ - @@b3.textarea( fooForm("foo"), '_label -> "Textarea", 'rows -> 3 ) - @@b3.checkbox( fooForm("foo"), '_text -> "Checkbox", 'checked -> true ) - @@b3.radio( fooForm("foo"), options = Seq("M"->"Male","F"->"Female"), '_label -> "Radio Group" ) - - @@fruits = @@{ Seq("A"->"Apples","P"->"Pears","B"->"Bananas") } - ... - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select" ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Multiple Select", 'multiple -> true ) - } - -

Disabled and readonly attributes

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) -
-
- @b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Disabled", 'disabled -> true, 'placeholder -> "Disabled text..." ) - @@b3.checkbox( fooForm("foo"), '_text -> "Readonly checkbox", 'readonly -> true, 'value -> true ) - @@b3.select( fooForm("foo"), options = fruits, '_label -> "Select", 'multiple -> true, 'readonly -> true, 'value -> "B,P" ) - } - -

Validation states

- @bsExampleWithCode { -
-
- @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- @b3.vertical.form(routes.Application.vertical, '_feedbackIcons -> true) { implicit fc => - @b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - @b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) -
-
- }{ - @@b3.text( fooForm("foo"), '_label -> "Success", '_success -> "Great!", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - // With feedback icons - @@b3.text( fooForm("foo"), '_label -> "Success", '_showIconValid -> true, 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", '_showIconWarning -> true, 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_showIconOnError -> true, '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - - Or - - // With feedback icons - @@b3.vertical.form(routes.Application.vertical, '_feedbackIcons -> true) { implicit fc => - @@b3.text( fooForm("foo"), '_label -> "Success", 'placeholder -> "Success text..." ) - @@b3.text( fooForm("foo"), '_label -> "Warning", '_warning -> "Be carefull with this...", 'placeholder -> "Warning text..." ) - @@b3.text( fooForm("foo"), '_label -> "Error", '_error -> "An error occurred!", 'placeholder -> "Error text..." ) - } - } - - -

Customize them

- @bsExampleWithCode { -
-
- @b3.inputWrapped( "email", fooForm("foo"), '_label -> "Input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@ - @input -
- } - @b3.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
- - @input - -
- } -
-
- @b3.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @input -
- - - -
-
- } -
-
- }{ - @@b3.inputWrapped( "email", fooForm("foo"), '_label -> "Simple input group", 'placeholder -> "Custom input group for email..." ) { input => -
- @@@@ - @@input -
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_label -> "Fully customized", 'placeholder -> "A complicated one..." ) { input => -
- - @@input -
- -
-
- } - @@b3.inputWrapped( "text", fooForm("foo"), '_label -> "Number", 'value -> 0, '_help -> "This needs some JavaScript and CSS" ) { input => -
- - @@input - -
- } - } - -

More helpers

- @bsExampleWithCode { - @b3.static("Static HTML"){ This is a link } - @b3.submit('class -> "btn btn-default"){ Submit me! } - @b3.free() { - - Cancel - } - }{ - @@b3.static("Static HTML"){ This is a link } - @@b3.submit('class -> "btn btn-default"){ Submit me! } - @@b3.free() { - - Cancel - } - } - -} \ No newline at end of file diff --git a/play26-bootstrap3/sample/build.sbt b/play26-bootstrap3/sample/build.sbt deleted file mode 100644 index 8e33789..0000000 --- a/play26-bootstrap3/sample/build.sbt +++ /dev/null @@ -1,25 +0,0 @@ -name := """play-bootstrap-sample""" - -version := "1.4" - -scalaVersion := "2.12.4" - -routesGenerator := InjectedRoutesGenerator - -lazy val root = (project in file(".")).enablePlugins(PlayScala) - - -resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" - -libraryDependencies ++= Seq( - guice, - filters, - "com.adrianhurt" %% "play-bootstrap" % "1.4-P26-B3-SNAPSHOT", - "org.webjars" % "bootstrap" % "3.3.7-1" exclude("org.webjars", "jquery"), - "org.webjars" % "jquery" % "3.3.1-1", - "org.webjars" % "font-awesome" % "4.7.0", - "org.webjars" % "bootstrap-datepicker" % "1.4.0" exclude("org.webjars", "bootstrap") -) - - -scalariformSettings diff --git a/play26-bootstrap3/sample/conf/application.conf b/play26-bootstrap3/sample/conf/application.conf deleted file mode 100644 index 83b024d..0000000 --- a/play26-bootstrap3/sample/conf/application.conf +++ /dev/null @@ -1,54 +0,0 @@ -# This is the main configuration file for the application. -# ~~~~~ - -# Secret key -# ~~~~~ -# The secret key is used to secure cryptographics functions. -# -# This must be changed for production, but we recommend not changing it in this file. -# -# See http://www.playframework.com/documentation/latest/ApplicationSecret for more details. -play.http.secret.key="AQD]D`KQXB4Bx`bSG9v1n[Piq;Q4d=BB>SxEJfo01DeQd9;0`cgc" - -# The application languages -# ~~~~~ -play.i18n.langs=[ "en" ] - -# The filters -# ~~~~~ -play.http.filters = "Filters" - -# Global object class -# ~~~~~ -# Define the Global object class for this application. -# Default to Global in the root package. -# application.global=Global - -# Router -# ~~~~~ -# Define the Router object to use for this application. -# This router will be looked up first when the application is starting up, -# so make sure this is the entry point. -# Furthermore, it's assumed your route file is named properly. -# So for an application router like `my.application.Router`, -# you may need to define a router file `conf/my.application.routes`. -# Default to Routes in the root package (and conf/routes) -# play.http.router=my.application.Routes - -# Database configuration -# ~~~~~ -# You can declare as many datasources as you want. -# By convention, the default datasource is named `default` -# -# db.default.driver=org.h2.Driver -# db.default.url="jdbc:h2:mem:play" -# db.default.user=sa -# db.default.password="" - -# Evolutions -# ~~~~~ -# You can disable evolutions if needed -# evolutionplugin=disabled - - - diff --git a/play26-bootstrap3/sample/conf/routes b/play26-bootstrap3/sample/conf/routes deleted file mode 100644 index 080c7cb..0000000 --- a/play26-bootstrap3/sample/conf/routes +++ /dev/null @@ -1,21 +0,0 @@ -# Routes -# This file defines all application routes (Higher priority routes first) -# ~~~~ - -# Home page -GET / controllers.Application.index -GET /vertical controllers.Application.vertical -GET /horizontal controllers.Application.horizontal -GET /inline controllers.Application.inline -GET /mixed controllers.Application.mixed -GET /readonly controllers.Application.readonly -GET /multifield controllers.Application.multifield -GET /extend-it controllers.Application.extendIt -GET /docs controllers.Application.docs - - -GET /changelog controllers.Default.redirect(to = "http://adrianhurt.github.io/play-bootstrap/changelog") - - -# Map static resources from the /public folder to the /assets URL path -GET /assets/*file controllers.Assets.at(path="/public", file) diff --git a/play26-bootstrap3/sample/project/build.properties b/play26-bootstrap3/sample/project/build.properties deleted file mode 100644 index 37c5db2..0000000 --- a/play26-bootstrap3/sample/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Activator-generated Properties -#Sun Aug 03 14:36:39 BST 2014 -template.uuid=688014f0-0585-43e3-a9fa-d62f7d12f1ab -sbt.version=0.13.17 diff --git a/play26-bootstrap3/sample/project/plugins.sbt b/play26-bootstrap3/sample/project/plugins.sbt deleted file mode 100644 index b97d6e4..0000000 --- a/play26-bootstrap3/sample/project/plugins.sbt +++ /dev/null @@ -1,12 +0,0 @@ -resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" - -// The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12") - -// web plugins - -addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0") - -addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6") - -addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") diff --git a/play26-bootstrap3/sample/public/images/favicon.ico b/play26-bootstrap3/sample/public/images/favicon.ico deleted file mode 100644 index ac4bf59..0000000 Binary files a/play26-bootstrap3/sample/public/images/favicon.ico and /dev/null differ diff --git a/play26-bootstrap3/sample/public/images/logo.gif b/play26-bootstrap3/sample/public/images/logo.gif deleted file mode 100644 index db8eced..0000000 Binary files a/play26-bootstrap3/sample/public/images/logo.gif and /dev/null differ diff --git a/play26-bootstrap3/sample/public/images/please_star.png b/play26-bootstrap3/sample/public/images/please_star.png deleted file mode 100644 index d9489ba..0000000 Binary files a/play26-bootstrap3/sample/public/images/please_star.png and /dev/null differ diff --git a/play26-bootstrap3/sample/public/stylesheets/docs.min.css b/play26-bootstrap3/sample/public/stylesheets/docs.min.css deleted file mode 100644 index 7da4e4a..0000000 --- a/play26-bootstrap3/sample/public/stylesheets/docs.min.css +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Bootstrap Docs (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under the Creative Commons Attribution 3.0 Unported License. For - * details, see http://creativecommons.org/licenses/by/3.0/. - */body{position:relative}.table code{font-size:13px;font-weight:400}.btn-outline{color:#563d7c;background-color:transparent;border-color:#563d7c}.btn-outline:hover,.btn-outline:focus,.btn-outline:active{color:#fff;background-color:#563d7c;border-color:#563d7c}.btn-outline-inverse{color:#fff;background-color:transparent;border-color:#cdbfe3}.btn-outline-inverse:hover,.btn-outline-inverse:focus,.btn-outline-inverse:active{color:#563d7c;text-shadow:none;background-color:#fff;border-color:#fff}.bs-docs-booticon{display:block;font-weight:500;color:#fff;text-align:center;cursor:default;background-color:#563d7c;border-radius:15%}.bs-docs-booticon-sm{width:30px;height:30px;font-size:20px;line-height:28px}.bs-docs-booticon-lg{width:144px;height:144px;font-size:108px;line-height:140px}.bs-docs-booticon-inverse{color:#563d7c;background-color:#fff}.bs-docs-booticon-outline{background-color:transparent;border:1px solid #cdbfe3}.bs-docs-nav{margin-bottom:0;background-color:#fff;border-bottom:0}.bs-home-nav .bs-nav-b{display:none}.bs-docs-nav .navbar-brand,.bs-docs-nav .navbar-nav>li>a{font-weight:500;color:#563d7c}.bs-docs-nav .navbar-nav>li>a:hover,.bs-docs-nav .navbar-nav>.active>a,.bs-docs-nav .navbar-nav>.active>a:hover{color:#463265;background-color:#f9f9f9}.bs-docs-nav .navbar-toggle .icon-bar{background-color:#563d7c}.bs-docs-nav .navbar-header .navbar-toggle{border-color:#fff}.bs-docs-nav .navbar-header .navbar-toggle:hover,.bs-docs-nav .navbar-header .navbar-toggle:focus{background-color:#f9f9f9;border-color:#f9f9f9}.bs-docs-footer{padding-top:40px;padding-bottom:40px;margin-top:100px;color:#777;text-align:center;border-top:1px solid #e5e5e5}.bs-docs-footer-links{padding-left:0;margin-top:20px;color:#999}.bs-docs-footer-links li{display:inline;padding:0 2px}.bs-docs-footer-links li:first-child{padding-left:0}@media (min-width:768px){.bs-docs-footer p{margin-bottom:0}}.bs-docs-social{margin-bottom:20px;text-align:center}.bs-docs-social-buttons{display:inline-block;padding-left:0;margin-bottom:0;list-style:none}.bs-docs-social-buttons li{display:inline-block;padding:5px 8px;line-height:1}.bs-docs-social-buttons .twitter-follow-button{width:225px!important}.bs-docs-social-buttons .twitter-share-button{width:98px!important}.github-btn{overflow:hidden;border:0}.bs-docs-masthead,.bs-docs-header{position:relative;padding:30px 15px;color:#cdbfe3;text-align:center;text-shadow:0 1px 0 rgba(0,0,0,.1);background-color:#6f5499;background-image:-webkit-gradient(linear,left top,left bottom,from(#563d7c),to(#6f5499));background-image:-webkit-linear-gradient(top,#563d7c 0,#6f5499 100%);background-image:-o-linear-gradient(top,#563d7c 0,#6f5499 100%);background-image:linear-gradient(to bottom,#563d7c 0,#6f5499 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#563d7c', endColorstr='#6F5499', GradientType=0);background-repeat:repeat-x}.bs-docs-masthead .bs-docs-booticon{margin:0 auto 30px}.bs-docs-masthead h1{font-weight:300;line-height:1;color:#fff}.bs-docs-masthead .lead{margin:0 auto 30px;font-size:20px;color:#fff}.bs-docs-masthead .version{margin-top:-15px;margin-bottom:30px;color:#9783b9}.bs-docs-masthead .btn{width:100%;padding:15px 30px;font-size:20px}@media (min-width:480px){.bs-docs-masthead .btn{width:auto}}@media (min-width:768px){.bs-docs-masthead{padding:80px 0}.bs-docs-masthead h1{font-size:60px}.bs-docs-masthead .lead{font-size:24px}}@media (min-width:992px){.bs-docs-masthead .lead{width:80%;font-size:30px}}.bs-docs-header{margin-bottom:40px;font-size:20px}.bs-docs-header h1{margin-top:0;color:#fff}.bs-docs-header p{margin-bottom:0;font-weight:300;line-height:1.4}.bs-docs-header .container{position:relative}@media (min-width:768px){.bs-docs-header{padding-top:60px;padding-bottom:60px;font-size:24px;text-align:left}.bs-docs-header h1{font-size:60px;line-height:1}}@media (min-width:992px){.bs-docs-header h1,.bs-docs-header p{margin-right:380px}}.carbonad{width:auto!important;height:auto!important;padding:20px!important;margin:30px -30px -31px!important;overflow:hidden;font-size:13px!important;line-height:16px!important;text-align:left;background:transparent!important;border:solid #866ab3!important;border-width:1px 0!important}.carbonad-img{margin:0!important}.carbonad-text,.carbonad-tag{display:block!important;float:none!important;width:auto!important;height:auto!important;margin-left:145px!important;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif!important}.carbonad-text{padding-top:0!important}.carbonad-tag{color:inherit!important;text-align:left!important}.carbonad-text a,.carbonad-tag a{color:#fff!important}.carbonad #azcarbon>img{display:none}@media (min-width:480px){.carbonad{width:330px!important;margin:20px auto!important;border-width:1px!important;border-radius:4px}.bs-docs-masthead .carbonad{margin:50px auto 0!important}}@media (min-width:768px){.carbonad{margin-right:0!important;margin-left:0!important}}@media (min-width:992px){.carbonad{position:absolute;top:0;right:15px;width:330px!important;padding:15px!important;margin:0!important}.bs-docs-masthead .carbonad{position:static}}.bs-docs-featurette{padding-top:40px;padding-bottom:40px;font-size:16px;line-height:1.5;color:#555;text-align:center;background-color:#fff;border-bottom:1px solid #e5e5e5}.bs-docs-featurette+.bs-docs-footer{margin-top:0;border-top:0}.bs-docs-featurette-title{margin-bottom:5px;font-size:30px;font-weight:400;color:#333}.half-rule{width:100px;margin:40px auto}.bs-docs-featurette h3{margin-bottom:5px;font-weight:400;color:#333}.bs-docs-featurette-img{display:block;margin-bottom:20px;color:#333}.bs-docs-featurette-img:hover{color:#428bca;text-decoration:none}.bs-docs-featurette-img img{display:block;margin-bottom:15px}@media (min-width:480px){.bs-docs-featurette .img-responsive{margin-top:30px}}@media (min-width:768px){.bs-docs-featurette{padding-top:100px;padding-bottom:100px}.bs-docs-featurette-title{font-size:40px}.bs-docs-featurette .lead{max-width:80%;margin-right:auto;margin-left:auto}.bs-docs-featured-sites .col-sm-3:first-child img{border-top-left-radius:4px;border-bottom-left-radius:4px}.bs-docs-featured-sites .col-sm-3:last-child img{border-top-right-radius:4px;border-bottom-right-radius:4px}.bs-docs-featurette .img-responsive{margin-top:0}}.bs-docs-featured-sites{margin-right:-1px;margin-left:-1px}.bs-docs-featured-sites .col-sm-3{padding-right:1px;padding-left:1px}.bs-docs-featured-sites .img-responsive{margin-bottom:15px}@media (min-width:480px){.bs-docs-featured-sites .img-responsive{margin-bottom:0}}@media (max-width:480px){.bs-examples{margin-right:-10px;margin-left:-10px}.bs-examples>[class^=col-]{padding-right:10px;padding-left:10px}}.bs-docs-sidebar.affix{position:static}@media (min-width:768px){.bs-docs-sidebar{padding-left:20px}}.bs-docs-sidenav{margin-top:20px;margin-bottom:20px}.bs-docs-sidebar .nav>li>a{display:block;padding:4px 20px;font-size:13px;font-weight:500;color:#999}.bs-docs-sidebar .nav>li>a:hover,.bs-docs-sidebar .nav>li>a:focus{padding-left:19px;color:#563d7c;text-decoration:none;background-color:transparent;border-left:1px solid #563d7c}.bs-docs-sidebar .nav>.active>a,.bs-docs-sidebar .nav>.active:hover>a,.bs-docs-sidebar .nav>.active:focus>a{padding-left:18px;font-weight:700;color:#563d7c;background-color:transparent;border-left:2px solid #563d7c}.bs-docs-sidebar .nav .nav{display:none;padding-bottom:10px}.bs-docs-sidebar .nav .nav>li>a{padding-top:1px;padding-bottom:1px;padding-left:30px;font-size:12px;font-weight:400}.bs-docs-sidebar .nav .nav>li>a:hover,.bs-docs-sidebar .nav .nav>li>a:focus{padding-left:29px}.bs-docs-sidebar .nav .nav>.active>a,.bs-docs-sidebar .nav .nav>.active:hover>a,.bs-docs-sidebar .nav .nav>.active:focus>a{padding-left:28px;font-weight:500}.back-to-top,.bs-docs-theme-toggle{display:none;padding:4px 10px;margin-top:10px;margin-left:10px;font-size:12px;font-weight:500;color:#999}.back-to-top:hover,.bs-docs-theme-toggle:hover{color:#563d7c;text-decoration:none}.bs-docs-theme-toggle{margin-top:0}@media (min-width:768px){.back-to-top,.bs-docs-theme-toggle{display:block}}@media (min-width:992px){.bs-docs-sidebar .nav>.active>ul{display:block}.bs-docs-sidebar.affix,.bs-docs-sidebar.affix-bottom{width:213px}.bs-docs-sidebar.affix{position:fixed;top:20px}.bs-docs-sidebar.affix-bottom{position:absolute}.bs-docs-sidebar.affix-bottom .bs-docs-sidenav,.bs-docs-sidebar.affix .bs-docs-sidenav{margin-top:0;margin-bottom:0}}@media (min-width:1200px){.bs-docs-sidebar.affix-bottom,.bs-docs-sidebar.affix{width:263px}}.bs-docs-section{margin-bottom:60px}.bs-docs-section:last-child{margin-bottom:0}h1[id]{padding-top:20px;margin-top:0}.bs-callout{padding:20px;margin:20px 0;border:1px solid #eee;border-left-width:5px;border-radius:3px}.bs-callout h4{margin-top:0;margin-bottom:5px}.bs-callout p:last-child{margin-bottom:0}.bs-callout code{border-radius:3px}.bs-callout+.bs-callout{margin-top:-5px}.bs-callout-danger{border-left-color:#d9534f}.bs-callout-danger h4{color:#d9534f}.bs-callout-warning{border-left-color:#f0ad4e}.bs-callout-warning h4{color:#f0ad4e}.bs-callout-info{border-left-color:#5bc0de}.bs-callout-info h4{color:#5bc0de}.color-swatches{margin:0 -5px;overflow:hidden}.color-swatch{float:left;width:60px;height:60px;margin:0 5px;border-radius:3px}@media (min-width:768px){.color-swatch{width:100px;height:100px}}.color-swatches .gray-darker{background-color:#222}.color-swatches .gray-dark{background-color:#333}.color-swatches .gray{background-color:#555}.color-swatches .gray-light{background-color:#999}.color-swatches .gray-lighter{background-color:#eee}.color-swatches .brand-primary{background-color:#428bca}.color-swatches .brand-success{background-color:#5cb85c}.color-swatches .brand-warning{background-color:#f0ad4e}.color-swatches .brand-danger{background-color:#d9534f}.color-swatches .brand-info{background-color:#5bc0de}.color-swatches .bs-purple{background-color:#563d7c}.color-swatches .bs-purple-light{background-color:#c7bfd3}.color-swatches .bs-purple-lighter{background-color:#e5e1ea}.color-swatches .bs-gray{background-color:#f9f9f9}.bs-team .team-member{line-height:32px;color:#555}.bs-team .team-member:hover{color:#333;text-decoration:none}.bs-team .github-btn{float:right;width:180px;height:20px;margin-top:6px}.bs-team img{float:left;width:32px;margin-right:10px;border-radius:4px}.show-grid{margin-bottom:15px}.show-grid [class^=col-]{padding-top:10px;padding-bottom:10px;background-color:#eee;background-color:rgba(86,61,124,.15);border:1px solid #ddd;border:1px solid rgba(86,61,124,.2)}.bs-example{position:relative;padding:45px 15px 15px;margin:0 -15px 15px;border-color:#e5e5e5 #eee #eee;border-style:solid;border-width:1px 0;-webkit-box-shadow:inset 0 3px 6px rgba(0,0,0,.05);box-shadow:inset 0 3px 6px rgba(0,0,0,.05)}.bs-example:after{position:absolute;top:15px;left:15px;font-size:12px;font-weight:700;color:#959595;text-transform:uppercase;letter-spacing:1px;content:"Example"}.bs-example+.highlight{margin:-15px -15px 15px;border-width:0 0 1px;border-radius:0}@media (min-width:768px){.bs-example{margin-right:0;margin-left:0;background-color:#fff;border-color:#ddd;border-width:1px;border-radius:4px 4px 0 0;-webkit-box-shadow:none;box-shadow:none}.bs-example+.highlight{margin-top:-16px;margin-right:0;margin-left:0;border-width:1px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}}.bs-example .container{width:auto}.bs-example>p:last-child,.bs-example>ul:last-child,.bs-example>ol:last-child,.bs-example>blockquote:last-child,.bs-example>.form-control:last-child,.bs-example>.table:last-child,.bs-example>.navbar:last-child,.bs-example>.jumbotron:last-child,.bs-example>.alert:last-child,.bs-example>.panel:last-child,.bs-example>.list-group:last-child,.bs-example>.well:last-child,.bs-example>.progress:last-child,.bs-example>.table-responsive:last-child>.table{margin-bottom:0}.bs-example>p>.close{float:none}.bs-example-type .table .type-info{color:#999;vertical-align:middle}.bs-example-type .table td{padding:15px 0;border-color:#eee}.bs-example-type .table tr:first-child td{border-top:0}.bs-example-type h1,.bs-example-type h2,.bs-example-type h3,.bs-example-type h4,.bs-example-type h5,.bs-example-type h6{margin:0}.bs-example-bg-classes p{padding:15px}.bs-example>.img-circle,.bs-example>.img-rounded,.bs-example>.img-thumbnail{margin:5px}.bs-example>.table-responsive>.table{background-color:#fff}.bs-example>.btn,.bs-example>.btn-group{margin-top:5px;margin-bottom:5px}.bs-example>.btn-toolbar+.btn-toolbar{margin-top:10px}.bs-example-control-sizing select,.bs-example-control-sizing input[type=text]+input[type=text]{margin-top:10px}.bs-example-form .input-group{margin-bottom:10px}.bs-example>textarea.form-control{resize:vertical}.bs-example>.list-group{max-width:400px}.bs-example .navbar:last-child{margin-bottom:0}.bs-navbar-top-example,.bs-navbar-bottom-example{z-index:1;padding:0;overflow:hidden}.bs-navbar-top-example .navbar-header,.bs-navbar-bottom-example .navbar-header{margin-left:0}.bs-navbar-top-example .navbar-fixed-top,.bs-navbar-bottom-example .navbar-fixed-bottom{position:relative;margin-right:0;margin-left:0}.bs-navbar-top-example{padding-bottom:45px}.bs-navbar-top-example:after{top:auto;bottom:15px}.bs-navbar-top-example .navbar-fixed-top{top:-1px}.bs-navbar-bottom-example{padding-top:45px}.bs-navbar-bottom-example .navbar-fixed-bottom{bottom:-1px}.bs-navbar-bottom-example .navbar{margin-bottom:0}@media (min-width:768px){.bs-navbar-top-example .navbar-fixed-top,.bs-navbar-bottom-example .navbar-fixed-bottom{position:absolute}}.bs-example .pagination{margin-top:10px;margin-bottom:10px}.bs-example>.pager{margin-top:0}.bs-example-modal{background-color:#f5f5f5}.bs-example-modal .modal{position:relative;top:auto;right:auto;bottom:auto;left:auto;z-index:1;display:block}.bs-example-modal .modal-dialog{left:auto;margin-right:auto;margin-left:auto}.bs-example>.dropdown>.dropdown-toggle{float:left}.bs-example>.dropdown>.dropdown-menu{position:static;display:block;margin-bottom:5px;clear:left}.bs-example-tabs .nav-tabs{margin-bottom:15px}.bs-example-tooltips{text-align:center}.bs-example-tooltips>.btn{margin-top:5px;margin-bottom:5px}.bs-example-popover{padding-bottom:24px;background-color:#f9f9f9}.bs-example-popover .popover{position:relative;display:block;float:left;width:260px;margin:20px}.scrollspy-example{position:relative;height:200px;margin-top:10px;overflow:auto}.highlight{padding:9px 14px;margin-bottom:14px;background-color:#f7f7f9;border:1px solid #e1e1e8;border-radius:4px}.highlight pre{padding:0;margin-top:0;margin-bottom:0;word-break:normal;word-wrap:nowrap;white-space:nowrap;background-color:transparent;border:0}.highlight pre code{font-size:inherit;color:#333}.highlight pre code:first-child{display:inline-block;padding-right:45px}.table-responsive .highlight pre{white-space:normal}.bs-table th small,.responsive-utilities th small{display:block;font-weight:400;color:#999}.responsive-utilities tbody th{font-weight:400}.responsive-utilities td{text-align:center}.responsive-utilities td.is-visible{color:#468847;background-color:#dff0d8!important}.responsive-utilities td.is-hidden{color:#ccc;background-color:#f9f9f9!important}.responsive-utilities-test{margin-top:5px}.responsive-utilities-test .col-xs-6{margin-bottom:10px}.responsive-utilities-test span{display:block;padding:15px 10px;font-size:14px;font-weight:700;line-height:1.1;text-align:center;border-radius:4px}.visible-on .col-xs-6 .hidden-xs,.visible-on .col-xs-6 .hidden-sm,.visible-on .col-xs-6 .hidden-md,.visible-on .col-xs-6 .hidden-lg,.hidden-on .col-xs-6 .hidden-xs,.hidden-on .col-xs-6 .hidden-sm,.hidden-on .col-xs-6 .hidden-md,.hidden-on .col-xs-6 .hidden-lg{color:#999;border:1px solid #ddd}.visible-on .col-xs-6 .visible-xs-block,.visible-on .col-xs-6 .visible-sm-block,.visible-on .col-xs-6 .visible-md-block,.visible-on .col-xs-6 .visible-lg-block,.hidden-on .col-xs-6 .visible-xs-block,.hidden-on .col-xs-6 .visible-sm-block,.hidden-on .col-xs-6 .visible-md-block,.hidden-on .col-xs-6 .visible-lg-block{color:#468847;background-color:#dff0d8;border:1px solid #d6e9c6}.bs-glyphicons{margin:0 -10px 20px;overflow:hidden}.bs-glyphicons-list{padding-left:0;list-style:none}.bs-glyphicons li{float:left;width:25%;height:115px;padding:10px;font-size:10px;line-height:1.4;text-align:center;background-color:#f9f9f9;border:1px solid #fff}.bs-glyphicons .glyphicon{margin-top:5px;margin-bottom:10px;font-size:24px}.bs-glyphicons .glyphicon-class{display:block;text-align:center;word-wrap:break-word}.bs-glyphicons li:hover{color:#fff;background-color:#563d7c}@media (min-width:768px){.bs-glyphicons{margin-right:0;margin-left:0}.bs-glyphicons li{width:12.5%;font-size:12px}}.bs-customizer .toggle{float:right;margin-top:25px}.bs-customizer label{margin-top:10px;font-weight:500;color:#555}.bs-customizer h2{padding-top:30px;margin-top:0;margin-bottom:5px}.bs-customizer h3{margin-bottom:0}.bs-customizer h4{margin-top:15px;margin-bottom:0}.bs-customizer .bs-callout h4{margin-top:0;margin-bottom:5px}.bs-customizer input[type=text]{font-family:Menlo,Monaco,Consolas,"Courier New",monospace;background-color:#fafafa}.bs-customizer .help-block{margin-bottom:5px;font-size:12px}#less-section label{font-weight:400}.bs-customizer-input{float:left;width:33.333333%;padding-right:15px;padding-left:15px}.bs-customize-download .btn-outline{padding:20px}.bs-customizer-alert{position:fixed;top:0;right:0;left:0;z-index:1030;padding:15px 0;color:#fff;background-color:#d9534f;border-bottom:1px solid #b94441;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25);box-shadow:inset 0 1px 0 rgba(255,255,255,.25)}.bs-customizer-alert .close{margin-top:-4px;font-size:24px}.bs-customizer-alert p{margin-bottom:0}.bs-customizer-alert .glyphicon{margin-right:5px}.bs-customizer-alert pre{margin:10px 0 0;color:#fff;background-color:#a83c3a;border-color:#973634;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 2px 4px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}.bs-brand-logos{display:table;width:100%;margin-bottom:15px;overflow:hidden;color:#563d7c;background-color:#f9f9f9;border-radius:4px}.bs-brand-item{padding:60px 0;text-align:center}.bs-brand-item+.bs-brand-item{border-top:1px solid #fff}.bs-brand-logos .inverse{color:#fff;background-color:#563d7c}.bs-brand-item .svg{width:144px;height:144px}.bs-brand-item h1,.bs-brand-item h3{margin-top:0;margin-bottom:0}.bs-brand-item .bs-docs-booticon{margin-right:auto;margin-left:auto}.bs-brand-item .glyphicon{width:30px;height:30px;margin:10px auto -10px;line-height:30px;color:#fff;border-radius:50%}.bs-brand-item .glyphicon-ok{background-color:#5cb85c}.bs-brand-item .glyphicon-remove{background-color:#d9534f}@media (min-width:768px){.bs-brand-item{display:table-cell;width:1%}.bs-brand-item+.bs-brand-item{border-top:0;border-left:1px solid #fff}.bs-brand-item h1{font-size:60px}}.bs-examples .thumbnail{margin-bottom:10px}.bs-examples h4{margin-bottom:5px}.bs-examples p{margin-bottom:20px}#focusedInput{border-color:#ccc;border-color:rgba(82,168,236,.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:0 0 8px rgba(82,168,236,.6);box-shadow:0 0 8px rgba(82,168,236,.6)}.zero-clipboard{position:relative;display:none}.btn-clipboard{position:absolute;top:0;right:0;z-index:10;display:block;padding:5px 8px;font-size:12px;color:#777;cursor:pointer;background-color:#fff;border:1px solid #e1e1e8;border-radius:0 4px 0 4px}.btn-clipboard-hover{color:#fff;background-color:#563d7c;border-color:#563d7c}@media (min-width:768px){.zero-clipboard{display:block}}.hll{background-color:#ffc}.c{color:#999}.err{color:#A00;background-color:#FAA}.k{color:#069}.o{color:#555}.cm{color:#999}.cp{color:#099}.c1{color:#999}.cs{color:#999}.gd{background-color:#FCC;border:1px solid #C00}.ge{font-style:italic}.gr{color:red}.gh{color:#030}.gi{background-color:#CFC;border:1px solid #0C0}.go{color:#AAA}.gp{color:#009}.gu{color:#030}.gt{color:#9C6}.kc{color:#069}.kd{color:#069}.kn{color:#069}.kp{color:#069}.kr{color:#069}.kt{color:#078}.m{color:#F60}.s{color:#d44950}.na{color:#4f9fcf}.nb{color:#366}.nc{color:#0A8}.no{color:#360}.nd{color:#99F}.ni{color:#999}.ne{color:#C00}.nf{color:#C0F}.nl{color:#99F}.nn{color:#0CF}.nt{color:#2f6f9f}.nv{color:#033}.ow{color:#000}.w{color:#bbb}.mf{color:#F60}.mh{color:#F60}.mi{color:#F60}.mo{color:#F60}.sb{color:#C30}.sc{color:#C30}.sd{color:#C30;font-style:italic}.s2{color:#C30}.se{color:#C30}.sh{color:#C30}.si{color:#A00}.sx{color:#C30}.sr{color:#3AA}.s1{color:#C30}.ss{color:#FC3}.bp{color:#366}.vc{color:#033}.vg{color:#033}.vi{color:#033}.il{color:#F60}.css .o,.css .o+.nt,.css .nt+.nt{color:#999} \ No newline at end of file diff --git a/play26-bootstrap3/sample/system.properties b/play26-bootstrap3/sample/system.properties deleted file mode 100644 index 916c446..0000000 --- a/play26-bootstrap3/sample/system.properties +++ /dev/null @@ -1 +0,0 @@ -java.runtime.version=1.8 \ No newline at end of file diff --git a/play26-bootstrap4/module/build.sbt b/play26-bootstrap4/module/build.sbt index 1a7efa1..77ecb16 100644 --- a/play26-bootstrap4/module/build.sbt +++ b/play26-bootstrap4/module/build.sbt @@ -1,10 +1,10 @@ name := """play-bootstrap""" -version := "1.4-P26-B4-SNAPSHOT" +version := "1.5-P26-B4-SNAPSHOT" -scalaVersion := "2.12.4" +scalaVersion := "2.12.8" -crossScalaVersions := Seq("2.12.4", "2.11.12") +crossScalaVersions := Seq("2.12.8", "2.11.12") resolvers ++= Seq( "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases", @@ -13,7 +13,7 @@ resolvers ++= Seq( libraryDependencies ++= Seq( filters % "provided", - "com.adrianhurt" %% "play-bootstrap-core" % "1.4-P26-SNAPSHOT", + "com.adrianhurt" %% "play-bootstrap-core" % "1.5-P26-SNAPSHOT", specs2 % Test ) diff --git a/play26-bootstrap4/module/project/plugins.sbt b/play26-bootstrap4/module/project/plugins.sbt index 69d2bb6..070c0e5 100644 --- a/play26-bootstrap4/module/project/plugins.sbt +++ b/play26-bootstrap4/module/project/plugins.sbt @@ -1,7 +1,7 @@ resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12") +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.21") // web plugins diff --git a/play26-bootstrap4/sample/build.sbt b/play26-bootstrap4/sample/build.sbt index 991b0e0..20b7a3e 100644 --- a/play26-bootstrap4/sample/build.sbt +++ b/play26-bootstrap4/sample/build.sbt @@ -1,8 +1,8 @@ name := """play-bootstrap-sample""" -version := "1.4" +version := "1.5" -scalaVersion := "2.12.4" +scalaVersion := "2.12.8" routesGenerator := InjectedRoutesGenerator @@ -14,9 +14,9 @@ resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repos libraryDependencies ++= Seq( guice, filters, - "com.adrianhurt" %% "play-bootstrap" % "1.4-P26-B4-SNAPSHOT", - "org.webjars" % "bootstrap" % "4.0.0-1" exclude("org.webjars", "jquery"), - "org.webjars" % "jquery" % "3.3.1-1", + "com.adrianhurt" %% "play-bootstrap" % "1.5-P26-B4-SNAPSHOT", + "org.webjars" % "bootstrap" % "4.3.1" exclude("org.webjars", "jquery"), + "org.webjars" % "jquery" % "3.3.1-2", "org.webjars" % "font-awesome" % "4.7.0", "org.webjars" % "bootstrap-datepicker" % "1.4.0" exclude("org.webjars", "bootstrap") ) diff --git a/play26-bootstrap4/sample/project/plugins.sbt b/play26-bootstrap4/sample/project/plugins.sbt index b97d6e4..e4e6020 100644 --- a/play26-bootstrap4/sample/project/plugins.sbt +++ b/play26-bootstrap4/sample/project/plugins.sbt @@ -1,7 +1,7 @@ resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12") +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.21") // web plugins