Odd-even coloring moved out from C# code to XSLT

main
Inga 🏳‍🌈 15 years ago
parent e32ca392d6
commit b83ed8281d
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Builder/IISUploadHandler/build.txt
  3. 11
      IISMainHandler/Extensions.cs
  4. 2
      IISMainHandler/handlers/BoardHandler.cs
  5. 2
      IISMainHandler/handlers/response/UserListHandler.cs
  6. 2
      templates/Full/UserList.xslt
  7. 2
      templates/Full/elems/ThreadInfo.xslt

@ -18,16 +18,5 @@ namespace FLocal.IISHandler {
return str.Split(new string[] { separator }, options); return str.Split(new string[] { separator }, options);
} }
public static IEnumerable<XElement> addNumbers(this IEnumerable<XElement> elements) {
int i=0;
foreach(XElement element in elements) {
XElement result = new XElement(element);
result.Add(new XElement("number", i));
result.Add(new XElement("even", (i%2 == 0).ToPlainString()));
i++;
yield return result;
}
}
} }
} }

@ -27,7 +27,7 @@ namespace FLocal.IISHandler.handlers {
new XElement("currentLocation", board.exportToXmlSimpleWithParent(context)), new XElement("currentLocation", board.exportToXmlSimpleWithParent(context)),
new XElement("boards", from subBoard in board.subBoards select subBoard.exportToXml(context, true)), new XElement("boards", from subBoard in board.subBoards select subBoard.exportToXml(context, true)),
new XElement("threads", new XElement("threads",
(from thread in threads select thread.exportToXml(context, false)).addNumbers(), from thread in threads select thread.exportToXml(context, false),
pageOuter.exportToXml(1, 5, 1) pageOuter.exportToXml(1, 5, 1)
) )
}; };

@ -23,7 +23,7 @@ namespace FLocal.IISHandler.handlers.response {
IEnumerable<User> users = User.getUsers(pageOuter, context); IEnumerable<User> users = User.getUsers(pageOuter, context);
return new XElement[] { return new XElement[] {
new XElement("users", new XElement("users",
(from user in users select user.exportToXmlForViewing(context)).addNumbers(), from user in users select user.exportToXmlForViewing(context),
pageOuter.exportToXml(2, 5, 2) pageOuter.exportToXml(2, 5, 2)
) )
}; };

@ -67,7 +67,7 @@
<xsl:template match="users/user"> <xsl:template match="users/user">
<tr> <tr>
<xsl:choose> <xsl:choose>
<xsl:when test="even='true'"> <xsl:when test="position() mod 2 = 0">
<xsl:attribute name="class">lighttable</xsl:attribute> <xsl:attribute name="class">lighttable</xsl:attribute>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>

@ -4,7 +4,7 @@
<xsl:template match="thread"> <xsl:template match="thread">
<tr> <tr>
<xsl:choose> <xsl:choose>
<xsl:when test="even='true'"> <xsl:when test="position() mod 2 = 0">
<xsl:attribute name="class">lighttable</xsl:attribute> <xsl:attribute name="class">lighttable</xsl:attribute>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>

Loading…
Cancel
Save