@@ -33,30 +33,30 @@ package object bs {
3333 val argsMap : Map [Symbol , Any ] = Args .withoutNones(args).toMap
3434
3535 /* Id of the input */
36- val id : String = argsMap.get(' id ).map(_.toString).getOrElse(field.id)
36+ val id : String = argsMap.get(Symbol ( " id " ) ).map(_.toString).getOrElse(field.id)
3737
3838 /* Id of the form-group */
39- val idFormField : String = argsMap.get(' _id ).map(_.toString).getOrElse(id + " _field" )
39+ val idFormField : String = argsMap.get(Symbol ( " _id" ) ).map(_.toString).getOrElse(id + " _field" )
4040
4141 /* The optional label */
42- val labelOpt : Option [Any ] = argsMap.get(' _label ) .orElse(argsMap.get(' _hiddenLabel ))
42+ val labelOpt : Option [Any ] = argsMap.get(Symbol ( " _label" )) .orElse(argsMap.get(Symbol ( " _hiddenLabel" ) ))
4343
4444 /* Indicates if the label must be hidden */
45- val hideLabel : Boolean = isTrue(argsMap, ' _hideLabel ) || argsMap.contains(' _hiddenLabel )
45+ val hideLabel : Boolean = isTrue(argsMap, Symbol ( " _hideLabel" )) || argsMap.contains(Symbol ( " _hiddenLabel" ) )
4646
4747 /* Name of the input */
4848 def name : String = field.name
4949
5050 /* Value of the input */
51- val value : Option [String ] = field.value.orElse(argsMap.get(' value ).map(_.toString))
51+ val value : Option [String ] = field.value.orElse(argsMap.get(Symbol ( " value" ) ).map(_.toString))
5252
5353 /* List with every error and its corresponding ARIA id. Ex: ("foo_error_0" -> "foo error") */
5454 val errors : Seq [(String , Any )] = BSFieldInfo .errors(Some (field), argsMap, msgsProv).zipWithIndex.map {
5555 case (error, i) => (id + " _error_" + i, error)
5656 }
5757
5858 /* Indicates if there is any error */
59- val hasErrors : Boolean = ! errors.isEmpty || ArgsMap .isNotFalse(argsMap, ' _error )
59+ val hasErrors : Boolean = ! errors.isEmpty || ArgsMap .isNotFalse(argsMap, Symbol ( " _error" ) )
6060
6161 /* The optional validation state ("success", "warning" or "error") */
6262 lazy val status : Option [String ] = BSFieldInfo .status(hasErrors, argsMap)
@@ -74,30 +74,30 @@ package object bs {
7474
7575 /* List with every error */
7676 def errors (maybeField : Option [Field ], argsMap : Map [Symbol , Any ], msgsProv : MessagesProvider ): Seq [Any ] = {
77- argsMap.get(' _error ).filter(! _.isInstanceOf [Boolean ]).map {
77+ argsMap.get(Symbol ( " _error" ) ).filter(! _.isInstanceOf [Boolean ]).map {
7878 _ match {
7979 case Some (FormError (_, message, args)) => Seq (msgsProv.messages(message, args.map(a => translate(a)(msgsProv)): _* ))
8080 case FormError (_, message, args) => Seq (msgsProv.messages(message, args.map(a => translate(a)(msgsProv)): _* ))
8181 case message => Seq (translate(message)(msgsProv))
8282 }
8383 }.getOrElse {
84- maybeField.filter(_ => argsMap.get(' _showErrors ) != Some (false )).map { field =>
84+ maybeField.filter(_ => argsMap.get(Symbol ( " _showErrors" ) ) != Some (false )).map { field =>
8585 field.errors.map { e => msgsProv.messages(e.message, e.args.map(a => translate(a)(msgsProv)): _* ) }
8686 }.getOrElse(Nil )
8787 }
8888 }
8989
9090 /* List with every "feedback info" except "errors" */
9191 def feedbackInfosButErrors (argsMap : Map [Symbol , Any ], msgsProv : MessagesProvider ): Seq [Any ] = {
92- argsMap.get(' _warning ).filter(! _.isInstanceOf [Boolean ]).map(m => Seq (translate(m)(msgsProv))).getOrElse(
93- argsMap.get(' _success ).filter(! _.isInstanceOf [Boolean ]).map(m => Seq (translate(m)(msgsProv))).getOrElse(Nil )
92+ argsMap.get(Symbol ( " _warning" ) ).filter(! _.isInstanceOf [Boolean ]).map(m => Seq (translate(m)(msgsProv))).getOrElse(
93+ argsMap.get(Symbol ( " _success" ) ).filter(! _.isInstanceOf [Boolean ]).map(m => Seq (translate(m)(msgsProv))).getOrElse(Nil )
9494 )
9595 }
9696
9797 /* List with every "help info", i.e. a help text or constraints */
9898 def helpInfos (maybeField : Option [Field ], argsMap : Map [Symbol , Any ], msgsProv : MessagesProvider ): Seq [Any ] = {
99- argsMap.get(' _help ).map(m => Seq (translate(m)(msgsProv))).getOrElse {
100- maybeField.filter(_ => argsMap.get(' _showConstraints ) == Some (true )).map { field =>
99+ argsMap.get(Symbol ( " _help" ) ).map(m => Seq (translate(m)(msgsProv))).getOrElse {
100+ maybeField.filter(_ => argsMap.get(Symbol ( " _showConstraints" ) ) == Some (true )).map { field =>
101101 field.constraints.map(c => msgsProv.messages(c._1, c._2.map(a => translate(a)(msgsProv)): _* )) ++ field.format.map(f => msgsProv.messages(f._1, f._2.map(a => translate(a)(msgsProv)): _* ))
102102 }.getOrElse(Nil )
103103 }
@@ -107,24 +107,24 @@ package object bs {
107107 def status (hasErrors : Boolean , argsMap : Map [Symbol , Any ]): Option [String ] = {
108108 if (hasErrors)
109109 Some (" error" )
110- else if (ArgsMap .isNotFalse(argsMap, ' _warning ))
110+ else if (ArgsMap .isNotFalse(argsMap, Symbol ( " _warning" ) ))
111111 Some (" warning" )
112- else if (ArgsMap .isNotFalse(argsMap, ' _success ))
112+ else if (ArgsMap .isNotFalse(argsMap, Symbol ( " _success" ) ))
113113 Some (" success" )
114114 else
115115 None
116116 }
117117
118118 /* Generates automatically the input attributes for the constraints of a field */
119119 def constraintsArgs (field : Field , msgsProv : MessagesProvider ): Seq [(Symbol , Any )] = field.constraints.map {
120- case (" constraint.required" , params) => Some ((' required -> true ))
121- case (" constraint.min" , params : Seq [Any ]) => Some ((' min -> msgsProv.messages(params.head.toString)))
122- case (" constraint.max" , params : Seq [Any ]) => Some ((' max -> msgsProv.messages(params.head.toString)))
123- case (" constraint.minLength" , params : Seq [Any ]) => Some ((' minlength -> msgsProv.messages(params.head.toString)))
124- case (" constraint.maxLength" , params : Seq [Any ]) => Some ((' maxlength -> msgsProv.messages(params.head.toString)))
120+ case (" constraint.required" , params) => Some ((Symbol ( " required" ) -> true ))
121+ case (" constraint.min" , params : Seq [Any ]) => Some ((Symbol ( " min" ) -> msgsProv.messages(params.head.toString)))
122+ case (" constraint.max" , params : Seq [Any ]) => Some ((Symbol ( " max" ) -> msgsProv.messages(params.head.toString)))
123+ case (" constraint.minLength" , params : Seq [Any ]) => Some ((Symbol ( " minlength" ) -> msgsProv.messages(params.head.toString)))
124+ case (" constraint.maxLength" , params : Seq [Any ]) => Some ((Symbol ( " maxlength" ) -> msgsProv.messages(params.head.toString)))
125125 case (" constraint.pattern" , params : Seq [Any ]) => params.head match {
126- case str : String => Some ((' pattern -> msgsProv.messages(str)))
127- case func : Function0 [_] => Some ((' pattern -> msgsProv.messages(func.asInstanceOf [() => scala.util.matching.Regex ]().toString)))
126+ case str : String => Some ((Symbol ( " pattern" ) -> msgsProv.messages(str)))
127+ case func : Function0 [_] => Some ((Symbol ( " pattern" ) -> msgsProv.messages(func.asInstanceOf [() => scala.util.matching.Regex ]().toString)))
128128 case _ => None
129129 }
130130 case _ => None
@@ -154,7 +154,7 @@ package object bs {
154154 }
155155
156156 /* Indicates if there is any error */
157- val hasErrors : Boolean = ! errors.isEmpty || ArgsMap .isNotFalse(argsMap, ' _error )
157+ val hasErrors : Boolean = ! errors.isEmpty || ArgsMap .isNotFalse(argsMap, Symbol ( " _error" ) )
158158
159159 /* The optional validation state ("success", "warning" or "error") */
160160 lazy val status : Option [String ] = BSFieldInfo .status(hasErrors, argsMap)
0 commit comments