From cea03dfb0dab00ff6a10c11021c236779dda7c90 Mon Sep 17 00:00:00 2001 From: Ajith Hussain Date: Fri, 20 Feb 2015 22:37:46 +1100 Subject: [PATCH 1/2] Html helper methods --- htmlhelper/button.go | 13 +++++++++++++ htmlhelper/email_field.go | 9 +++++++++ htmlhelper/link_to.go | 18 ++++++++++++++++++ htmlhelper/password_field.go | 9 +++++++++ 4 files changed, 49 insertions(+) create mode 100644 htmlhelper/button.go create mode 100644 htmlhelper/email_field.go create mode 100644 htmlhelper/link_to.go create mode 100644 htmlhelper/password_field.go diff --git a/htmlhelper/button.go b/htmlhelper/button.go new file mode 100644 index 0000000..f7e75a1 --- /dev/null +++ b/htmlhelper/button.go @@ -0,0 +1,13 @@ +package htmlhelper + +import ( + . "github.com/kirillrdy/nadeshiko/html" + "github.com/sparkymat/webdsl/css" +) + +func SubmitButton(text string, iconClasses ...css.Class) Node { + return Button().Type("submit").Children( + Span().Text(text), + I().Class(iconClasses...), + ) +} diff --git a/htmlhelper/email_field.go b/htmlhelper/email_field.go new file mode 100644 index 0000000..3241b41 --- /dev/null +++ b/htmlhelper/email_field.go @@ -0,0 +1,9 @@ +package htmlhelper + +import ( + . "github.com/kirillrdy/nadeshiko/html" +) + +func EmailField() Node { + return Input().Type("email").Name("email").Placeholder("E-mail") +} diff --git a/htmlhelper/link_to.go b/htmlhelper/link_to.go new file mode 100644 index 0000000..a40d323 --- /dev/null +++ b/htmlhelper/link_to.go @@ -0,0 +1,18 @@ +package htmlhelper + +import ( + . "github.com/kirillrdy/nadeshiko/html" + "github.com/sparkymat/webdsl/http" +) + +func ButtonLink(url string, method http.Method, text string) Node { + return Form().Action(url).Method(string(method)).Children( + Button().Type("submit").Children( + Span().Text(text), + ), + ) +} + +func ContainerLink(url string, innerNodes ...Node) Node { + return A().Href(url).Children(innerNodes...) +} diff --git a/htmlhelper/password_field.go b/htmlhelper/password_field.go new file mode 100644 index 0000000..7db2cec --- /dev/null +++ b/htmlhelper/password_field.go @@ -0,0 +1,9 @@ +package htmlhelper + +import ( + . "github.com/kirillrdy/nadeshiko/html" +) + +func PasswordField() Node { + return Input().Type("password").Name("password").Placeholder("Password") +} From 262a1210cf38d8ed351c72bb13f50f70d4b8222a Mon Sep 17 00:00:00 2001 From: Ajith Hussain Date: Fri, 20 Feb 2015 22:56:03 +1100 Subject: [PATCH 2/2] vim temp file :O --- css/.property_display.go.swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 css/.property_display.go.swp diff --git a/css/.property_display.go.swp b/css/.property_display.go.swp deleted file mode 100644 index 413ac0085662c7a370c67a7e3543dd457355738b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&1(}u7>D0_vT9W<2#Sa4ijqo`ZL1&@DpaFVp(wQK$&c-3lB`X3mz_z|P(M#z zlzQ?HQ0md6{Sy>X1jVcPfePM4(SsL%o84{G_|d9WQQoBw+kNMq;hkruTS8{E`^eys z*qPZuxYiQ2i`OHASJ%_UjYQTdM;F8R0@py8r_w{a52bs*mwL87pjq%t71(A0ohqXl z+bf&Ow}P=++0tfJj^<~18jf|umLu}2L3?;y~Ylz-~H{b<$4rag`@ z1*Sph<{IFO4X^<=zy{a=8(;%}$iNwD4WzCFu1JnV61673X2z{jMJmxREZ>)IF4fe~ zC6o>vw~(smb#~766n*{TP<+O6GU+u^^JSkfPF0k4^0l<>xmvo~I79i0Yl{O>cuy3K zh7@sb9PFGOQ%n+}ztUn~NlpxFE6`23DB8%QEv>>vqak~*oBLKS=4cRU)Y+U7O_b;_ z__9h)!A(0_mQ~_vAPfzLk=Rq%S`U6r(Xhr6+eI;(6uQBL!eAn14^~13^Hc14ED