equal
deleted
inserted
replaced
13 * See the License for the specific language governing permissions and |
13 * See the License for the specific language governing permissions and |
14 * limitations under the License. |
14 * limitations under the License. |
15 */ |
15 */ |
16 package net.tz.lift.snippet |
16 package net.tz.lift.snippet |
17 |
17 |
|
18 import net.liftweb.common._ |
18 import net.liftweb.mapper.MappedField |
19 import net.liftweb.mapper.MappedField |
19 import scala.xml.{NodeSeq, Text} |
20 import scala.xml.{NodeSeq, Text} |
20 |
21 |
21 object AttrRow { |
22 object AttrRow { |
22 def apply(name: => NodeSeq, value: => NodeSeq) = new AttrRow(name, value, |
23 def apply(name: => NodeSeq, value: => NodeSeq) = new AttrRow(name, value, |
58 |
59 |
59 /** |
60 /** |
60 * A panel using template in <code>/templates-hidden/panel</code> for |
61 * A panel using template in <code>/templates-hidden/panel</code> for |
61 * values rendering. |
62 * values rendering. |
62 */ |
63 */ |
63 class TplPanel(cells: List[(NodeSeq, NodeSeq)]) extends CssTr { |
64 class TplPanel(caption: Box[String], cells: List[(NodeSeq, NodeSeq)], |
|
65 path: Box[List[String]]) extends CssTr { |
|
66 |
|
67 def this(cells: List[(NodeSeq, NodeSeq)], p: List[String]) = |
|
68 this(Empty, cells, Full(p)) |
|
69 def this(cells: List[(NodeSeq, NodeSeq)]) = this(Empty, cells, Empty) |
|
70 |
64 def apply(in: NodeSeq): NodeSeq = TemplateFinder.findAnyTemplate( |
71 def apply(in: NodeSeq): NodeSeq = TemplateFinder.findAnyTemplate( |
65 List("templates-hidden", "panel")) map { xml => |
72 path.openOr(List("templates-hidden", "panel"))) map { xml => |
66 (".row *" #> cells.map { r => |
73 (".caption *" #> caption & |
|
74 ".row *" #> cells.map { r => |
67 ".n *" #> r._1 & |
75 ".n *" #> r._1 & |
68 ".v *" #> r._2 |
76 ".v *" #> r._2 |
69 })(xml) |
77 })(xml) |
70 } openOr NodeSeq.Empty |
78 } openOr NodeSeq.Empty |
71 } |
79 } |