Skip to content

Commit

Permalink
Merge pull request #29 from omalley1/master
Browse files Browse the repository at this point in the history
Looks good to me.
  • Loading branch information
Zomega committed Aug 26, 2013
2 parents 8fc29d5 + 317dc68 commit b0c1f11
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 142 deletions.
149 changes: 9 additions & 140 deletions dashboard/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,149 +12,18 @@
</div>

<div class="slides">
{% for slide in slides %}
{% if slide.stype == "WIDGET" %}
{% include "widget_slide.html" %}
{% endif %}

<div class="slide" id="landing-slide">

<!-- Clock Widget -->
<div class="panel2" id="time">
<div class="icon">
<div id="clock">
</div>
</div>
<div class="widget-content2">
<h1>N/A</h1></br>
<h2>N/A</h2>
</div>
</div>
<!-- End Clock Widget -->

<!-- Weather Widget-->
<div class="panel2" id="weather">
<div class="icon">
<img src="{{ STATIC_URL }}img/no_icon.png"></img>
</div>
<div class="widget-content2">
<h1 class="temp">N/A</h1><br />
<h2 class="description">Unavailable</h2>
</div>
</div>
<!-- End Weather Widget-->

<!-- Nextbus Widget -->
<div class="panel2" id="nextbus">
<div class="icon">
<img src="{{ STATIC_URL }}img/bus.png"></img>
</div>
<div class="widget-content2">
<h1 class="next">N/A</h1><br />
<h2><span class="second">N/A</span> <span class="third">N/A</span></h2>
</div>
</div>
<!-- End Nextbus Widget-->

<!-- Events Widget -->
<div class="panel3" id="events">
<div class="icon">
<img src="{{ STATIC_URL }}img/events.png"></img>
{% if slide.stype == "POSTER" %}
<div class="slide" id="res-event">
<img src="{{ slide.path }}"></img>
</div>
<div class="widget-content3">
<h2 class="title">Unavailable</h2><br/>
<h2 class="time">N/A</h2>
</div>
</div>
<!-- End Events Widget -->

<!-- News Widget -->
<div class="panel3" id="news">
<div class="icon">
<img src="{{ STATIC_URL }}img/BBC.png"></img>
</div>
<div class="widget-content3">
<h2 class="title">Unavailable</h2>
</div>
</div>
<!-- End News Widget -->

</div>

<div class="slide" id="res-event">
<img src="{{ STATIC_URL }}img/poster/Simmons_10th_Anniversary.jpg"></img>
</div>

<div class="slide" id="res-event1">
<img src="{{ STATIC_URL }}img/poster/Boston_Harbor_Cruise.jpg"></img>
</div>

<div class="slide" id="landing-slide2">

<!-- Clock Widget -->
<div class="panel2" id="time">
<div class="icon">
<div id="clock">
</div>
</div>
<div class="widget-content2">
<h1>N/A</h1></br>
<h2>N/A</h2>
</div>
</div>
<!-- End Clock Widget -->

<!-- Weather Widget-->
<div class="panel2" id="weather">
<div class="icon">
<img src="{{ STATIC_URL }}img/no_icon.png"></img>
</div>
<div class="widget-content2">
<h1 class="temp">N/A</h1><br />
<h2 class="description">Unavailable</h2>
</div>
</div>
<!-- End Weather Widget-->

<!-- Nextbus Widget -->
<div class="panel2" id="nextbus">
<div class="icon">
<img src="{{ STATIC_URL }}img/bus.png"></img>
</div>
<div class="widget-content2">
<h1 class="next">N/A</h1><br />
<h2><span class="second">N/A</span> <span class="third">N/A</span></h2>
</div>
</div>
<!-- End Nextbus Widget-->

<!-- Events Widget -->
<div class="panel3" id="events">
<div class="icon">
<img src="{{ STATIC_URL }}img/events.png"></img>
</div>
<div class="widget-content3">
<h2 class="title">Unavailable</h2><br/>
<h2 class="time">N/A</h2>
</div>
</div>
<!-- End Events Widget -->

<!-- News Widget -->
<div class="panel3" id="news">
<div class="icon">
<img src="{{ STATIC_URL }}img/BBC.png"></img>
</div>
<div class="widget-content3">
<h2 class="title">Unavailable</h2>
</div>
</div>
<!-- End News Widget -->

</div>

<div class="slide" id="res-event2">
<img src="{{ STATIC_URL }}img/poster/Bobby_Weber.jpg"></img>
</div>

{% endif %}
{% endfor %}
</div>

</div>

<!-- Standard scripts -->
Expand Down
62 changes: 62 additions & 0 deletions dashboard/templates/widget_slide.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<div class="slide" id="landing-slide">
<!-- Clock Widget -->
<div class="panel2" id="time">
<div class="icon">
<div id="clock">
</div>
</div>
<div class="widget-content2">
<h1>N/A</h1></br>
<h2>N/A</h2>
</div>
</div>
<!-- End Clock Widget -->

<!-- Weather Widget-->
<div class="panel2" id="weather">
<div class="icon">
<img src="{{ STATIC_URL }}img/no_icon.png"></img>
</div>
<div class="widget-content2">
<h1 class="temp">N/A</h1><br />
<h2 class="description">Unavailable</h2>
</div>
</div>
<!-- End Weather Widget-->

<!-- Nextbus Widget -->
<div class="panel2" id="nextbus">
<div class="icon">
<img src="{{ STATIC_URL }}img/bus.png"></img>
</div>
<div class="widget-content2">
<h1 class="next">N/A</h1><br />
<h2><span class="second">N/A</span> <span class="third">N/A</span></h2>
</div>
</div>
<!-- End Nextbus Widget-->

<!-- Events Widget -->
<div class="panel3" id="events">
<div class="icon">
<img src="{{ STATIC_URL }}img/events.png"></img>
</div>
<div class="widget-content3">
<h2 class="title">Unavailable</h2><br/>
<h2 class="time">N/A</h2>
</div>
</div>
<!-- End Events Widget -->

<!-- News Widget -->
<div class="panel3" id="news">
<div class="icon">
<img src="{{ STATIC_URL }}img/BBC.png"></img>
</div>
<div class="widget-content3">
<h2 class="title">Unavailable</h2>
</div>
</div>
<!-- End News Widget -->

</div>
20 changes: 18 additions & 2 deletions dashboard/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.shortcuts import render_to_response, render
import requests

def home(request):
return render_to_response('index.html', context_instance = RequestContext(request))
class Slide():
def __init__(self, slide_type, path="NA"):
# slide_type is of WIDGET or POSTER
self.stype = slide_type
self.path = path

slides = []
img_urls = requests.get("https://adat.scripts.mit.edu:444/www/dev/simmons/display/dashboard.php").json()

# naively insert a widget slide after every 2 images
for i in range(len(img_urls)):
if i % 2:
slides.append(Slide("WIDGET"))
slides.append(Slide("POSTER", img_urls[i]))

return render(request, "index.html", {"slides": slides})

def sevenk(request):
return render_to_response('sevenk.html', context_instance = RequestContext(request))

0 comments on commit b0c1f11

Please sign in to comment.