previews changes, login / register buttons

This commit is contained in:
sanj 2011-01-19 13:59:19 +05:30
parent d2a6374551
commit 4e5fdbe8a7
3 changed files with 37 additions and 7 deletions

View File

@ -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)

View File

@ -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({

View File

@ -1,5 +1,8 @@
<div class="itfPreview">
<span class="itfPreviewTitle">${title}</span><br /><br />
<span class="itfPreviewSub">Category: </span><span class="itfPreviewText">${category}</span> <br /><br />
<span class="itfPreviewSub">Quick Howto: </span><span class="itfPreviewText">${quick_howto}</span>
<div class="itfPreviewImages">
{{each images}} <img src="${$value.url}" title="${$value.caption}" /> {{/each}}
</div>
<span class="itfPreviewSub">Story: </span><span class="itfPreviewText">${story}</span>
</div>