Commit e048b325 by Matthew Mongeau

Get dropdown working

parent 73372753
......@@ -46,7 +46,6 @@ def index(request):
@ensure_csrf_cookie
def dashboard(request):
user = request.user
csrf_token = csrf(request)['csrf_token']
return render_to_response('dashboard.html', {'csrf': csrf_token})
......
......@@ -14,7 +14,7 @@ $ ->
$('body').addClass 'touch-based-device' if onTouchBasedDevice()
$("a[rel*=leanModal]").leanModal()
# $("a[rel*=leanModal]").leanModal()
$('#csrfmiddlewaretoken').attr 'value', $.cookie('csrftoken')
if $('body').hasClass('courseware')
......
/*!
* jQuery Cookie Plugin
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2011, Klaus Hartl
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*/
(function($) {
$.cookie = function(key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
options = $.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
var pairs = document.cookie.split('; ');
for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
}
return null;
};
})(jQuery);
......@@ -16,6 +16,7 @@
<script type="text/javascript" src="${static.url('js/vendor/jquery-1.6.2.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/jquery-ui-1.8.16.custom.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/jquery.cookie.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/swfobject/swfobject.js')}"></script>
% if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
......
<%page args="active_page" />
<%namespace name='static' file='static_content.html'/>
<%block name="js_extra">
<script src="${static.url('js/my_courses_dropdown.js')}"></script>
</%block>
<header class="app" aria-label="Global Navigation">
<nav>
<a href="${ MITX_ROOT_URL }/mitxhome" class="logo">
......@@ -6,11 +11,12 @@
</a>
<h1>${ settings.COURSE_TITLE }</h1>
%if user.is_authenticated():
<ol class="user">
<li>
<a href="/dashboard" class="user-dashboard">
<span class="avatar"><img src="/static/images/profile.jpg" /></span>
Neil deGrasse Tyson
${ user.username }
</a>
</li>
<li>
......@@ -21,6 +27,7 @@
</ol>
</li>
</ol>
%endif
</nav>
</header>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment