aboutsummaryrefslogtreecommitdiff
path: root/src/guff/views/html
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-04-01 15:58:08 -0400
committerPaul Duncan <pabs@pablotron.org>2016-04-01 15:58:08 -0400
commit6b9ca27c67d043a8737da652bf7915645628db4c (patch)
tree928ead16b4d04a695de6642c9dc818edab74b0d3 /src/guff/views/html
parent974d7c1d8ae71d50566dc8c2857520dde139a191 (diff)
downloadold-guff-6b9ca27c67d043a8737da652bf7915645628db4c.tar.bz2
old-guff-6b9ca27c67d043a8737da652bf7915645628db4c.zip
add_user test
Diffstat (limited to 'src/guff/views/html')
-rw-r--r--src/guff/views/html/test/auth.cr24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/guff/views/html/test/auth.cr b/src/guff/views/html/test/auth.cr
index 9f5d1ad..1baa7de 100644
--- a/src/guff/views/html/test/auth.cr
+++ b/src/guff/views/html/test/auth.cr
@@ -5,6 +5,18 @@ class Guff::TestAuthHTMLView
TITLE = "Guff Auth Test"
FEATURES = %w{bootstrap font-awesome guff/util}
+ TEMPLATES = TemplateCache.new({
+ role: "
+ <option
+ value='%{name}'
+ title='%{text}'
+ %{selected}
+ >
+ %{name}
+ </option>
+ "
+ })
+
def self.run(models, context : HTTP::Server::Context)
new(models).run(context)
end
@@ -24,5 +36,17 @@ class Guff::TestAuthHTMLView
HTML.escape(s || "")
end
+ def get_roles
+ @models.role.get_roles.map { |row|
+ name = row["role_name"] as String
+
+ TEMPLATES[:role].run({
+ "name": h(name),
+ "text": h(row["role_desc"] as String),
+ "selected": (name == "guest") ? "selected='selected'" : ""
+ })
+ }.join
+ end
+
ECR.def_to_s("./src/guff/views/ecrs/test/auth.ecr")
end