diff options
Diffstat (limited to 'src/xhtml.cr')
-rw-r--r-- | src/xhtml.cr | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/xhtml.cr b/src/xhtml.cr index be3d12c..d53eb04 100644 --- a/src/xhtml.cr +++ b/src/xhtml.cr @@ -53,9 +53,8 @@ class Page end def heading(xml, level, text) - id = text.gsub ' ', '-' - xml.element "h#{level}", id: id do - xml.element "a", href: "##{id}" do xml.text text end + xml.element "h#{level}", id: text do + xml.element "a", href: "##{text}" do xml.text text end end end @@ -155,8 +154,10 @@ class Page criteria xml heading xml, 2, "members" - @db.members.each_value do |nick, opennic, icann| - member xml, nick, opennic, icann + @db.exec "SELECT nick, opennic, icann + FROM member + WHERE official = 1" do |row| + member xml, row[0].text, row[1].text, row[2].text end heading xml, 2, "joining" @@ -173,22 +174,29 @@ class Page xml.text " to keep the hyperlinks up to date." end xml.element "ul" do - xml.element "li" do - xml.text "Left: " - _, left, _ = @db.members.last_value - xml.element "a", href: left do xml.text left end - end - xml.element "li" do - xml.text "Right: " - _, right, _ = @db.members.first_value - xml.element "a", href: right do xml.text right end + @db.exec "SELECT neighbor.opennic, member.opennic + FROM member INNER JOIN member AS neighbor + ON member.left = neighbor.nick + WHERE member.official = 1 + ORDER BY member.rowid ASC LIMIT 1" do |row| + left, right = row[0].text, row[1].text + xml.element "li" do + xml.text "Left: " + xml.element "a", href: left do xml.text left end + end + xml.element "li" do + xml.text "Right: " + xml.element "a", href: right do xml.text right end + end end end form xml, errors, params heading xml, 2, "applicants" - @db.applicants.each_value do |nick, opennic, icann| - member xml, nick, opennic, icann + @db.exec "SELECT nick, opennic, icann + FROM member + WHERE official = 0" do |row| + member xml, row[0].text, row[1].text, row[2].text end end end |