From 7337275303478ad0f884fee65bb122608cb55fee Mon Sep 17 00:00:00 2001
From: Matthew Mongeau <halogenandtoast@gmail.com>
Date: Thu, 14 Jun 2012 13:50:16 -0400
Subject: [PATCH] Adding dashboard

---
 lms/djangoapps/student/views.py     |   6 ++
 lms/templates/dashboard.html        | 145 ++++++++++++++++++++++++++++
 lms/templates/guest_navigation.html |   2 +-
 lms/templates/navigation.html       |   2 +-
 lms/urls.py                         |   1 +
 5 files changed, 154 insertions(+), 2 deletions(-)
 create mode 100644 lms/templates/dashboard.html

diff --git a/lms/djangoapps/student/views.py b/lms/djangoapps/student/views.py
index ceb2b48cc1b..9214bc42237 100644
--- a/lms/djangoapps/student/views.py
+++ b/lms/djangoapps/student/views.py
@@ -44,6 +44,12 @@ def index(request):
         # TODO: Clean up how 'error' is done.
         return render_to_response('index.html', {'csrf': csrf_token })
 
+@ensure_csrf_cookie
+def dashboard(request):
+  user = request.user
+  csrf_token = csrf(request)['csrf_token']
+  return render_to_response('dashboard.html', {'csrf': csrf_token})
+
 # Need different levels of logging
 @ensure_csrf_cookie
 def login_user(request, error=""):
diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html
new file mode 100644
index 00000000000..c77d443080e
--- /dev/null
+++ b/lms/templates/dashboard.html
@@ -0,0 +1,145 @@
+<%inherit file="main.html" />
+<%include file="navigation.html" args="active_page='dashboard'" />
+
+<%namespace name='static' file='static_content.html'/>
+
+<section class="container">
+  <section class="dashboard">
+
+    <section class="sidebar">
+      <header class="profile">
+        <section class="user-info">
+          <div class="avatar">
+            <img src="${static.url('images/profile.jpg')}" />
+          </div>
+          <section class="info">
+            <h2>SpaceMan024</h2>
+            <ul>
+              <li>
+                <h3>Email: <span>neil@planetarium.com</span></h3>
+              </li>
+              <li>
+                <h3>Location: <span>New York, NY</span></h3>
+              </li>
+              <li>
+                <h3>Language: <span>English</span></h3>
+              </li>
+            </ul>
+          </section>
+        </section>
+        <section class="meta-info">
+        </section>
+      </header>
+    </section>
+
+    <section class="courses">
+      <nav class="course-filters">
+        <ol class="filters">
+          <li class="selected">
+            <h2>All <span class="count">3</span></h2>
+          </li>
+          <li>
+            <h2>Current <span class="count">3</span></h2>
+          </li>
+          <li>
+            <h2>Upcoming <span class="count">0</span></h2>
+          </li>
+          <li>
+            <h2>Completed <span class="count">0</span></h2>
+          </li>
+        </ol>
+      </nav>
+
+      <article class="course">
+        <a href="/course.html">
+          <div class="cover">
+            <div class="shade"></div>
+            <div class="arrow"></div>
+            <img src="${static.url('images/history.png')}" />
+          </div>
+          <section class="info">
+            <hgroup>
+              <h2>18th Century History</h2>
+              <p>Adam Smith, Harvard University</p>
+            </hgroup>
+            <div class="edit">options</div>
+            <section class="meta">
+              <div class="complete">
+                <p>60% complete</p>
+              </div>
+              <div class="progress">
+                <div class="meter">
+                  <div class="meter-fill"></div>
+                </div>
+              </div>
+              <div class="end-date">
+                <p>End date: <time>6/10/12</time></p>
+              </div>
+            </section>
+          </section>
+        </a>
+      </article>
+
+      <article class="course">
+        <a href="/course.html">
+          <div class="cover">
+            <div class="shade"></div>
+            <div class="arrow"></div>
+            <img src="${static.url('images/math.png')}" />
+          </div>
+          <section class="info">
+            <hgroup>
+              <h2>Linear Algebra</h2>
+              <p>Adam Smith, Harvard University</p>
+            </hgroup>
+            <div class="edit">options</div>
+            <section class="meta">
+              <div class="complete">
+                <p>60% complete</p>
+              </div>
+              <div class="progress">
+                <div class="meter">
+                  <div class="meter-fill"></div>
+                </div>
+              </div>
+              <div class="end-date">
+                <p>End date: <time>6/10/12</time></p>
+              </div>
+            </section>
+          </section>
+        </a>
+      </article>
+
+      <article class="course">
+        <a href="/course.html">
+          <div class="cover">
+            <div class="shade"></div>
+            <div class="arrow"></div>
+            <img src="${static.url('images/python.png')}" />
+          </div>
+          <section class="info">
+            <hgroup>
+              <h2>CS 102 Python</h2>
+              <p>Adam Smith, Harvard University</p>
+            </hgroup>
+            <div class="edit">options</div>
+            <section class="meta">
+              <div class="complete">
+                <p>60% complete</p>
+              </div>
+              <div class="progress">
+                <div class="meter">
+                  <div class="meter-fill"></div>
+                </div>
+              </div>
+              <div class="end-date">
+                <p>End date: <time>6/10/12</time></p>
+              </div>
+            </section>
+          </section>
+        </a>
+      </article>
+    </section>
+
+  </section>
+</section>
diff --git a/lms/templates/guest_navigation.html b/lms/templates/guest_navigation.html
index da131841ebf..6f3aa781877 100644
--- a/lms/templates/guest_navigation.html
+++ b/lms/templates/guest_navigation.html
@@ -8,7 +8,7 @@
       <li><a href="#">How It Works</a></li>
     </ol>
     <ol class="user">
-      <li><a href="/dashboard.html">Log In</a></li>
+      <li><a href="/dashboard">Log In</a></li>
       <li><a href="#">Sign Up</a></li>
     </ol>
     <ol class="secondary">
diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html
index c94ce0b24a2..04852aa0555 100644
--- a/lms/templates/navigation.html
+++ b/lms/templates/navigation.html
@@ -8,7 +8,7 @@
     <h1>${ settings.COURSE_TITLE }</h1>
     <ol class="user">
       <li>
-        <a href="/dashboard.html" class="user-dashboard">
+        <a href="/dashboard" class="user-dashboard">
           <span class="avatar"><img src="/static/images/profile.jpg" /></span>
           Neil deGrasse Tyson
         </a>
diff --git a/lms/urls.py b/lms/urls.py
index 2bf512b2fea..6064e72d09c 100644
--- a/lms/urls.py
+++ b/lms/urls.py
@@ -12,6 +12,7 @@ if settings.DEBUG:
 
 urlpatterns = ('',
     url(r'^$', 'student.views.index'), # Main marketing page, or redirect to courseware
+    url(r'^dashboard$', 'student.views.dashboard'),
     url(r'^course_info$', 'student.views.course_info'),
     url(r'^courses$', 'student.views.courses'),
     url(r'^change_email$', 'student.views.change_email_request'),
-- 
GitLab