Created
May 8, 2012 21:39
-
-
Save Shadowfiend/2639553 to your computer and use it in GitHub Desktop.
Functions for extracting field names for Lift server-side functions as Strings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com { | |
package object openstudy { | |
def nameForStringField(fn:(String)=>Any) : String = { | |
S.fmapFunc(S.SFuncHolder(string => fn(string)))((name:String) => name) | |
} | |
def nameForFileUploadField(fn:(FileParamHolder)=>Any) : String = { | |
S.fmapFunc(S.BinFuncHolder(fph => if (fph.length > 0) fn(fph)))((name:String) => name) | |
} | |
def nameForSubmitButton(fn:()=>JsCmd) : String = { | |
S.fmapFunc(S.NFuncHolder(fn))((name:String) => name) | |
} | |
def submitFnFor(formId:String) = { | |
SHtml.makeAjaxCall(LiftRules.jsArtifacts.serialize(formId)).cmd.toJsCmd | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment