From cf90fa002afec60e2c057348de24ca1d8bcbaaa4 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Mon, 14 Mar 2016 02:20:50 -0400 Subject: add test/{get_users,set_user}, js/util.js, lots more --- src/guff/views/html/test/auth.cr | 43 ++-------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) (limited to 'src/guff/views/html/test') diff --git a/src/guff/views/html/test/auth.cr b/src/guff/views/html/test/auth.cr index b21ebf6..9f5d1ad 100644 --- a/src/guff/views/html/test/auth.cr +++ b/src/guff/views/html/test/auth.cr @@ -3,38 +3,7 @@ require "../page" class Guff::TestAuthHTMLView TITLE = "Guff Auth Test" - FEATURES = %w{bootstrap font-awesome} - - TEMPLATES = TemplateCache.new({ - user: "%{name}" - }) - - MOCK_USERS = [{ - "id": "0", - "name": "Guest", - "active": "1", - }, { - "id": "1", - "name": "Admin", - "active": "0", - }, { - "id": "2", - "name": "Test User 1", - "active": "0", - }, { - "id": "2", - "name": "Test User 2", - "active": "0", - }, { - "id": "3", - "name": "Test User<<<<>>>>>&&&&&&2", - "active": "0", - }] + FEATURES = %w{bootstrap font-awesome guff/util} def self.run(models, context : HTTP::Server::Context) new(models).run(context) @@ -46,19 +15,11 @@ class Guff::TestAuthHTMLView def run(context) page = PageHTMLView.new(TITLE, self.to_s) page.add_features(FEATURES) + page.scripts << "/guff-stuff/test/auth.js" context.response.content_type = page.content_type context.response.puts page end - def users - MOCK_USERS.map { |row| - TEMPLATES[:user].run(row.merge({ - "name": h(row["name"]), - "css": (row["active"] == "1") ? "active" : "", - })) - }.join("") - end - def h(s : String) HTML.escape(s || "") end -- cgit v1.2.3