added bestpractices to festival site

This commit is contained in:
Sanj 2011-04-18 19:06:11 +05:30
parent 773ff4ddc3
commit 118b35c8ae
24 changed files with 318 additions and 17 deletions

View File

@ -77,6 +77,10 @@ class BestPractice(ItfModel):
def no_of_stories(self):
return BestPracticeStory.objects.filter(bestpractice=self).count()
class BestPracticeDownload(models.Model):
language = models.CharField(max_length=255)
fil = models.FileField(upload_to="upload/bestpractices_downloads/")
class BestPracticeStory(models.Model):
text = models.TextField()

View File

@ -0,0 +1,18 @@
from django import template
from bestpractices.models import BestPractice
import re
register = template.Library()
def link_bps(value):
r = r'BP\:[0-9][0-9]?'
matches = re.findall(r, value)
for match in matches:
id = int(match.replace("BP:", "").strip())
bp = BestPractice.objects.get(pk=id)
title = bp.title
html = "<a class='bpRelated' href='/itf/bestpractices/stories#%d' title='View related Best Practice story'>%s</a>" % (id, title,)
value = value.replace(match, html, 1)
return value
register.filter("link_bps", link_bps)

View File

@ -2,6 +2,7 @@
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse
from festival.models import *
from bestpractices.models import *
from utils import validateEmail
from forms import MeetingCommentForm
import random
@ -179,4 +180,39 @@ def email_signups(request):
def video(request, video_id):
video = get_object_or_404(Video, id=video_id)
return render_to_response("video.html", {'video': video})
def bestpractices(request):
return render_to_response("bestpractices.html", {
'downloads': BestPracticeDownload.objects.all()
})
def bpguidelines(request):
return render_to_response("bpguidelines.html", {
'guidelines': Guideline.objects.all()
})
def bpstories(request):
stories = []
for bp in BestPractice.objects.all():
stories.append({
'id': bp.id,
'title': bp.title
})
return render_to_response("bpstories.html", {
'stories': stories
})
def bpglossary(request):
return render_to_response("bpglossary.html", {
'terms': Glossary.objects.all()
})
def bpstory(request, story_id):
story_dict = BestPractice.objects.get(pk=story_id).info_dict()
return render_to_response("bpstory.html", story_dict)
def bpguideline(request, guideline_id):
guideline_dict = Guideline.objects.get(pk=guideline_id).get_dict()
return render_to_response("bpguideline.html", guideline_dict)

View File

@ -0,0 +1,53 @@
#bpTabs ul li {
list-style-type: none;
font-size: 16px;
padding: 6px;
float: left;
}
#bpTabs ul {
margin: 0;
padding: 0;
}
#bpTabs ul li a {
text-decoration: none;
font-weight: bold;
}
.bpItem {
margin-bottom: 6px;
}
.glossaryTerm {
font-weight: bold;
}
h3 {
margin: 0;
padding: 0;
}
.bpContent {
margin-top: 10px;
}
.bpContent a {
text-decoration: none;
font-weight: bold;
}
.bpAjax {
margin-top: 6px;
}
.itfInfoSub {
font-weight: bold;
}
.bpRelated {
color: #393939 !important;
font-weight: normal !important;
font-style: italic;
margin-left: 12px;
}

View File

@ -17,6 +17,11 @@
text-align: center;
}
.itfBox {
padding: 4px;
margin-right: 4px;
}
.OxCommentWrapper {
margin-bottom: 4px;
}

View File

@ -9,7 +9,7 @@
}
#tabs {
font-family: Arial, Georgia, Helvetica, mono !important;
font-family: Arial, Georgia, Helvetica, sans-serif !important;
}
#tabs ul {

View File

@ -67,7 +67,7 @@ Ox.ItfBox = function(boxData) {
'id': boxData.itfId,
'title': boxData.title
};
var that = app.$ui[boxData.itfId] = new Ox.Element(options, self);
var that = app.$ui[boxData.itfId] = new Ox.Element(options, self).addClass("itfBox");
var $titlebar = new Ox.Bar({
orientation: 'horizontal',
size: 24

View File

@ -0,0 +1,94 @@
{% extends 'festival_wireframe.html' %}
{% block title %}
India Theatre Forum - Best Practices
{% endblock %}
{% block extra_head %}
<link rel="stylesheet" href="/static/css/bestpractices.css" />
<script type="text/javascript">
$(document).ready(function() {
$('.bpItem a').click(function(e) {
e.preventDefault();
var id = $(this).parent().attr("data-id");
if ($(this).parent().find(".bpAjax").is(":visible")) {
$('.bpAjax').slideUp("fast", function() {
$(this).remove();
});
return false;
}
if ($('.bpAjax').is(":visible")) {
$('.bpAjax').slideUp("fast", function() {
$(this).remove();
});
}
var container = $('<div />').addClass("bpAjax").text("Loading...");
$(this).parent().append(container);
var url = $(this).attr("href");
$.get(url, {}, function(response) {
container.hide().html(response).slideDown("fast", function() {
var top = container.parent().position().top;
$('html').scrollTop(top - 3);
location.hash = id;
});
});
});
if (location.hash != '') {
var id = location.hash.replace("#", "");
var aElem = $('div[data-id=' + id + ']').find('a');
aElem.click();
}
});
</script>
{% endblock %}
{% block leftCol %}
<ul id="leftNav">
<li><a href="/itf/">Home</a></li>
<li><a href="/itf/meetings">Activities</a><div class="helper">ITF Meetings - transcripts, audio, discussions.</div></li>
<li><a href="/itf/projects">Projects</a><div class="helper">Projects undertaken by the ITF...</div></li>
<li><a href="/erang">e-Rang</a><div class="helper">The theatre newsletter...</div></li>
<li><a href="/itf/resources">Resources</a><div class="helper">Downloadable reading materials and resources</div></li>
<li><a href="/itf/surveys">Surveys</a><div class="helper">Surveys about theatre in India...</div></li>
<li><a href="/itf/publications">Publications</a><div class="helper">Publications by the ITF..</div></li>
<li><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li class="currentNav"><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices</div></li>
</ul>
{% endblock %}
{% block centerCol %}
<div id="centerContent">
<h3>Best Practices</h3>
<div class="centerText">
{% block bpTabs %}
<div id="bpTabs">
<ul>
<li class="bpCurrentTab">Intro</li>
<li><a href="/itf/bestpractices/stories">Stories</a></li>
<li><a href="/itf/bestpractices/guidelines">Guidelines</a></li>
<li><a href="/itf/bestpractices/glossary">Glossary</a></li>
</ul>
</div>
<div style="clear:both;"></div>
{% endblock %}
{% block bpContent %}
<div id="intro">
Best practices - under construction
</div>
<div class="bpContent">
Download Booklet: <br /><br />
{% for d in downloads %}
<div class="bpDownload">
<a target="_blank" href="d.fil.url" title="Click link to download PDF">{{ d.language }}</a>
</div>
{% endfor %}
</div>
{% endblock %}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,29 @@
{% extends 'bestpractices.html' %}
{% block bpTabs %}
<div id="bpTabs">
<ul>
<li><a href="/itf/bestpractices">Intro</a></li>
<li><a href="/itf/bestpractices/stories">Stories</a></li>
<li><a href="/itf/bestpractices/guidelines">Guidelines</a></li>
<li class="bpCurrentTab">Glossary</li>
</ul>
</div>
<div style="clear:both;"></div>
{% endblock %}
{% block bpContent %}
<div class="bpContent">
{% for t in terms %}
<div class="bpItem">
<div class="glossaryTerm">
{{t.term}}
</div>
<div class="glossaryDefinition">
{{t.definition}}
</div>
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -0,0 +1,6 @@
{% load guidelines %}
<div class="itfInfo">
{% autoescape off %}
{{ text|link_bps|linebreaksbr }}
{% endautoescape %}
</div>

View File

@ -0,0 +1,23 @@
{% extends 'bestpractices.html' %}
{% block bpTabs %}
<div id="bpTabs">
<ul>
<li><a href="/itf/bestpractices">Intro</a></li>
<li><a href="/itf/bestpractices/stories">Stories</a></li>
<li class="bpCurrentTab">Guidelines</li>
<li><a href="/itf/bestpractices/glossary">Glossary</a></li>
</ul>
</div>
<div style="clear:both;"></div>
{% endblock %}
{% block bpContent %}
<div class="bpContent">
{% for g in guidelines %}
<div class="bpItem" data-id="{{g.id}}">
<a href="/itf/bestpractices/guideline/{{g.id}}">{{g.title}}</a>
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -0,0 +1,23 @@
{% extends 'bestpractices.html' %}
{% block bpTabs %}
<div id="bpTabs">
<ul>
<li><a href="/itf/bestpractices">Intro</a></li>
<li class="bpCurrentTab">Stories</li>
<li><a href="/itf/bestpractices/guidelines">Guidelines</a></li>
<li><a href="/itf/bestpractices/glossary">Glossary</a></li>
</ul>
</div>
<div style="clear:both;"></div>
{% endblock %}
{% block bpContent %}
<div class="bpContent">
{% for s in stories %}
<div class="bpStory bpItem" data-id="{{s.id}}">
<a href="/itf/bestpractices/story/{{s.id}}">{{ s.title }}</a>
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -0,0 +1,14 @@
<div class="itfInfo">
{% for s in stories %}
<span class="itfInfoSub">Story {{forloop.counter}}: </span><span class="ifInfoInfo">{{ s.text|linebreaksbr }}</span>
<img class="itfInfoImg" src="{{ s.image }}" />
<br /><br />
{% endfor %}
<span class="itfInfoSub">Law: </span><span class="itfInfoInfo">{{ law|linebreaksbr }}</span>
{% if law_image %}
<img class="itfInfoImg" src="{{ law_image }}" />
{% endif %}
<br /><br />
<span class="itfInfoSub">Relevance to Theatre: </span><span class="itfInfoInfo">{{ theatre|linebreaksbr }}</span><br /><br />
<span class="itfInfoSub">Quick Howto: </span><span class="itfInfoInfo">{{ quick_howto|linebreaksbr }}</span><br /><br />
</div>

View File

@ -36,6 +36,7 @@
<li><a href="/erang">eRang</a><div class="helper">The theatre newsletter...</div></li>
<li><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li><a href="/itf/resources">Resources</a><div class="helper">Downloadable reading materials and resources</div></li>
<li><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices publication</div></li>
</ul>
{% endblock %}
</div>

View File

@ -40,7 +40,7 @@
<li><a href="/itf/surveys">Surveys</a><div class="helper">Surveys about theatre in India...</div></li>
<li><a href="/itf/publications">Publications</a><div class="helper">Publications by the ITF..</div></li>
<li><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices publication</div></li>
</ul>
{% endblock %}
</div>

View File

@ -14,6 +14,7 @@ India Theatre Forum - Home
<li><a href="/itf/surveys">Surveys</a><div class="helper">Surveys about theatre in India...</div></li>
<li><a href="/itf/publications">Publications</a><div class="helper">Publications by the ITF..</div></li>
<li><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices publication</div></li>
</ul>
{% endblock %}
</div>

View File

@ -20,6 +20,7 @@ India Theatre Forum - Activities
<li><a href="/itf/surveys">Surveys</a><div class="helper">Surveys about theatre in India...</div></li>
<li><a href="/itf/publications">Publications</a><div class="helper">Publications by the ITF..</div></li>
<li><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices publication</div></li>
</ul>
{% endblock %}

View File

@ -28,6 +28,7 @@
<li><a href="/itf/surveys">Surveys</a><div class="helper">Surveys about theatre in India...</div></li>
<li><a href="/itf/publications">Publications</a><div class="helper">Publications by the ITF..</div></li>
<li class="currentNav"><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices publication</div></li>
</ul>
{% endblock %}

View File

@ -14,6 +14,7 @@ India Theatre Forum - Projects
<li><a href="/itf/surveys">Surveys</a><div class="helper">Surveys about theatre in India...</div></li>
<li><a href="/itf/publications">Publications</a><div class="helper">Publications by the ITF..</div></li>
<li><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices publication</div></li>
</ul>
{% endblock %}

View File

@ -24,6 +24,7 @@ India Theatre Forum - Publications
<li><a href="/itf/surveys">Surveys</a><div class="helper">Surveys about theatre in India...</div></li>
<li class="currentNav"><a href="/itf/publications">Publications</a><div class="helper">Publications by the ITF..</div></li>
<li><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices publication</div></li>
</ul>
{% endblock %}

View File

@ -22,6 +22,7 @@
<li><a href="/itf/surveys">Surveys</a><div class="helper">Surveys about theatre in India...</div></li>
<li><a href="/itf/publications">Publications</a><div class="helper">Publications by the ITF..</div></li>
<li><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices publication</div></li>
</ul>
{% endblock %}

View File

@ -12,6 +12,7 @@
<li class="currentNav"><a href="/itf/surveys">Surveys</a><div class="helper">Surveys about theatre in India...</div></li>
<li><a href="/itf/publications">Publications</a><div class="helper">Publications by the ITF..</div></li>
<li><a href="/itf/people">Participants</a><div class="helper">A list of participants for all ITF meetings</div></li>
<li><a href="/itf/bestpractices">Best Practices</a><div class="helper">Best Practices publication</div></li>
</ul>
{% endblock %}

View File

@ -22,20 +22,8 @@ urlpatterns = patterns('',
(r'api/', 'api.views.api'),
(r'jsdoc/', 'api.views.jsdoc'),
(r'site.json', 'app.views.site_json'),
(r'^itf/$', 'festival.views.home'),
(r'^itf/wireframe', 'festival.views.wireframe'),
(r'^itf/projects', 'festival.views.projects'),
(r'^itf/erang', 'festival.views.erang'),
(r'^itf/publications', 'festival.views.publications'),
(r'^itf/surveys', 'festival.views.surveys'),
(r'^itf/project/(?P<project_id>\d+)/$', 'festival.views.project'),
(r'^itf/resources', 'festival.views.resources'),
(r'^itf/meetings', 'festival.views.meetings'),
(r'^itf/meeting/comment/$', 'festival.views.meeting_comment'),
(r'^itf/people', 'festival.views.people'),
(r'^itf/save_email', 'festival.views.save_email'),
(r'^itf/meeting/(?P<meeting_id>\d+)/$', 'festival.views.meeting_details'),
(r'^itf/video/(?P<video_id>\d+)$', 'festival.views.video', ),
(r'^itf/', include('festival.urls')),
(r'^admin/(.*)', admin.site.root),
('^getLanguages', 'itfcore.views.getLanguages'),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'