search.html

This commit is contained in:
Karen 2012-06-02 00:41:18 +05:30
commit b3e477b9cf
6 changed files with 51 additions and 15 deletions

View File

@ -1,7 +1,6 @@
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^$', 'festival.views.home'),
(r'^wireframe', 'festival.views.wireframe'),
(r'^projects', 'festival.views.projects'),

View File

@ -1,6 +1,6 @@
# Create your views here.
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse
from django.http import HttpResponse, HttpResponseRedirect
from festival.models import *
from bestpractices.models import *
from utils import validateEmail
@ -14,6 +14,38 @@ from django.core.mail import send_mail
from settings import ERANG_SUBSCRIBE_URL
import urllib2
def redirect(request, old_url):
REDIRECT_MAPPING = {
'people': '/m/itf-core/?tab=people',
'meeting': '/m/itf-core/?tab=meetings',
'meetings': '/m/itf-core/?tab=meetings',
'project': '/m/itf-core/?tab=projects',
'projects': '/m/itf-core/?tab=projects',
'resources': '/m/bibliography/?tab=documents',
'bestpractices/story': '/m/bestpractices/?tab=cases',
'erang': '/m/e-rang/?tab=issues'
}
components = old_url.split("/")
if len(components) > 2 and components[0].startswith('bestpractices'):
part_one = "/".join(components[:-1])
else:
part_one = components[0]
if part_one in REDIRECT_MAPPING.keys():
url = REDIRECT_MAPPING[part_one]
if len(components) > 1:
no = components[-1]
try:
object_id = int(no)
if object_id > 0:
url += "&object_id=%d" % object_id
except:
pass
else:
url = "/"
return HttpResponseRedirect(url)
def index(request):
index_data = {}
new_meetings = MeetingDay.objects.all().order_by('-meeting_date')[:5] # get 5 latest meetings

View File

@ -407,7 +407,8 @@ z-index:50;}
height:159px;
overflow:hidden;
color:#f7bd00;
font-size:50px;
word-wrap: break-word;
font-size:28px;
text-align:right;
padding-top:20px;
padding-right:14px;

View File

@ -6,7 +6,7 @@
<link rel="stylesheet" href="/static/css/noel/inner.css" type="text/css" />
<link rel="stylesheet" href="/static/css/noel/inner-details.css" type="text/css" />
<link type="text/css" rel="stylesheet" href="/static/css/jquery.tooltip.css" />
<link rel="canonical" href="{{ item.get_absolute_url }}" />
<link rel="canonical" href="http://theatreforum.in{{ item.get_absolute_url }}" />
<!--
<script type="text/javascript" src="/static/js/history/history.js"></script>
<script type="text/javascript" src="/static/js/history/amplify.store.js"></script>
@ -192,11 +192,12 @@
<div class="socialIcons">
<a href="" target="_blank" id="twitterBtn" title="Tweet this!" class="iconS"><img src="/static/images/noel/tweet.png" width="18" height="18" alt="twitter" class="iconImages"> </a>
<a href="https://twitter.com/share?url=http://theatreforum.in{{ item.get_absolute_url }}&title={{ item.get_title|urlencode }}" target="_blank" id="twitterBtn" title="Tweet this!" class="iconS"><img src="/static/images/noel/tweet.png" width="18" height="18" alt="twitter" class="iconImages"> </a>
<!--<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>-->
<div class="g-plusone iconS" data-size="small" data-annotation="none"></div>
<div class="iconS">
<div class="g-plusone" data-size="medium" data-annotation="none"></div>
</div>
<!-- Place this render call where appropriate -->
<script type="text/javascript">
(function() {
@ -207,16 +208,16 @@
</script>
<div id="fb_like" class="fb-like iconS" data-href="{{ item.get_absolute_url }}" data-send="false" data-width="90" data-show-faces="false" data-layout="button_count"></div>
<!-- <img src="/static/images/noel/facebook.png" width="18" height="18" alt="facebook" class="iconImages"> -->
<!-- <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>-->
<!-- <iframe src="http://www.facebook.com/plugins/like.php?href=theatreforum.in{{ item.get_absolute_url|urlencode }}&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> -->
<div id="fb_like" class="fb-like iconS" data-href="http://theatreforum.in{{ item.get_absolute_url }}" data-send="false" data-width="48" data-show-faces="false" data-layout="button_count"></div>
<!-- <a href="{{ item.get_absolute_url }}" id="permalinkBtn" title="Permalink" class="iconS"><img src="/static/images/noel/download.jpg" width="18" height="18" alt="permalink" title="Permalink" class="iconImages"></a> -->
<a href="" id="permalinkBtn" title="Permalink" class="iconS"><img src="/static/images/noel/download.jpg" width="18" height="18" alt="permalink" title="Permalink" class="iconImages"></a>
</div>
<div style="clear:both;"></div>
</div>
</div>
<div id="bottomRight">
{{ item_data.html|safe }}

View File

@ -31,11 +31,14 @@
-->
{% if query %}
<h2>YOUR RESULTS:</h2>
<p>
{% for result in page.object_list %}
<a href="{{ result.object.get_absolute_url }}&amp;search={{ query }}">{{ result.object.title }}</a>
{{ result.text|truncatewords:60|markdown|safe }}
</p>
{% empty %}
<p class="noResults">No results found.</p>
{% endfor %}

View File

@ -31,7 +31,7 @@ urlpatterns = patterns('',
# (r'api/', 'api.views.api'),
# (r'jsdoc/', 'api.views.jsdoc'),
# (r'site.json', 'app.views.site_json'),
(r'^itf/', include('festival.urls')),
(r'^itf/(?P<old_url>.*)', 'festival.views.redirect'),
# (r'^accounts/register/', 'registration.views.register', {'form_class': ItfRegistrationForm }),
(r'^accounts/', include('registration.urls')),
(r'^admin/', include(admin.site.urls)),