ups, forgot to add js

This commit is contained in:
Sanj 2011-08-25 15:09:15 +05:30
parent 77d5717e12
commit 6f00c2fcbe
6 changed files with 97 additions and 12 deletions

View File

@ -87,7 +87,7 @@ class ItfModel(models.Model):
ret[p] = self._get_property(p)
return ret
elif typ == str:
return _get_property(props)
return self._get_property(props)
else:
return False
@ -192,7 +192,7 @@ class ItfModel(models.Model):
def get_list(kls, data):
options = {
'page_no': 1,
'list_size': 8,
'list_size': 12,
'search': '',
'sort': [],
'range': [0,50]
@ -219,12 +219,22 @@ class ItfModel(models.Model):
operator = ''
sort = operator + s['key']
qset = qset.order_by(sort)
'''
r0 = options['range'][0]
r1 = options['range'][1]
results = qset[r0:r1]
for r in results:
'''
paginator = Paginator(qset, list_size)
try:
results = paginator.page(page_no)
except (EmptyPage, InvalidPage):
results = paginator.page(paginator.num_pages)
for r in results.object_list:
ret.append(r.list_dict())
return ret
@classmethod

View File

@ -22,6 +22,9 @@ class ModuleTab(models.Model):
order = models.IntegerField(default=1)
is_displayed = models.BooleanField(default=True)
class Meta:
ordering = ['-is_default', 'order']
def __unicode__(self):
return self.title

View File

@ -3,6 +3,7 @@ from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from ox.django.shortcuts import render_to_json_response
def main(request, module_slug):
m = get_object_or_404(Module, slug=module_slug)
tabs = m.moduletab_set.all()
@ -19,7 +20,7 @@ def main(request, module_slug):
def get_list(request):
tab_id = request.GET.get("tab", 0)
tab_id = request.GET.get("tab_id", 0)
tab = get_object_or_404(ModuleTab, pk=tab_id)
list_options = {
'search': request.GET.get("search", ""),
@ -38,3 +39,4 @@ def get_details(request):
obj = get_object_or_404(model_class, pk=object_id)
return render_to_json_response(obj.insidepage_dict())

View File

@ -99,6 +99,15 @@ color:#FFF;
box-shadow:-3px -0px 6px #e0dfdf;
cursor:pointer;}
.tabText
{ display:none; }
.displayedTab
{ display:block !important; }
#loadingList
{display:none;}
#contentTabsInner
{font-family:Arial, Helvetica, 'DejaVu Sans', sans-serif;
font-size:13px;

View File

@ -0,0 +1,52 @@
$('#listLeft ul li a').live("click", function() {
// alert("foo");
// e.preventDefault();
var objId = $(this).attr("data-id");
var tabId = $('.innerSelected').attr("data-id");
$.getJSON("/m/get_details", {
'tab_id': tabId,
'object_id': objId
}, function(data) {
$('#textRight').text(data.title);
$('#bottomRight').html(data.html);
// console.log(data);
});
return false;
});
function getLi(item) {
var $li = $('<li />').addClass("tabListItem");
var $a = $('<a />').attr("href", '#').attr("data-id", item.id).appendTo($li);
var $span = $('<span />').text(item.title).appendTo($a);
return $li;
}
$(function() {
$('#listLeft ul li a').eq(0).click();
// alert("hi");
$('.tabCategory').click(function() {
var $this = $(this);
if ($this.hasClass('.innerSelected')) {
return false;
}
$('.innerSelected').removeClass("innerSelected");
$this.addClass("innerSelected");
$('.displayedTab').removeClass("displayedTab");
var tabId = $this.attr("data-id");
$('#tabText_' + tabId).addClass("displayedTab");
$('#loadingList').show();
$('.tabListItem').remove();
$.getJSON("/m/get_list", {
'tab_id': tabId,
'page_no': 1
}, function(data) {
$('#loadingList').hide();
for (var i=0; i<data.length; i++) {
var $li = getLi(data[i]);
$('#listLeft ul').append($li);
}
$('#listLeft ul li a').eq(0).click();
});
});
});

View File

@ -4,7 +4,7 @@
{% block extra_head %}
<link rel="stylesheet" href="/static/css/noel/inner.css" type="text/css" />
<script type="text/javascript" href="/static/js/insidepage.js"></script>
<script type="text/javascript" src="/static/js/insidepage.js"></script>
{% endblock %}
@ -38,14 +38,22 @@
</ul>
<div id="contentTabsInner">
<div id="tabText_{{default_tab.id}}" class="tabText displayedTab">
{{ default_tab.text }}
</div>
{% for t in tabs %}
<div id="tabText_{{t.id}}" class="tabText">
{{ t.text }}
</div>
{% endfor %}
</div>
</div>
<div id="listLeft">
<ul>
<li id="loadingList">Loading...</li>
{% for l in default_list %}
<li><a href="{{ l.url }}" data-id="{{ l.id }}"><span>{{ l.title }}</span></a></li>
<li class="tabListItem"><a href="{{ l.url }}" data-id="{{ l.id }}"><span>{{ l.title }}</span></a></li>
{% endfor %}
<!-- <li><a href=""><span>The Mystery of vanishing rights<span></a></li> -->
</ul>
@ -62,9 +70,9 @@
<div id="imageLeft">
</div>
<p id="textRight">
The Mystery of vanishing rights
</p>
</p>
<!--
<p id="twitter">
<a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="http://twitter.com/#!/indtheatreforum">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</p>
@ -73,12 +81,13 @@
<iframe src="http://www.facebook.com/plugins/like.php?href=www.theatreforum.in&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
</p>
-->
<img src="/static/images/noel/download.jpg" width="16" height="16" alt="download" id="download">
</div>
<div id="bottomRight">
<!--
<p><span id="sectionTitle">Story 1:</span> A well known theatre group had auditions for casting lead characters in their play for which over 150 actors auditioned. A television film director happened to see the recording of the auditions and obtained a copy. Two months later, a few actors who had auditioned were horrified to see themselves in a television comedy show. Snippets of the recording had obviously been used!</p><br/>
<p><span id="sectionTitle">Actors:</span> Not on! If you like our acting, you hire us! Not use our improvisations for another purpose and that too by someone else! We'll sue the television show producer and the theatre group.</p><br/>
@ -96,7 +105,7 @@
<p><span id="sectionTitle">Neha Bhasin:</span> That's my voice…that's my name on the CD but I'm not the background vocalist!!! I'll sue the film producer! The music director: Hmmm not so! We didn't even want to use your voice. It was a recording mistake! The Court: A costly mistake. You've used her voice, now pay up royalty! And recall all the CDs with her voice.</p><br/>
<p><span id="sectionTitle">Law:</span> Do actors have special rights? Under the Indian Copyright law, actors, singers, musicians, dancers, et al are called performers</p><br/>
-->
</div>
</div>
<div id="clearBoth"></div>