Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Fashionbase/framework
...
head fork: lift/framework
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 11 files changed
  • 0 commit comments
  • 1 contributor
View
2  web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala
@@ -1296,7 +1296,7 @@ class LiftRules() extends Factory with FormVendor with LazyLoggable {
* Modifies the root relative paths from the css url-s
*
* @param path - the path of the css resource
- * @prefix - the prefix to be added on the root relative paths. If this is Empty
+ * @param prefix - the prefix to be added on the root relative paths. If this is Empty
* the prefix will be the application context path.
*/
def fixCSS(path: List[String], prefix: Box[String]) {
View
20 web/webkit/src/main/scala/net/liftweb/http/LiftScreen.scala
@@ -598,13 +598,13 @@ trait AbstractScreen extends Factory {
* also call-by-name which is handy for constructs like:
* <code class="scala">SomeExternalRequestVarOrSessionVar.get</code>
*
- * @theToForm - a function to convert the field into a form
+ * @param theToForm - a function to convert the field into a form
*
- * @otherValue - a handy way include other values in the field. The other value is
+ * @param otherValue - a handy way include other values in the field. The other value is
* calcualted when the field is initialized. You can, for example, put
* a list of valid options in the field.
*
- * @stuff - a list of filters and validations for the field
+ * @param stuff - a list of filters and validations for the field
*
* @return a newly minted Field
*/
@@ -675,7 +675,7 @@ trait AbstractScreen extends Factory {
* @param defaultValue the starting value of the field (call-by-name)
* @param stuff the filters, validators and attributes
*
- * @returns a newly minted Field
+ * @return a newly minted Field
*/
protected def password(name: => String, defaultValue: => String, stuff: FilterOrValidate[String]*): Field {type ValueType = String} = {
val eAttr = grabParams(stuff)
@@ -694,7 +694,7 @@ trait AbstractScreen extends Factory {
* @param defaultValue the starting value of the field (call-by-name)
* @param stuff the filters, validators and attributes
*
- * @returns a newly minted Field
+ * @return a newly minted Field
*/
protected def text(name: => String, defaultValue: => String, stuff: FilterOrValidate[String]*): Field {type ValueType = String} = {
val eAttr = grabParams(stuff)
@@ -715,7 +715,7 @@ trait AbstractScreen extends Factory {
*
* @param stuff - a list of filters and validations for the field
*
- * @returns a newly minted Field{type ValueType = String}
+ * @return a newly minted Field{type ValueType = String}
*/
protected def textarea(name: => String, defaultValue: => String, stuff: FilterOrValidate[String]*): Field {type ValueType = String} =
textarea(name, defaultValue, 5, 80, stuff: _*)
@@ -731,7 +731,7 @@ trait AbstractScreen extends Factory {
*
* @param stuff - a list of filters and validations for the field
*
- * @returns a newly minted Field{type ValueType = String}
+ * @return a newly minted Field{type ValueType = String}
*/
protected def textarea(name: => String, defaultValue: => String, rows: Int, cols: Int, stuff: FilterOrValidate[String]*):
Field {type ValueType = String} = {
@@ -759,7 +759,7 @@ trait AbstractScreen extends Factory {
* @param stuff - a list of filters and validations for the field
* @param f a PairStringPromoter (a wrapper around a function) that converts T => display String
*
- * @returns a newly minted Field{type ValueType = String}
+ * @return a newly minted Field{type ValueType = String}
*/
protected def select[T](name: => String, default: => T, choices: => Seq[T], stuff: FilterOrValidate[T]*)
(implicit f: SHtml.PairStringPromoter[T]): Field {type ValueType = T; type OtherValueType = Seq[T]}
@@ -784,7 +784,7 @@ trait AbstractScreen extends Factory {
* @param stuff - a list of filters and validations for the field
* @param f a PairStringPromoter (a wrapper around a function) that converts T => display String
*
- * @returns a newly minted Field{type ValueType = String}
+ * @return a newly minted Field{type ValueType = String}
*/
protected def multiselect[T](name: => String, default: => Seq[T], choices: => Seq[T], stuff: FilterOrValidate[Seq[T]]*)
(implicit f: SHtml.PairStringPromoter[T]): Field {type ValueType = Seq[T]; type OtherValueType = Seq[T]}
@@ -824,7 +824,7 @@ trait AbstractScreen extends Factory {
* @param stuff - a list of filters and validations for the field
* @param f a PairStringPromoter (a wrapper around a function) that converts T => display String
*
- * @returns a newly minted Field{type ValueType = String}
+ * @return a newly minted Field{type ValueType = String}
*/
protected def radio(name: => String, default: => String, choices: => Seq[String], stuff: FilterOrValidate[String]*):
Field {type ValueType = String; type OtherValueType = Seq[String]} = {
View
2  web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala
@@ -974,7 +974,7 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
* @param path -- the ParsePath that led to this page
* @param code -- the HTTP response code (usually 200)
*
- * @returns a Box of LiftResponse with all the proper page rewriting
+ * @return a Box of LiftResponse with all the proper page rewriting
*/
def processTemplate(template: Box[NodeSeq], request: Req, path: ParsePath, code: Int): Box[LiftResponse] = {
overrideResponseCode.doWith(Empty) {
View
2  web/webkit/src/main/scala/net/liftweb/http/S.scala
@@ -700,7 +700,7 @@ trait S extends HasParams with Loggable {
*
*
* @param name A name for the rewrite function so that it can be replaced or deleted later.
- * @rw The rewrite partial function
+ * @param rw The rewrite partial function
*
* @see LiftRules.rewrite
* @see # sessionRewriter
View
10 web/webkit/src/main/scala/net/liftweb/http/SHtml.scala
@@ -943,10 +943,10 @@ trait SHtml {
/**
* create an anchor tag around a body
*
- * @to - the target
+ * @param to - the target
* @param func - the function to invoke when the link is clicked
* @param body - the NodeSeq to wrap in the anchor tag
- * @attrs - the (optional) attributes for the HTML element
+ * @param attrs - the (optional) attributes for the HTML element
*/
def link(to: String, func: () => Any, body: NodeSeq,
attrs: ElemAttr*): Elem = {
@@ -1526,14 +1526,14 @@ trait SHtml {
* the request will be processed by the jsonHandler
*
* @param jsonHandler - the handler that process this request
- * @oaram formId - the id of the form
+ * @param formId - the id of the form
*/
def submitJsonForm(jsonHandler: JsonHandler, formId: String):JsCmd = jsonHandler.call("processForm", FormToJSON(formId))
/**
* Having a regular form, this method can be used to send the serialized content of the form.
*
- * @oaram formId - the id of the form
+ * @param formId - the id of the form
*/
def submitAjaxForm(formId: String):JsCmd = SHtml.makeAjaxCall(LiftRules.jsArtifacts.serialize(formId))
@@ -1585,7 +1585,7 @@ trait SHtml {
/**
* Having a regular form, this method can be used to send the serialized content of the form.
*
- * @oaram formId - the id of the form
+ * @param formId - the id of the form
* @param postSubmit - the function that needs to be called after a successfull request
*/
def submitAjaxForm(formId: String, postSubmit: Call):JsCmd =
View
4 web/webkit/src/main/scala/net/liftweb/http/StatefulSnippet.scala
@@ -81,10 +81,10 @@ trait StatefulSnippet extends DispatchSnippet {
/**
* create an anchor tag around a body
*
- * @to - the target
+ * @param to - the target
* @param func - the function to invoke when the link is clicked
* @param body - the NodeSeq to wrap in the anchor tag
- * @attrs - the (optional) attributes for the HTML element
+ * @param attrs - the (optional) attributes for the HTML element
*/
def link(to: String, func: () => Any, body: NodeSeq, attrs: SHtml.ElemAttr*): Elem =
SHtml.link(to, () => { registerThisSnippet(); func() }, body, attrs: _*)
View
276 web/webkit/src/main/scala/net/liftweb/http/js/JsCommands.scala
@@ -193,7 +193,6 @@ trait JsExp extends HtmlFixer with ToJsCmd {
@deprecated
def >>(right: JsMember): JsExp = ~>(right)
-
def cmd: JsCmd = JsCmds.Run(toJsCmd + ";")
@@ -204,7 +203,34 @@ trait JsExp extends HtmlFixer with ToJsCmd {
def ===(right: JsExp): JsExp = new JsExp {
def toJsCmd = JsExp.this.toJsCmd + " = " + right.toJsCmd
}
-
+
+ /**
+ * Creates a Javascript statement testing whether this JsExp is less than the given JsExp.
+ *
+ * @see JE.JsLt
+ */
+ def <(right: JsExp) = JE.JsLt(this, right)
+
+ /**
+ * Creates a Javascript statement testing whether this JsExp is greater than the given JsExp.
+ *
+ * @see JE.JsGt
+ */
+ def >(right: JsExp) = JE.JsGt(this, right)
+
+ /**
+ * Creates a Javascript statement testing whether this JsExp is less than or equal to the given JsExp.
+ *
+ * @see JE.JsLtEq
+ */
+ def <=(right: JsExp) = JE.JsLtEq(this, right)
+
+ /**
+ * Creates a Javascript statement testing whether this JsExp is greater than or equal to the given JsExp.
+ *
+ * @see JE.JsGtEq
+ */
+ def >=(right: JsExp) = JE.JsGtEq(this, right)
}
trait JsMember {
@@ -431,9 +457,58 @@ object JE {
def toJsCmd = rawJsCmd
}
+ /**
+ * A Scala representation of a Javascript variable.
+ *
+ * @see Var
+ */
case class JsVar(varName: String, andThen: String*) extends JsExp {
def toJsCmd = varName + (if (andThen.isEmpty) ""
else andThen.mkString(".", ".", ""))
+ def ++ = JsRaw(toJsCmd + "++")
+ def -- = JsRaw(toJsCmd + "--")
+ def +=(right: JsExp) = JsRaw(toJsCmd + " += " + right.toJsCmd)
+ def -=(right: JsExp) = JsRaw(toJsCmd + " -= " + right.toJsCmd)
+
+ /**
+ * Refer to the variable's property.
+ *
+ * Like JsExp's ~> this method accesses a property on the Javascript object.
+ * However, unlike that method, this one returns another JsVar, rather than a simple JsExp.
+ * @see JsExp.~>
+ */
+ def -&(right: String) = JsVar(varName, (right :: andThen.toList.reverse).reverse :_*)
+
+ def apply(params: JsExp*) = Call(toJsCmd, params :_*)
+
+ /**
+ * Assign the given value to the Javascript variable.
+ *
+ * @see JsExp.===
+ */
+ def :=(right: JsExp) = ===(right)
+ }
+
+ /**
+ * An alias for {@link JsVar}, the Scala representation of a Javascript variable.
+ *
+ * @see JsVar
+ */
+ val Var = JsVar
+
+ /**
+ * Declare a Javascript variable.
+ *
+ * newVar should be used to declare a new variable, rather than refer to existing one. {@link JsCmds.JsCrVar} is its nearest, JsCmd analog.
+ * newVar was added to enable compatibility with the variable Javascript loop representations, which expect a JsExp for the inital statement.
+ * @see JsVar
+ * @see Var
+ * @see JsCmds.JsCrVar
+ * @see JsFor
+ * @see For
+ */
+ case class newVar(varName: String) extends JsExp {
+ def toJsCmd = "var " + varName
}
/**
@@ -459,17 +534,61 @@ object JE {
def toJsCmd = "value"
}
+ /**
+ * A Scala representation of the Javsacript false value.
+ *
+ * @see False
+ */
case object JsFalse extends JsExp {
def toJsCmd = "false"
}
+
+ /**
+ * An alias for {@link JsFalse}, the Scala representation of the Javsacript false value.
+ *
+ * @see JsFalse
+ */
+ val False = JsFalse
+ /**
+ * A Scala representation of the Javsacript null value.
+ *
+ * @see Null
+ */
case object JsNull extends JsExp {
def toJsCmd = "null"
}
+
+ /**
+ * An alias for {@link JsNull}, the Scala representation of the Javsacript false value.
+ *
+ * @see JsNull
+ */
+ // NOTE: There is also a scala.xml.Null. Don't add this alias?
+ // val Null = JsNull
+ /**
+ * A Scala representation of the Javsacript true value.
+ *
+ * @see True
+ */
case object JsTrue extends JsExp {
def toJsCmd = "true"
}
+
+ /**
+ * An alias for {@link JsTrue}, the Scala representation of the Javsacript false value.
+ *
+ * @see JsTrue
+ */
+ val True = JsTrue
+
+ /**
+ * A Scala representation of the Javsacript undefined value.
+ */
+ case object Undefined extends JsExp {
+ def toJsCmd = "undefined"
+ }
/**
* A JavaScript method that takes parameters
@@ -907,6 +1026,11 @@ object JsCmds {
}.mkString("\n")+"};"
}
+ /**
+ * A Scala representation of the Javascript if statement.
+ *
+ * @see jIf
+ */
case object JsIf {
def apply(condition: JsExp, body: JsCmd): JsCmd = JE.JsRaw("if ( " + condition.toJsCmd + " ) { " + body.toJsCmd + " }")
@@ -918,37 +1042,178 @@ object JsCmds {
def apply(condition: JsExp, bodyTrue: JsExp, bodyFalse: JsExp): JsCmd =
JE.JsRaw("if ( " + condition.toJsCmd + " ) { " + bodyTrue.toJsCmd + " } else { " + bodyFalse.toJsCmd + " }")
}
+
+ /**
+ * Another Scala representation of the Javascript if statement.
+ *
+ * This case class is different from {@link JsIf} because it actually contains values that can be referenced later
+ * and the else clause can be explicitly set apart.
+ *
+ * This creates the possibility for a syntax closer to normal Javascript (or Scala) code. For example:
+ * <pre lang="scala">
+ * val console_log = Var("console") -& "log"
+ * jIf(Var("k") < 1) {
+ * console_log("Too small")
+ * } Else {
+ * console_log("Big enough")
+ * }
+ * </pre>
+ *
+ * NOTE: This is called jIf instead of If because there is also an If LocParam.
+ * @see JsIf
+ */
+ case class jIf(condition: JsExp)(body: JsExp) extends JsCmd {
+ def toJsCmd = "if ( " + condition.toJsCmd + " ) { " + body.toJsCmd + " }"
+ def toJsIf = JsIf(condition, body)
+ def Else(body2: JsExp) = JsIf(condition, body, body2)
+ }
+
+ /**
+ * An implicit conversion to convert from the newer If to the older JsIf.
+ *
+ * @see jIf
+ * @see JsIf
+ */
+ implicit def jIfToJsIf(i: jIf) = i.toJsIf
+ /**
+ * A Scala representation of the Javascript while loop statement.
+ *
+ * @see While
+ */
case class JsWhile(condition: JsExp, body: JsExp) extends JsCmd {
def toJsCmd = "while ( " + condition.toJsCmd + " ) { " + body.toJsCmd + " }"
}
+
+ /**
+ * An alias of {@link JsWhile}, the Scala representation of the Javascript while loop statement.
+ *
+ * @see JsWhile
+ */
+ object While {
+ def apply(condition: JsExp)(body: JsExp) = JsWhile(condition, body)
+ }
+ /**
+ * A Scala representation of the Javascript with statement.
+ *
+ * @see With
+ */
case class JsWith(reference: String, body: JsExp) extends JsCmd {
def toJsCmd = "with ( " + reference + " ) { " + body.toJsCmd + " }"
}
+
+ /**
+ * An alias of {@link JsWith}, the Scala representation of the Javascript with statement.
+ *
+ * @see JsWith
+ */
+ object With {
+ def apply(reference: String)(body: JsExp) = JsWhile(reference, body)
+ }
+ /**
+ * A Scala representation of the Javascript do..while loop statement.
+ *
+ * @see Do
+ */
case class JsDoWhile(body: JsExp, condition: JsExp) extends JsCmd {
def toJsCmd = "do { " + body.toJsCmd + " } while ( " + condition.toJsCmd + " )"
}
+
+ /**
+ * An alias for {@link JsDoWhile}, the Scala representation of the Javascript do..while loop statement.
+ *
+ * Note: This case class deliberately does not extend JsCmd so that the user is required to call the While method to have a usable construction.
+ * @see JsDoWhile
+ */
+ case class Do(body: JsExp) {
+ def While(condition: JsExp) = JsDoWhile(body, condition)
+ }
+ /**
+ * A Scala representation of the Javascript for loop statement.
+ *
+ * @see For
+ */
case class JsFor(initialExp: JsExp, condition: JsExp, incrementExp: JsExp, body: JsExp) extends JsCmd {
def toJsCmd = "for ( " + initialExp.toJsCmd + "; " +
condition.toJsCmd + "; " +
incrementExp.toJsCmd + " ) { " + body.toJsCmd + " }"
}
+
+ /**
+ * A Scala representation of the Javascript for loop statement whose parameter list is broken into two parts to enable more Javascript-looking code.
+ *
+ * For example:
+ * <pre lang="scala">
+ * val console_log = Var("console") -& "log"
+ * For(newVar("k") === 0, Var("k") < Var("someArray") -& "length", Var("k")++) {
+ * console_log(k)
+ * }
+ * </pre>
+ * @example For(var k = 0, k < someArray.length, k++) { console.log(k) }
+ * @see JsFor
+ */
+ object For {
+ def apply(initialExp: JsExp, condition: JsExp, incrementExp: JsExp)(body: JsExp) = JsFor(initialExp, condition, incrementExp, body)
+ }
+ /**
+ * A Scala representation of the Javascript for..in loop statement.
+ *
+ * @see ForIn
+ */
case class JsForIn(initialExp: JsExp, reference: String, body: JsCmd) extends JsCmd {
def toJsCmd = "for ( " + initialExp.toJsCmd + " in " + reference + ") { " + body.toJsCmd + " }"
}
+
+ /**
+ * An alias for {@link JsForIn}, the Scala representation of the Javascript for..in loop statement.
+ *
+ * @see JsForIn
+ */
+ object ForIn {
+ def apply(variable: JE.JsVar, reference: JE.JsVar)(body: JsExp) = JsForIn(variable.toJsCmd, reference.toJsCmd, body.cmd)
+ }
+ /**
+ * A Scala representation of the Javascript break statement.
+ *
+ * @see Break
+ */
case object JsBreak extends JsCmd {
def toJsCmd = "break"
}
+
+ /**
+ * An alias for {@link JsBreak}, the Scala representation of the Javascript break statement.
+ *
+ * @see JsBreak
+ */
+ val Break = JsBreak
+ /**
+ * A Scala representation of the Javascript continue statement.
+ *
+ * @see Continue
+ */
case object JsContinue extends JsCmd {
def toJsCmd = "continue"
}
+
+ /**
+ * An alias for {@link JsContinue}, the Scala representation of the Javascript continue statement.
+ *
+ * @see JsContinue
+ */
+ val Continue = JsContinue
+ /**
+ * A Scala representation of the Javascript return statement.
+ *
+ * @see Return
+ */
object JsReturn {
def apply(in: JsExp): JsCmd = new JsCmd {
def toJsCmd = "return " + in.toJsCmd
@@ -958,6 +1223,13 @@ object JsCmds {
def toJsCmd = "return "
}
}
+
+ /**
+ * An alias for {@link JsReturn}, the Scala representation of the Javascript return statement.
+ *
+ * @see JsReturn
+ */
+ val Return = JsReturn
}
View
6 web/webkit/src/main/scala/net/liftweb/http/provider/HTTPContext.scala
@@ -82,14 +82,14 @@ trait HTTPContext {
def attributes: List[(String, Any)]
/**
- * @param - name
- * @param - value. Any reference. Note that this is not typesfe and you need to explicitely do
+ * @param name
+ * @param value. Any reference. Note that this is not typesfe and you need to explicitely do
* the casting when reading this attribute.
*/
def setAttribute(name: String, value: Any): Unit
/**
- * @param - name. The name ofthe parameter that needs to be removed.
+ * @param name. The name ofthe parameter that needs to be removed.
*/
def removeAttribute(name: String): Unit
}
View
2  web/webkit/src/main/scala/net/liftweb/http/provider/HTTPSession.scala
@@ -45,7 +45,7 @@ trait HTTPSession {
def unlink(liftSession: LiftSession)
/**
- * @returns - the maximim interval in seconds between client request and the time when
+ * @return - the maximim interval in seconds between client request and the time when
* the session will be terminated
*
*/
View
6 web/webkit/src/main/scala/net/liftweb/http/rest/RestHelper.scala
@@ -319,7 +319,7 @@ trait RestHelper extends LiftRules.DispatchPF {
* type (e.g., JSON or XML).<br/><br/>
* @param selection -- a function that determines the response type
* based on the Req.
- * @parama pf -- a PartialFunction that converts the request to a
+ * @param pf -- a PartialFunction that converts the request to a
* response type (e.g., a case class that contains the response).
* @param cvt -- a function that converts from the response type
* to a the appropriate LiftResponse based on the selected response
@@ -352,7 +352,7 @@ trait RestHelper extends LiftRules.DispatchPF {
/**
* Serve a request returning either JSON or XML.
*
- * @parama pf -- a Partial Function that converts the request into
+ * @param pf -- a Partial Function that converts the request into
* an intermediate response.
* @param cvt -- convert the intermediate response to a LiftResponse
* based on the request being for XML or JSON. If T is JsonXmlAble,
@@ -371,7 +371,7 @@ trait RestHelper extends LiftRules.DispatchPF {
/**
* Serve a request returning either JSON or XML.
*
- * @parama pf -- a Partial Function that converts the request into
+ * @param pf -- a Partial Function that converts the request into
* Any (note that the response must be convertable into
* JSON vis Lift JSON Extraction.decompose
*/
View
4 web/webkit/src/main/scala/net/liftweb/sitemap/SiteMap.scala
@@ -134,7 +134,7 @@ sealed class SiteMapSingleton {
* @param pf the partial function (pattern match) to test against the Menu, if it matches, apply it which causes menu mutation.
* @param or the function to apply if none of the patterns match
*
- * @returns a function which will apply the changes to a SiteMap
+ * @return a function which will apply the changes to a SiteMap
*/
def sitemapMutator(pf: PartialFunction[Menu, List[Menu]])(or: SiteMap => SiteMap): SiteMap => SiteMap =
(sm: SiteMap) => {
@@ -167,7 +167,7 @@ sealed class SiteMapSingleton {
*
* @param pf the partial function (pattern match) to test against the Menu, if it matches, apply it which causes menu mutation.
*
- * @returns a function which will apply the changes to a SiteMap
+ * @return a function which will apply the changes to a SiteMap
*/
def simpleSitemapMutator(pf: PartialFunction[Menu, List[Menu]]) = sitemapMutator(pf)(s => s)

No commit comments for this range

Something went wrong with that request. Please try again.