Configure fadeOut*** at one place
I separate business transaction from UI logic.
When create or update business model will occur notice or error,
and then do something for UI by the business transaction
for example:
business:
def MyBusinessTransaction(v: String) : Option[MyModel] = {
val myModel = MyModel.create.title(v)
myModel.validate match {
case Nil => {myModel.save();Some(myModel)}
case xs => {S.error(xs);None}
}
}
Snippet
def doSomething(): JsCmd = MyBusinessTransaction(v) match {
case Some(v) => //do something for UI, such as replace the old value
case None => //notice what's wrong. I could code fadeOutErrors(5 seconds, 1 second) if want, but should I code every where?
}
I think it's better could configure this at one place but not code every where.
Thanks
When create or update business model will occur notice or error,
and then do something for UI by the business transaction
for example:
business:
def MyBusinessTransaction(v: String) : Option[MyModel] = {
val myModel = MyModel.create.title(v)
myModel.validate match {
case Nil => {myModel.save();Some(myModel)}
case xs => {S.error(xs);None}
}
}
Snippet
def doSomething(): JsCmd = MyBusinessTransaction(v) match {
case Some(v) => //do something for UI, such as replace the old value
case None => //notice what's wrong. I could code fadeOutErrors(5 seconds, 1 second) if want, but should I code every where?
}
I think it's better could configure this at one place but not code every where.
Thanks
Leave a comment