From 4e5fdbe8a704a26b8e6ade508d1d8fec6e2ea986 Mon Sep 17 00:00:00 2001 From: sanj Date: Wed, 19 Jan 2011 13:59:19 +0530 Subject: [PATCH] previews changes, login / register buttons --- itf/bestpractices/models.py | 12 +++++++-- itf/static/js/itf/construct.js | 27 ++++++++++++++++--- .../bestpractices/BestPractice/preview.html | 5 +++- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/itf/bestpractices/models.py b/itf/bestpractices/models.py index 28844e4..5e2e039 100644 --- a/itf/bestpractices/models.py +++ b/itf/bestpractices/models.py @@ -48,10 +48,18 @@ class BestPractice(ItfModel): 'id': self.id, 'title': self.title, 'category': self.category.name, - 'quick_howto': self.quick_howto, - 'guideline': self.guideline + 'story': self.story, + 'images': self.get_images() } + def get_images(self): + images = [] + for i in BestPracticeImage.objects.filter(bestpractice=self): + images.append({ + 'url': i.image.url, + 'caption': i.caption + }) + return images class BestPracticeCategory(models.Model): name = models.CharField(max_length=256) diff --git a/itf/static/js/itf/construct.js b/itf/static/js/itf/construct.js index 5143b10..1b59afb 100644 --- a/itf/static/js/itf/construct.js +++ b/itf/static/js/itf/construct.js @@ -454,7 +454,7 @@ BEGIN mainPanel elements: [ { element: app.construct.loginBox(), - size: 256 + size: 32 }, { element: app.construct.previewBox() @@ -470,6 +470,25 @@ BEGIN mainPanel id: id }); + var btnsWrapper = new Ox.Element().css({'textAlign': 'center', 'marginTop': '4px'}); + + var loginBtn = new Ox.Button({ + 'id': 'loginBtn', + 'title': 'Login', + 'size': 'large' + }).bindEvent("click", function() { + ui.accountDialog("login").open(); + }).appendTo(btnsWrapper); + + var registerBtn = new Ox.Button({ + 'id': 'registerBtn', + 'title': 'Register', + 'size': 'large' + }).bindEvent("click", function() { + ui.accountDialog("register").open(); + }).appendTo(btnsWrapper); + + btnsWrapper.appendTo(c); /* var registerForm = (function() { var u = ui.accountDialogOptions('register'); @@ -507,10 +526,10 @@ BEGIN mainPanel btnsWrapper.appendTo(e); return e; })(); - +*/ + +// registerForm.appendTo(c); - registerForm.appendTo(c); -*/ /* var $registerTitle = new Ox.Element().html("Register:").appendTo(c); var registerForm = c.$form = new Ox.Form({ diff --git a/itf/templates/bestpractices/BestPractice/preview.html b/itf/templates/bestpractices/BestPractice/preview.html index 99538bf..c037c51 100644 --- a/itf/templates/bestpractices/BestPractice/preview.html +++ b/itf/templates/bestpractices/BestPractice/preview.html @@ -1,5 +1,8 @@
${title}

Category: ${category}

- Quick Howto: ${quick_howto} +
+ {{each images}} {{/each}} +
+ Story: ${story}