Commit b24fdd9e by chrisndodge

Merge pull request #576 from edx/feature/cdodge/display-location-information-in-course-listings

Feature/cdodge/display location information in course listings
parents 4d5727a2 22d33db5
...@@ -1141,7 +1141,7 @@ class ContentStoreTest(ModuleStoreTestCase): ...@@ -1141,7 +1141,7 @@ class ContentStoreTest(ModuleStoreTestCase):
resp = self.client.get(reverse('index')) resp = self.client.get(reverse('index'))
self.assertContains( self.assertContains(
resp, resp,
'<span class="class-name">Robot Super Educational Course</span>', '<h3 class="course-title">Robot Super Educational Course</h3>',
status_code=200, status_code=200,
html=True html=True
) )
......
...@@ -54,6 +54,9 @@ def index(request): ...@@ -54,6 +54,9 @@ def index(request):
course.location, course.location,
course_id=course.location.course_id, course_id=course.location.course_id,
), ),
course.display_org_with_default,
course.display_number_with_default,
course.location.name
) )
return render_to_response('index.html', { return render_to_response('index.html', {
......
...@@ -291,7 +291,7 @@ body.dashboard { ...@@ -291,7 +291,7 @@ body.dashboard {
// ==================== // ====================
// course listings // ELEM: course listings
.courses { .courses {
margin: $baseline 0; margin: $baseline 0;
} }
...@@ -304,50 +304,94 @@ body.dashboard { ...@@ -304,50 +304,94 @@ body.dashboard {
box-shadow: 0 1px 2px $shadow-l1; box-shadow: 0 1px 2px $shadow-l1;
.course-item { .course-item {
@include box-sizing(border-box);
width: flex-grid(9, 9);
position: relative; position: relative;
border-bottom: 1px solid $gray-l1; border-bottom: 1px solid $gray-l1;
padding: $baseline;
&:last-child { // STATE: hover/focus
border-bottom: none;
}
.class-link {
z-index: 100;
display: block;
padding: 20px 25px;
line-height: 1.3;
&:hover { &:hover {
background: $paleYellow; background: $paleYellow;
+ .view-live-button { .course-actions .view-live-button {
opacity: 1.0; opacity: 1.0;
pointer-events: auto; pointer-events: auto;
} }
.course-title {
color: $orange-d1;
} }
.course-metadata {
opacity: 1.0;
} }
} }
.class-name { .course-link, .course-actions {
display: block; @include box-sizing(border-box);
font-size: 19px; display: inline-block;
vertical-align: middle;
}
// encompassing course link
.course-link {
@extend .ui-depth2;
width: flex-grid(7, 9);
margin-right: flex-gutter();
}
// course title
.course-title {
@extend .t-title4;
margin: 0 ($baseline*2) ($baseline/4) 0;
font-weight: 300; font-weight: 300;
} }
.detail { // course metadata
font-size: 14px; .course-metadata {
font-weight: 400; @extend .t-copy-sub1;
margin-right: 20px; @include transition(opacity $tmg-f1 ease-in-out 0);
color: #3c3c3c; color: $gray;
opacity: 0.75;
.metadata-item {
display: inline-block;
&:after {
content: "/";
margin-left: ($baseline/10);
margin-right: ($baseline/10);
color: $gray-l4;
}
&:last-child {
&:after {
content: "";
margin-left: 0;
margin-right: 0;
}
}
.label {
@extend .cont-text-sr;
}
}
} }
.course-actions {
@extend .ui-depth3;
position: static;
width: flex-grid(2, 9);
text-align: right;
// view live button // view live button
.view-live-button { .view-live-button {
z-index: 10000; @extend .ui-depth3;
position: absolute; @include transition(opacity $tmg-f2 ease-in-out 0);
top: ($baseline*0.75); @include box-sizing(border-box);
right: $baseline; padding: ($baseline/2);
padding: ($baseline/4) ($baseline/2);
opacity: 0.0; opacity: 0.0;
pointer-events: none; pointer-events: none;
...@@ -356,8 +400,13 @@ body.dashboard { ...@@ -356,8 +400,13 @@ body.dashboard {
pointer-events: auto; pointer-events: auto;
} }
} }
}
&:last-child {
border-bottom: none;
}
}
}
}
// ELEM: new user form // ELEM: new user form
.wrapper-create-course { .wrapper-create-course {
......
...@@ -133,13 +133,31 @@ ...@@ -133,13 +133,31 @@
%if len(courses) > 0: %if len(courses) > 0:
<div class="courses"> <div class="courses">
<ul class="list-courses"> <ul class="list-courses">
%for course, url, lms_link in sorted(courses, key=lambda s: s[0].lower() if s[0] is not None else ''): %for course, url, lms_link, org, num, run in sorted(courses, key=lambda s: s[0].lower() if s[0] is not None else ''):
<li class="course-item"> <li class="course-item">
<a class="class-link" href="${url}" class="class-name"> <a class="course-link" href="${url}">
<span class="class-name">${course}</span> <h3 class="course-title">${course}</h3>
<div class="course-metadata">
<span class="course-org metadata-item">
<span class="label">${_("Organization:")}</span> <span class="value">${org}</span>
</span>
<span class="course-num metadata-item">
<span class="label">${_("Course Number:")}</span>
<span class="value">${num}</span>
</span>
<span class="course-run metadata-item">
<span class="label">${_("Course Run:")}</span> <span class="value">${run}</span>
</span>
</div>
</a> </a>
<ul class="item-actions course-actions">
<li class="action">
<a href="${lms_link}" rel="external" class="button view-button view-live-button">${_("View Live")}</a> <a href="${lms_link}" rel="external" class="button view-button view-live-button">${_("View Live")}</a>
</li> </li>
</ul>
</li>
%endfor %endfor
</ul> </ul>
</div> </div>
......
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