From 0cb06ec9f9320e3f8abb20413f7853b6ca9f2d3f Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 6 Oct 2011 17:39:28 +0200 Subject: [PATCH] placeholder contact form --- pandora/user/views.py | 1 + static/js/pandora/ui/contactForm.js | 57 +++++++++++++++++++++++++++++ static/js/pandora/ui/siteDialog.js | 11 ++++-- static/json/pandora.json | 1 + 4 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 static/js/pandora/ui/contactForm.js diff --git a/pandora/user/views.py b/pandora/user/views.py index 68d3ef957..f002147e8 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -536,6 +536,7 @@ def contact(request): ''' param data { 'email': string, + 'subject': string, 'message': string } diff --git a/static/js/pandora/ui/contactForm.js b/static/js/pandora/ui/contactForm.js new file mode 100644 index 000000000..070ba4fee --- /dev/null +++ b/static/js/pandora/ui/contactForm.js @@ -0,0 +1,57 @@ +// vim: et:ts=4:sw=4:sts=4:ft=javascript +pandora.ui.contactForm = function() { + var that = Ox.Element(), + $form = Ox.Form({ + items: [ + Ox.Input({ + id: 'email', + label: 'E-Mail', + labelWidth: 60, + value: pandora.user.preferences.email, + width: 240 + }), + Ox.Input({ + id: 'subject', + label: 'Subject', + labelWidth: 60, + value: '', + width: 240 + }), + Ox.Input({ + height: 120, + id: 'message', + placeholder: 'Message', + type: 'textarea', + value: '', + width: 240 + }) + .css({height: '240px'}) + ], + submit: function(data, callback) { + pandora.api.contact({ + email: data.email, + subject: data.subject, + message: data.message + }, function(result) { + callback && callback(result); + }); + }, + width: 240 + }) + .css({margin: '8px'}) + .bindEvent({ + change: function(event) { + } + }) + .appendTo(that); + + Ox.Button({ + title: 'Send' + }) + .bindEvent({ + click: function() { + $form.submit(); + } + }).appendTo(that); + return that; +}; diff --git a/static/js/pandora/ui/siteDialog.js b/static/js/pandora/ui/siteDialog.js index 8ea691812..c14547ec0 100644 --- a/static/js/pandora/ui/siteDialog.js +++ b/static/js/pandora/ui/siteDialog.js @@ -1,3 +1,4 @@ +// vim: et:ts=4:sw=4:sts=4:ft=javascript pandora.ui.siteDialog = function(section) { var tabs = [ @@ -13,9 +14,13 @@ pandora.ui.siteDialog = function(section) { var $tabPanel = Ox.TabPanel({ content: function(id) { var content = Ox.Element().css({padding: '16px', overflowY: 'auto'}); - pandora.api.getPage({name:id}, function(result) { - content.html(result.data.body); - }); + if (id == 'contact') { + content.append(pandora.ui.contactForm()); + } else { + pandora.api.getPage({name:id}, function(result) { + content.html(result.data.body); + }); + } return Ox.SplitPanel({ elements: [ { diff --git a/static/json/pandora.json b/static/json/pandora.json index 99cfbe471..72c143484 100644 --- a/static/json/pandora.json +++ b/static/json/pandora.json @@ -11,6 +11,7 @@ "js/pandora/ui/browser.js", "js/pandora/ui/clipList.js", "js/pandora/ui/contentPanel.js", + "js/pandora/ui/contactForm.js", "js/pandora/ui/deleteListDialog.js", "js/pandora/ui/editor.js", "js/pandora/ui/eventsDialog.js",