"""
if self.slug is not None:
# return a url ending in slug
- return reverse('note_detail', args=[self.course.school.slug, self.course.slug, self.slug])
+ if self.course.school:
+ return reverse('note_detail', args=[self.course.school.slug, self.course.slug, self.slug])
+ else:
+ return reverse('note_detail', args=[self.course.department.school.slug, self.course.slug, self.slug])
else:
# return a url ending in id
return reverse('note_detail', args=[self.course.school.slug, self.course.slug, self.id])
+body {
+ font-family: 'adelle-sans';
+}
+
+.museo300 {
+ font-family: 'museo300';
+}
+
+.museo700 {
+ font-family: 'museo700';
+}
+
+.adelle-sans {
+ font-family: 'adelle-sans';
+}
+
.nav-list ul {
list-style-type: none;
margin: 0;
}
.mobile-nav-list li {
- padding: 10px 10px 10px 10px;
font-size: 1.5em;
+ padding: 0 20px 0 10px;
+}
+
+.mobile-nav-item {
+ padding: 5px 0px 5px 0px;
+ border-bottom: 1px solid black;
+ width: 100%;
+ color: #999999;
}
#header-nav {
#header-login-nav {
text-align: right;
background: #000000;
- color: #d4d4d4;
+ padding: 3px 0 3px 0;
}
-#header-login-nav a {
+#header-login-nav ul {
color: #d4d4d4;
+ font: 0.8em 'adelle-sans';
}
#logo-container {
background: #333333;
color: #d4d4d4;
padding: 1em 0 0.4em 0;
- font: 1em 'museo300';
}
.gradient-bar
}
-span.table-school,
+span.table-school {
+ font-weight: bold;
+}
+
span.table-note-count,
span.table-quiz-count,
span.table-thanks-count {
- font-weight: bold;
+ margin-right: 15px;
}
-span.table-course-name {
+.table-course-name {
font-size: 1.8em;
+ margin-right: 10px;
}
table.dataTable {
}
table.dataTable div.table-entry-first-line {
- padding-top: 20px;
- font-family: 'museo700';
+ font-size: 0.9em;
+ margin: 0 0 5px 0;
}
-table.dataTable div.table-entry-second-line {
- font-family: 'museo700';
+table.dataTable div.table-entry-third-line {
+ font-size: 0.9em;
+ margin: 5px 0 0 0;
}
-table.dataTable div.table-entry-third-line {
- padding-bottom: 20px;
- font-family: 'Akkurat-Leicht';
+table.dataTable div.data-table-entry {
+ margin: 20px 0 20px 0;
}
table.dataTable tr.even {
#splash {
font: 3em 'Museo700';
padding: 10vh 5vh 10vh 5vh;
- background: grey;
color: #ffffff;
text-align: center;
}
#end-header
{
margin-top: 20px;
- border-bottom: 1px solid black;
}
#edit-button,
}
#note-search-bar {
- margin-top: 20px;
- border: 1px solid grey;
- padding: 10px 0 0 0;
+ background: #f5f5f5;
+ padding: 15px 0 0 0;
+ font: 1em 'museo300';
+ margin-bottom: 20px;
}
ul.socialaccount_providers li,
display: inline;
}
+table.dataTable div.note-date {
+ margin-bottom: 10px;
+}
+
+table.dataTable div.note-text {
+ margin: 10px 0 10px 0;
+}
+
KARMAWORLD.Course.initCourseNameAutocomplete({});
KARMAWORLD.Course.initInstructorNameAutocomplete({});
- $('#data_table_list').dataTable({
- // remove the default filter label
- 'oLanguage': {
- 'sSearch': '',
- },
- // we will set column widths explicitly
- 'bAutoWidth': false,
- // don't provide a option for the user to change the table page length
- 'bLengthChange': false,
- // sepcify the number of rows in a page
- 'iDisplayLength': 20,
- // Position the filter bar at the top
- // DIFF: do not show search bar (f)
- 'sDom': '<"top">rt<"bottom"p><"clear">',
- // Specify options for each column
- "aoColumnDefs": [
- {
- // 3rd element: likes
- "aTargets": [ 2 ],
- "bSortable": true,
- "bVisible": true,
- "mData": function ( source, type, val ) {
- //console.log(source);
- if (type === 'set') {
- source.count = val;
- // Store the computed dislay and filter values for efficiency
- // DIFF: label name change.
- source.count_display = val=="" ? "" : "<span>"+val+" Thanks</span>";
- return;
- }
- else if (type === 'display') {
- return source.count_display;
- }
- // 'sort', 'type', 'filter' and undefined all just use the integer
- return source.count;
- }
- },
- {
- // 2nd element: date
- "aTargets": [ 1 ],
- "bSortable": true,
- "bVisible": true,
- "mData": function ( source, type, val ) {
- //console.log(source);
- if (type === 'set') {
- source.date = val;
- // DIFF: label name change.
- source.date_display = val=="" ? "" : "<span>Uploaded "+val+"</span>";
- return;
- }
- else if (type === 'display') {
- return source.date_display;
- }
- // for types 'sort', 'type', 'filter' and undefined use raw date
- return source.date;
+ $(function() {
+
+ // load dataTable for course data
+ var dataTable = $('#data_table_list').dataTable({
+ // we will set column widths explicitly
+ 'bAutoWidth': false,
+ // don't provide a option for the user to change the table page length
+ 'bLengthChange': false,
+ // sepcify the number of rows in a page
+ 'iDisplayLength': 20,
+ // Position the filter bar at the top
+ 'sDom': '<"top">rt<"bottom"p><"clear">',
+ // Specify options for each column
+ "aoColumnDefs": [
+ {
+ // 2nd element: thanks
+ "aTargets": [ 1 ],
+ "bSortable": true,
+ "bVisible": true
+ },
+ {
+ // 1st element: date
+ "aTargets": [ 0 ],
+ "bSortable": true,
+ "bVisible": true
}
- },
- {
- // 1st element: "sort by" label
- "aTargets": [ 0 ],
- "bSortable": false,
- "bVisible": true
- }
- ],
- // Initial sorting
- 'aaSorting': [[2,'desc']]
+ ],
+ // Initial sorting
+ 'aaSorting': [[1,'desc']]
+ });
+
+ // wire up search box
+ $('input.search-notes').keyup(function() {
+ dataTable.fnFilter($(this).val());
+ });
+
+ // wire up sort chooser
+ $('select.course-sort').change(function() {
+ dataTable.fnSort([[$(this).val(), 'desc']]);
+ });
+
+ // sort by current value of sort chooser, since
+ // the browser may change this from our default
+ dataTable.fnSort([[$('select.note-sort').val(), 'desc']]);
+
});
});
--- /dev/null
+/*! Backstretch - v2.0.4 - 2013-06-19
+* http://srobbin.com/jquery-plugins/backstretch/
+* Copyright (c) 2013 Scott Robbin; Licensed MIT */
+(function(a,d,p){a.fn.backstretch=function(c,b){(c===p||0===c.length)&&a.error("No images were supplied for Backstretch");0===a(d).scrollTop()&&d.scrollTo(0,0);return this.each(function(){var d=a(this),g=d.data("backstretch");if(g){if("string"==typeof c&&"function"==typeof g[c]){g[c](b);return}b=a.extend(g.options,b);g.destroy(!0)}g=new q(this,c,b);d.data("backstretch",g)})};a.backstretch=function(c,b){return a("body").backstretch(c,b).data("backstretch")};a.expr[":"].backstretch=function(c){return a(c).data("backstretch")!==p};a.fn.backstretch.defaults={centeredX:!0,centeredY:!0,duration:5E3,fade:0};var r={left:0,top:0,overflow:"hidden",margin:0,padding:0,height:"100%",width:"100%",zIndex:-999999},s={position:"absolute",display:"none",margin:0,padding:0,border:"none",width:"auto",height:"auto",maxHeight:"none",maxWidth:"none",zIndex:-999999},q=function(c,b,e){this.options=a.extend({},a.fn.backstretch.defaults,e||{});this.images=a.isArray(b)?b:[b];a.each(this.images,function(){a("<img />")[0].src=this});this.isBody=c===document.body;this.$container=a(c);this.$root=this.isBody?l?a(d):a(document):this.$container;c=this.$container.children(".backstretch").first();this.$wrap=c.length?c:a('<div class="backstretch"></div>').css(r).appendTo(this.$container);this.isBody||(c=this.$container.css("position"),b=this.$container.css("zIndex"),this.$container.css({position:"static"===c?"relative":c,zIndex:"auto"===b?0:b,background:"none"}),this.$wrap.css({zIndex:-999998}));this.$wrap.css({position:this.isBody&&l?"fixed":"absolute"});this.index=0;this.show(this.index);a(d).on("resize.backstretch",a.proxy(this.resize,this)).on("orientationchange.backstretch",a.proxy(function(){this.isBody&&0===d.pageYOffset&&(d.scrollTo(0,1),this.resize())},this))};q.prototype={resize:function(){try{var a={left:0,top:0},b=this.isBody?this.$root.width():this.$root.innerWidth(),e=b,g=this.isBody?d.innerHeight?d.innerHeight:this.$root.height():this.$root.innerHeight(),j=e/this.$img.data("ratio"),f;j>=g?(f=(j-g)/2,this.options.centeredY&&(a.top="-"+f+"px")):(j=g,e=j*this.$img.data("ratio"),f=(e-b)/2,this.options.centeredX&&(a.left="-"+f+"px"));this.$wrap.css({width:b,height:g}).find("img:not(.deleteable)").css({width:e,height:j}).css(a)}catch(h){}return this},show:function(c){if(!(Math.abs(c)>this.images.length-1)){var b=this,e=b.$wrap.find("img").addClass("deleteable"),d={relatedTarget:b.$container[0]};b.$container.trigger(a.Event("backstretch.before",d),[b,c]);this.index=c;clearInterval(b.interval);b.$img=a("<img />").css(s).bind("load",function(f){var h=this.width||a(f.target).width();f=this.height||a(f.target).height();a(this).data("ratio",h/f);a(this).fadeIn(b.options.speed||b.options.fade,function(){e.remove();b.paused||b.cycle();a(["after","show"]).each(function(){b.$container.trigger(a.Event("backstretch."+this,d),[b,c])})});b.resize()}).appendTo(b.$wrap);b.$img.attr("src",b.images[c]);return b}},next:function(){return this.show(this.index<this.images.length-1?this.index+1:0)},prev:function(){return this.show(0===this.index?this.images.length-1:this.index-1)},pause:function(){this.paused=!0;return this},resume:function(){this.paused=!1;this.next();return this},cycle:function(){1<this.images.length&&(clearInterval(this.interval),this.interval=setInterval(a.proxy(function(){this.paused||this.next()},this),this.options.duration));return this},destroy:function(c){a(d).off("resize.backstretch orientationchange.backstretch");clearInterval(this.interval);c||this.$wrap.remove();this.$container.removeData("backstretch")}};var l,f=navigator.userAgent,m=navigator.platform,e=f.match(/AppleWebKit\/([0-9]+)/),e=!!e&&e[1],h=f.match(/Fennec\/([0-9]+)/),h=!!h&&h[1],n=f.match(/Opera Mobi\/([0-9]+)/),t=!!n&&n[1],k=f.match(/MSIE ([0-9]+)/),k=!!k&&k[1];l=!((-1<m.indexOf("iPhone")||-1<m.indexOf("iPad")||-1<m.indexOf("iPod"))&&e&&534>e||d.operamini&&"[object OperaMini]"==={}.toString.call(d.operamini)||n&&7458>t||-1<f.indexOf("Android")&&e&&533>e||h&&6>h||"palmGetResource"in d&&e&&534>e||-1<f.indexOf("MeeGo")&&-1<f.indexOf("NokiaBrowser/8.5.0")||k&&6>=k)})(jQuery,window);
\ No newline at end of file
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
+ <script type="text/javascript" src="//use.typekit.net/pnc8diw.js"></script>
+ <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<!-- block pagescripts -->
{% include 'footer.html' %}
<!-- end include footer-->
+ <a class="exit-off-canvas"></a>
+
<!-- block bodyscripts -->
{% block bodyscripts %}
{% endblock %}
<script>
$(document).foundation();
</script>
- <a class="exit-off-canvas"></a>
</div>
</body>
{{ file_upload_form.fp_file }}
</div>
<div class="small-12 large-6 columns">
- <form class="search-notes" action="{% url 'note_search' %}" method="GET">
+ <form class="search-notes adelle-sans" action="{% url 'note_search' %}" method="GET">
<input name="query" class="search-notes" type="text" placeholder="Search Notes" />
<input type="hidden" name="course_id" value="{{ course.id }}">
</form>
Sort By
<select class="note-sort">
<option value="0">Date</option>
- <option value="1">Number of Quizzes</option>
- <option value="2" selected>Popularity</option>
+ <option value="1" selected>Popularity</option>
</select>
</div>
</div>
</div>
</div>
- <div class="row">
- <div class="small-10 columns small-offset-1"> <hr/> </div>
- </div>
-
<div id="course_container">
<div class="row">
- <div class="small-12 columns large-10 large-offset-1">
+ <div class="small-12 columns">
+ <!-- Main course table -->
<table id="data_table_list">
- <thead><tr>
- <th id="data-table-sort-by"> Sort by: </th>
- <th id="data-table-date"> Date </th>
- <th id="data-table-thank-count"> Popularity </th>
- <th class="no-display" id="data-table-note-name"> Name </th>
- <th class="no-display" id="data-table-tags"> Tags </th>
- <th class="no-display" id="data-table-note-preview"> Preview </th>
- </tr></thead>
+ <thead class="hide">
+ <tr>
+ <th class="no-display" id="data-table-date"> Date </th>
+ <th class="no-display" id="data-table-thanks"> Popularity </th>
+ <th class="no-display" id="data-table-note"> Note </th>
+ </tr>
+ </thead>
<tbody>
{% for note in note_set %}
{% include 'notes/note_list_entry.html' with note=note %}
</tbody>
</table>
</div>
- </div>
+ </div> <!-- .row -->
+
</div><!-- /course_container -->
</section><!--/course_content-->
{% block bodyscripts %}
<script src="{{ STATIC_URL }}js/jquery.dataTables.min.js"></script>
+ <script src="{{ STATIC_URL }}js/jquery.backstretch.min.js"></script>
+ <script>
+ $("#splash").backstretch("{{ STATIC_URL }}img/banner.jpg");
+ </script>
{% endblock %}
{% block content %}
<section id="home_content">
<div id="page_header">
- <div id="splash">
- <div class="row">
- <div class="small-12 large-8 columns large-offset-2">
- Browse and contribute lecture notes and quizzes from over 100 college courses.
- </div>
+ <div id="splash">
+ <div class="row">
+ <div class="small-12 large-8 columns large-offset-2">
+ Browse and contribute lecture notes and quizzes from over 100 college courses.
</div>
- <div class="row">
- <div class="small-12 columns">
- <button id="intro-video-button">Watch the video <i class='fa fa-caret-right'></i></button>
- </div>
+ </div>
+ <div class="row">
+ <div class="small-12 columns">
+ <button id="intro-video-button">Watch the video <i class='fa fa-caret-right'></i></button>
</div>
</div>
</div>
<th class="no-display" id="data-table-date"> Date </th>
<th class="no-display" id="data-table-note-count"> # Notes </th>
<th class="no-display" id="data-table-thanks"> Popularity </th>
- <th class="no-display" id="data-table-upload"> School & Instructor </th>
- <th class="no-display" id="data-table-course-name"> Course Name </th>
- <th class="no-display" id="data-table-school-name"> Stats </th>
+ <th class="no-display" id="data-table-upload"> Course </th>
</tr>
</thead>
<tbody>
{% endfor %}
</tbody>
</table>
- </div><!-- .ten columns -->
+ </div>
</div> <!-- .row -->
{% include 'partial/add_course.html' %}
<tr class="table-row">
<td class="hide">{{ course.updated_at|date:"U" }}</td>
- <td class="hide">{{ course.file_count }}</td>
- <td class="hide">{{ course.get_popularity }}</td>
+ <td class="hide">{{ course.file_count|stringformat:"010g" }}</td>
+ <td class="hide">{{ course.get_popularity|stringformat:"010g" }}</td>
<td class="small-12 columns">
- <div class="table-entry-first-line">
- <span class="table-school">
- {% if course.school.name %}
- {{ course.school.name }}
+ <div class="data-table-entry">
+ <div class="table-entry-first-line">
+ <span class="table-school">
+ {% if course.school.name %}
+ {{ course.school.name }}
+ {% endif %}
+ {% if course.department.school.name %}
+ {{ course.department.school.name }}
+ {% endif %}
+ </span>
+ {% if course.department %}
+ •
+ <span class="table-department">{{ course.department.name }}</span>
{% endif %}
- {% if course.department.school.name %}
- {{ course.department.school.name }}
+ {% if course.instructor_name %}
+ •
+ <span class="table-instructor">{{ course.instructor_name }}</span>
{% endif %}
- </span>
- {% if course.department %}
- •
- <span class="table-department">{{ course.department.name }}</span>
- {% endif %}
- {% if course.instructor_name %}
- •
- <span class="table-instructor">{{ course.instructor_name }}</span>
- {% endif %}
- {% if couse.instructor.name %}
- •
- <span class="table-instructor">{{ course.instructor.name }}</span>
- {% endif %}
- </div>
- </td>
+ {% if couse.instructor.name %}
+ •
+ <span class="table-instructor">{{ course.instructor.name }}</span>
+ {% endif %}
+ </div>
- <td class="small-12 columns">
- <div class="table-entry-second-line">
- <span class="table-course-name"><a href="{{ course.get_absolute_url }}">{{ course.name }}</a></span>
- </div>
- </td>
+ <div class="table-entry-second-line museo700">
+ <span class="table-course-name"><a href="{{ course.get_absolute_url }}">{{ course.name }}</a></span>
+ </div>
- <td class="small-12 columns">
- <div class="table-entry-third-line">
- <span class="table-note-count">{{ course.file_count }} Notes</span> •
- <span class="table-quiz-count">{{ course.quiz_count }} Quizzes </span> •
- <span class="table-thanks-count">{{ course.get_popularity }} Thanks </span> •
- <span>Updated {{ course.updated_at|date:"b d, o"|capfirst }}</span>
+ <div class="table-entry-third-line">
+ <span class="table-note-count"><i class="fa fa-file-text-o"></i> {{ course.file_count }} Notes</span>
+ <span class="table-quiz-count"><i class="fa fa-question"></i> {{ course.quiz_count }} Quizzes </span>
+ <span class="table-thanks-count"><i class="fa fa-thumbs-up"></i> {{ course.get_popularity }} Thanks </span>
+ <span>Updated {{ course.updated_at|date:"b d, o"|capfirst }}</span>
+ </div>
</div>
+
</td>
</tr>
</div>
- <div id="main-header">
+ <div id="main-header" class="museo300">
<div class="row">
<div id="logo-container" class="small-12 large-4 columns">
<div style="display: inline;">
{% endif %}
</div>
- <aside class="left-off-canvas-menu mobile-nav-list">
- <ul>
- <li>Courses</li>
- <li>My Courses</li>
- <li>My Notes</li>
- <li>My Quizzes</li>
- </ul>
- </aside>
-
</div>
</div>
</header><!--/global header-->
+
+<aside class="left-off-canvas-menu mobile-nav-list museo700">
+ <ul>
+ <li><div class="mobile-nav-item">Courses</div></li>
+ <li><div class="mobile-nav-item">My Courses</div></li>
+ <li><div class="mobile-nav-item">My Notes</div></li>
+ <li><div class="mobile-nav-item">My Quizzes</div></li>
+ <li><div class="mobile-nav-item"><a href="{% url 'control_panel' %}">My Account</a></div></li>
+ <li><div class="mobile-nav-item"><a href="{% url 'account_logout' %}">Log Out</a></div></li>
+ </ul>
+</aside>
<tr>
- <td class="no-display"><!-- this spot solely for the Sort By header --></td>
- <td class="small-8 columns large-4 slim">{{ note.uploaded_at|date:"l M d o"|capfirst }}</td>
- <td class="small-4 columns large-2 large-offset-2 slim">{{ note.thanks }}</td>
+ <td class="hide">{{ note.uploaded_at|date:"U" }}</td>
+ <td class="hide">{{ note.thanks|stringformat:"010g" }}</td>
- <td class="small-12 large-5 columns">
- <a href="{{ note.get_absolute_url }}">{{ note.name }}</a>
- </td>
-
- <td class="twelve columns">
- {% if note.tags.count > 0 %}
- <span class="activity_details_context">Tags:
- {% for tag in note.tags.all %}
- {{ tag.name }}{% if not forloop.last %}, {% endif %}
- {% endfor %}
- </span>
- {% endif %}
- </td>
-
- <td class="twelve columns note_preview">
- {% if note_preview %}
- {{ note_preview|safe }}
- {% elif note.text|length <= 500 %}
- {{ note.text }}
- {% else %}
- {{ note.text|slice:":500" }} …
- {% endif %}
- <hr class="midrule"></hr>
+ <td>
+ <div class="data-table-entry">
+ <div class="note-date adelle-sans">{{ note.uploaded_at|date:"l, F j, Y" }}</div>
+ <div class="note-name-line">
+ <span class="table-course-name museo700">
+ <a href="{{ note.get_absolute_url }}">
+ {{ note.name }}</a>
+ </span>
+ <span class="note-thanks"><i class="fa fa-thumbs-up"></i> {{ note.thanks }} thanks</span>
+ </div>
+ <div class="note-text">{{ note.text|slice:":500" }} …</div>
+ <div class="note-tags">
+ {% if note.tags.count > 0 %}
+ <span class="activity_details_context"><strong>Tags:</strong>
+ {% for tag in note.tags.all %}
+ {{ tag.name }}{% if not forloop.last %}, {% endif %}
+ {% endfor %}
+ </span>
+ {% endif %}
+ </div>
+ </div>
</td>
</tr>