Permalink
Browse files

added styles and changes to index

  • Loading branch information...
1 parent 9169d64 commit 625e841f2773e3846a53be98302dcf6b2bf33377 @robrocker7 committed Jun 15, 2012
@@ -54,6 +54,16 @@ body {
width: 960px;
margin-bottom: 10px;
+ .video_container {
+ text-align: center;
+ float: left;
+ }
+
+ .chat_container {
+ text-align: right;
+ float: right;
+ }
+
#new_bar {
font-size: 36px;
border: 1px solid #000;
View
@@ -0,0 +1,18 @@
+from django.template import RequestContext
+from django.shortcuts import render_to_response
+
+from apps.faith.models import Bar
+
+def main(request):
+ try:
+ bar = Bar.objects.latest('date_created')
+ except Bar.DoesNotExist:
+ bar = Bar()
+ bar.save()
+
+ has_voted = bar.has_voted(request.META['REMOTE_ADDR'])
+
+ return render_to_response('index.html', {
+ 'has_voted': has_voted,
+ 'bar': bar,
+ }, context_instance=RequestContext(request))
View
@@ -1,7 +1,6 @@
from django.conf.urls import patterns, include, url
urlpatterns = patterns('apps.faith.views',
- url(r'^$', 'track', name='track'),
url(r'^new/$', 'new_bar', name='new'),
url(r'^instance/(?P<bar_id>\d+)/$', 'check_votes', name='check_votes'),
View
@@ -27,8 +27,15 @@
<h1>Ghoknhar</h1>
<h2>Casual Gaming</h2>
+ <div id="twitch-follow">
+ <div id="twitch-frame">
+
+ </div>
+ </div>
<div id="social-links">
-
+ <li> </li>
+ <li> </li>
+ <li> </li>
</div>
</div>
<div id="content">{% block content %}{% endblock %}</div>
View
@@ -1,5 +1,54 @@
{% extends "base.html" %}
+{% block extra_css %}
+ <link rel="stylesheet/less" type="text/css" href="{{ STATIC_URL }}less/faith.less" />
+{% endblock %}
+
+{% block extra_scripts %}
+<script type="text/javascript">
+$(document).ready(function() {
+ var check_for_faith = 1000;
+ var faith_check_timeout = setInterval(faith_check, check_for_faith);
+
+ function faith_check() {
+ $.get('{% url faith:check_votes bar.id %}', function(json_response) {
+ if(json_response.success) {
+ var faith_count = json_response.faith_count;
+ var no_faith_count = json_response.no_faith_count;
+ update_faith(faith_count, no_faith_count);
+ }else if(!json_response.success && json_response.new_bar) {
+ window.location.reload();
+ } else {
+ alert('Hmm... Something went wrong... maybe refresh?');
+ clearInterval(faith_check_timeout);
+ }
+ });
+ }
+ function update_faith(faith_count, no_faith_count) {
+ var percentage = Number((Number(faith_count) / Number((faith_count + no_faith_count)))) * 100;
+ $('#has_faith').css({'width': percentage+'%'});
+ }
+});
+</script>
+{% endblock %}
+
{% block content %}
- Link to the faith tracker: <a href="{% url faith:track %}">Click</a>
+ <div class="video_container">
+ <object type="application/x-shockwave-flash" height="390" width="640" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=ghoknhar" bgcolor="#000000"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /><param name="flashvars" value="hostname=www.twitch.tv&channel=ghoknhar&auto_play=false&start_volume=25" /></object><a href="http://www.twitch.tv/ghoknhar#r=-rid-&amp;s=em" class="trk" style="padding:2px 0px 4px; display:block; width:345px; font-weight:normal; font-size:10px; text-decoration:underline; text-align:center;">Watch live video from ghoknhar on www.twitch.tv</a>
+ </div>
+ <div class="chat_container">
+ <iframe width="310" height="420" src="http://www.twitch.tv/chat/embed?channel=ghoknhar&popout_chat=true" frameborder="0" scrolling="no"></iframe>
+ </div>
+ <div class="clear"></div>
+ <div id="faith_container">
+ <div id="faith_bar">
+ <div id="has_faith"></div>
+ </div>
+ {% if not has_voted %}
+ <div id="faith_buttons">
+ <a class="button" id="faith_me" href="{% url faith:vote bar.id %}?is=faith">faith</a>
+ <a class="button" id="no_faith_me" href="{% url faith:vote bar.id %}?is=faithless">no faith</a>
+ </div>
+ {% endif %}
+ </div>
{% endblock %}
View
@@ -17,6 +17,5 @@
url(r'^admin/', include(admin.site.urls)),
url(r'^faith/', include('apps.faith.urls', namespace='faith')),
- url(r'^$', direct_to_template,
- {'template': 'index.html'}, name='index'),
+ url(r'^$', 'apps.common.views.main', name='index'),
)

0 comments on commit 625e841

Please sign in to comment.