From 118b35c8aec2c28867812b455d5002552e638f74 Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 18 Apr 2011 19:06:11 +0530 Subject: [PATCH] added bestpractices to festival site --- itf/bestpractices/models.py | 4 + itf/bestpractices/templatetags/__init__.py | 0 itf/bestpractices/templatetags/guidelines.py | 18 ++++ itf/festival/views.py | 36 ++++++++ itf/static/css/bestpractices.css | 53 +++++++++++ itf/static/css/itf.css | 5 ++ itf/static/css/meeting.css | 2 +- itf/static/js/itf/boxes.js | 2 +- itf/templates/bestpractices.html | 94 ++++++++++++++++++++ itf/templates/bpglossary.html | 29 ++++++ itf/templates/bpguideline.html | 6 ++ itf/templates/bpguidelines.html | 23 +++++ itf/templates/bpstories.html | 23 +++++ itf/templates/bpstory.html | 14 +++ itf/templates/festival_index.html | 1 + itf/templates/festival_wireframe.html | 2 +- itf/templates/home.html | 1 + itf/templates/meetings.html | 1 + itf/templates/people.html | 1 + itf/templates/projects.html | 1 + itf/templates/publications.html | 1 + itf/templates/resources.html | 1 + itf/templates/surveys.html | 1 + itf/urls.py | 16 +--- 24 files changed, 318 insertions(+), 17 deletions(-) create mode 100644 itf/bestpractices/templatetags/__init__.py create mode 100644 itf/bestpractices/templatetags/guidelines.py create mode 100644 itf/static/css/bestpractices.css create mode 100644 itf/templates/bestpractices.html create mode 100644 itf/templates/bpglossary.html create mode 100644 itf/templates/bpguideline.html create mode 100644 itf/templates/bpguidelines.html create mode 100644 itf/templates/bpstories.html create mode 100644 itf/templates/bpstory.html diff --git a/itf/bestpractices/models.py b/itf/bestpractices/models.py index 4335602..4ee8a74 100644 --- a/itf/bestpractices/models.py +++ b/itf/bestpractices/models.py @@ -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() diff --git a/itf/bestpractices/templatetags/__init__.py b/itf/bestpractices/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/itf/bestpractices/templatetags/guidelines.py b/itf/bestpractices/templatetags/guidelines.py new file mode 100644 index 0000000..3f3b772 --- /dev/null +++ b/itf/bestpractices/templatetags/guidelines.py @@ -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 = "%s" % (id, title,) + value = value.replace(match, html, 1) + return value + +register.filter("link_bps", link_bps) diff --git a/itf/festival/views.py b/itf/festival/views.py index 4017579..e4c8e13 100644 --- a/itf/festival/views.py +++ b/itf/festival/views.py @@ -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) + diff --git a/itf/static/css/bestpractices.css b/itf/static/css/bestpractices.css new file mode 100644 index 0000000..fb6fdd1 --- /dev/null +++ b/itf/static/css/bestpractices.css @@ -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; +} diff --git a/itf/static/css/itf.css b/itf/static/css/itf.css index fec374b..1d3289a 100644 --- a/itf/static/css/itf.css +++ b/itf/static/css/itf.css @@ -17,6 +17,11 @@ text-align: center; } +.itfBox { + padding: 4px; + margin-right: 4px; +} + .OxCommentWrapper { margin-bottom: 4px; } diff --git a/itf/static/css/meeting.css b/itf/static/css/meeting.css index 81ce0de..7f05b03 100644 --- a/itf/static/css/meeting.css +++ b/itf/static/css/meeting.css @@ -9,7 +9,7 @@ } #tabs { - font-family: Arial, Georgia, Helvetica, mono !important; + font-family: Arial, Georgia, Helvetica, sans-serif !important; } #tabs ul { diff --git a/itf/static/js/itf/boxes.js b/itf/static/js/itf/boxes.js index 13b4a7d..c3c3d38 100644 --- a/itf/static/js/itf/boxes.js +++ b/itf/static/js/itf/boxes.js @@ -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 diff --git a/itf/templates/bestpractices.html b/itf/templates/bestpractices.html new file mode 100644 index 0000000..dd83c84 --- /dev/null +++ b/itf/templates/bestpractices.html @@ -0,0 +1,94 @@ +{% extends 'festival_wireframe.html' %} + +{% block title %} +India Theatre Forum - Best Practices +{% endblock %} + +{% block extra_head %} + + +{% endblock %} + + {% block leftCol %} + + {% endblock %} + + +{% block centerCol %} +
+

Best Practices

+
+ {% block bpTabs %} +
+ +
+
+ {% endblock %} + {% block bpContent %} +
+ Best practices - under construction + +
+
+ Download Booklet:

+ {% for d in downloads %} + + {% endfor %} +
+ {% endblock %} +
+
+{% endblock %} diff --git a/itf/templates/bpglossary.html b/itf/templates/bpglossary.html new file mode 100644 index 0000000..6ae4e81 --- /dev/null +++ b/itf/templates/bpglossary.html @@ -0,0 +1,29 @@ +{% extends 'bestpractices.html' %} + +{% block bpTabs %} +
+ +
+
+{% endblock %} + +{% block bpContent %} +
+ {% for t in terms %} +
+
+ {{t.term}} +
+
+ {{t.definition}} +
+
+ + {% endfor %} +
+{% endblock %} diff --git a/itf/templates/bpguideline.html b/itf/templates/bpguideline.html new file mode 100644 index 0000000..d9dc301 --- /dev/null +++ b/itf/templates/bpguideline.html @@ -0,0 +1,6 @@ +{% load guidelines %} +
+ {% autoescape off %} + {{ text|link_bps|linebreaksbr }} + {% endautoescape %} +
diff --git a/itf/templates/bpguidelines.html b/itf/templates/bpguidelines.html new file mode 100644 index 0000000..b4b5f72 --- /dev/null +++ b/itf/templates/bpguidelines.html @@ -0,0 +1,23 @@ +{% extends 'bestpractices.html' %} + +{% block bpTabs %} +
+ +
+
+{% endblock %} + +{% block bpContent %} +
+ {% for g in guidelines %} + + {% endfor %} +
+{% endblock %} diff --git a/itf/templates/bpstories.html b/itf/templates/bpstories.html new file mode 100644 index 0000000..e4a659f --- /dev/null +++ b/itf/templates/bpstories.html @@ -0,0 +1,23 @@ +{% extends 'bestpractices.html' %} + +{% block bpTabs %} +
+ +
+
+{% endblock %} + +{% block bpContent %} +
+ {% for s in stories %} + + {% endfor %} +
+{% endblock %} diff --git a/itf/templates/bpstory.html b/itf/templates/bpstory.html new file mode 100644 index 0000000..143af9b --- /dev/null +++ b/itf/templates/bpstory.html @@ -0,0 +1,14 @@ +
+ {% for s in stories %} + Story {{forloop.counter}}: {{ s.text|linebreaksbr }} + +

+ {% endfor %} + Law: {{ law|linebreaksbr }} + {% if law_image %} + + {% endif %} +

+ Relevance to Theatre: {{ theatre|linebreaksbr }}

+ Quick Howto: {{ quick_howto|linebreaksbr }}

+
diff --git a/itf/templates/festival_index.html b/itf/templates/festival_index.html index de0af7e..b2b97ab 100644 --- a/itf/templates/festival_index.html +++ b/itf/templates/festival_index.html @@ -36,6 +36,7 @@
  • eRang
    The theatre newsletter...
  • Participants
    A list of participants for all ITF meetings
  • Resources
    Downloadable reading materials and resources
  • +
  • Best Practices
    Best Practices publication
  • {% endblock %} diff --git a/itf/templates/festival_wireframe.html b/itf/templates/festival_wireframe.html index 49a9c36..7ebed48 100644 --- a/itf/templates/festival_wireframe.html +++ b/itf/templates/festival_wireframe.html @@ -40,7 +40,7 @@
  • Surveys
    Surveys about theatre in India...
  • Publications
    Publications by the ITF..
  • Participants
    A list of participants for all ITF meetings
  • - +
  • Best Practices
    Best Practices publication
  • {% endblock %} diff --git a/itf/templates/home.html b/itf/templates/home.html index 2511784..709b188 100644 --- a/itf/templates/home.html +++ b/itf/templates/home.html @@ -14,6 +14,7 @@ India Theatre Forum - Home
  • Surveys
    Surveys about theatre in India...
  • Publications
    Publications by the ITF..
  • Participants
    A list of participants for all ITF meetings
  • +
  • Best Practices
    Best Practices publication
  • {% endblock %} diff --git a/itf/templates/meetings.html b/itf/templates/meetings.html index f057d25..f3b7855 100644 --- a/itf/templates/meetings.html +++ b/itf/templates/meetings.html @@ -20,6 +20,7 @@ India Theatre Forum - Activities
  • Surveys
    Surveys about theatre in India...
  • Publications
    Publications by the ITF..
  • Participants
    A list of participants for all ITF meetings
  • +
  • Best Practices
    Best Practices publication
  • {% endblock %} diff --git a/itf/templates/people.html b/itf/templates/people.html index c59c86c..96cad33 100644 --- a/itf/templates/people.html +++ b/itf/templates/people.html @@ -28,6 +28,7 @@
  • Surveys
    Surveys about theatre in India...
  • Publications
    Publications by the ITF..
  • Participants
    A list of participants for all ITF meetings
  • +
  • Best Practices
    Best Practices publication
  • {% endblock %} diff --git a/itf/templates/projects.html b/itf/templates/projects.html index 6af4c2d..35ba029 100644 --- a/itf/templates/projects.html +++ b/itf/templates/projects.html @@ -14,6 +14,7 @@ India Theatre Forum - Projects
  • Surveys
    Surveys about theatre in India...
  • Publications
    Publications by the ITF..
  • Participants
    A list of participants for all ITF meetings
  • +
  • Best Practices
    Best Practices publication
  • {% endblock %} diff --git a/itf/templates/publications.html b/itf/templates/publications.html index 72f0c8f..f5bb882 100644 --- a/itf/templates/publications.html +++ b/itf/templates/publications.html @@ -24,6 +24,7 @@ India Theatre Forum - Publications
  • Surveys
    Surveys about theatre in India...
  • Publications
    Publications by the ITF..
  • Participants
    A list of participants for all ITF meetings
  • +
  • Best Practices
    Best Practices publication
  • {% endblock %} diff --git a/itf/templates/resources.html b/itf/templates/resources.html index b4de2ff..3b2c99f 100644 --- a/itf/templates/resources.html +++ b/itf/templates/resources.html @@ -22,6 +22,7 @@
  • Surveys
    Surveys about theatre in India...
  • Publications
    Publications by the ITF..
  • Participants
    A list of participants for all ITF meetings
  • +
  • Best Practices
    Best Practices publication
  • {% endblock %} diff --git a/itf/templates/surveys.html b/itf/templates/surveys.html index 408738d..ee37d5f 100644 --- a/itf/templates/surveys.html +++ b/itf/templates/surveys.html @@ -12,6 +12,7 @@
  • Surveys
    Surveys about theatre in India...
  • Publications
    Publications by the ITF..
  • Participants
    A list of participants for all ITF meetings
  • +
  • Best Practices
    Best Practices publication
  • {% endblock %} diff --git a/itf/urls.py b/itf/urls.py index c7d6492..6fca010 100644 --- a/itf/urls.py +++ b/itf/urls.py @@ -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\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\d+)/$', 'festival.views.meeting_details'), - (r'^itf/video/(?P\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'