Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
61fea82d
Commit
61fea82d
authored
Jul 18, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #214 from MITx/mm-course-columns
Display courses in university related columns.
parents
48ff2c9c
a64ddc77
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
14 deletions
+39
-14
common/djangoapps/student/views.py
+13
-5
lms/static/sass/shared/_course_object.scss
+11
-6
lms/templates/index.html
+15
-3
No files found.
common/djangoapps/student/views.py
View file @
61fea82d
...
...
@@ -7,6 +7,7 @@ import sys
import
uuid
import
feedparser
import
urllib
import
itertools
from
django.conf
import
settings
from
django.contrib.auth
import
logout
,
authenticate
,
login
...
...
@@ -49,8 +50,13 @@ def csrf_token(context):
@ensure_csrf_cookie
@cache_if_anonymous
def
index
(
request
):
''' Redirects to main page -- info page if user authenticated, or marketing if not
'''
if
settings
.
COURSEWARE_ENABLED
and
request
.
user
.
is_authenticated
():
return
redirect
(
reverse
(
'dashboard'
))
feed_data
=
cache
.
get
(
"students_index_rss_feed_data"
)
if
feed_data
==
None
:
if
hasattr
(
settings
,
'RSS_URL'
):
...
...
@@ -65,11 +71,13 @@ def index(request):
soup
=
BeautifulSoup
(
entry
.
description
)
entry
.
image
=
soup
.
img
[
'src'
]
if
soup
.
img
else
None
if
settings
.
COURSEWARE_ENABLED
and
request
.
user
.
is_authenticated
():
return
redirect
(
reverse
(
'dashboard'
))
else
:
# TODO: Clean up how 'error' is done.
return
render_to_response
(
'index.html'
,
{
'courses'
:
modulestore
()
.
get_courses
(),
'entries'
:
entries
})
courses
=
modulestore
()
.
get_courses
()
universities
=
dict
()
for
university
,
group
in
itertools
.
groupby
(
courses
,
lambda
course
:
course
.
org
):
universities
.
setdefault
(
university
,
[])
[
universities
[
university
]
.
append
(
course
)
for
course
in
group
]
return
render_to_response
(
'index.html'
,
{
'universities'
:
universities
,
'entries'
:
entries
})
@login_required
...
...
lms/static/sass/shared/_course_object.scss
View file @
61fea82d
...
...
@@ -3,22 +3,27 @@
@include
clearfix
;
padding
:
40px
0px
15px
;
.university-column
{
width
:
flex-grid
(
4
);
margin-right
:
flex-gutter
();
float
:
left
;
&
:nth-child
(
3n
+
3
)
{
margin-right
:
0
;
}
}
.course
{
background
:
rgb
(
250
,
250
,
250
);
border
:
1px
solid
rgb
(
180
,
180
,
180
);
@include
border-radius
(
2px
);
@include
box-sizing
(
border-box
);
@include
box-shadow
(
0
1px
10px
0
rgba
(
0
,
0
,
0
,
0
.15
)
,
inset
0
0
0
1px
rgba
(
255
,
255
,
255
,
0
.9
));
float
:
left
;
margin-right
:
flex-gutter
();
margin-bottom
:
30px
;
position
:
relative
;
width
:
flex-grid
(
4
)
;
width
:
100%
;
@include
transition
(
all
,
0
.15s
,
linear
);
&
:nth-child
(
3n
+
3
)
{
margin-right
:
0
;
}
.meta-info
{
background
:
rgba
(
0
,
0
,
0
,
0
.6
);
...
...
lms/templates/index.html
View file @
61fea82d
...
...
@@ -78,9 +78,21 @@
</section>
<section
class=
"courses"
>
%for course in courses:
<
%
include
file=
"course.html"
args=
"course=course"
/>
%endfor
<section
class=
'university-column'
>
%for course in universities['MITx']:
<
%
include
file=
"course.html"
args=
"course=course"
/>
%endfor
</section>
<section
class=
'university-column'
>
%for course in universities['HarvardX']:
<
%
include
file=
"course.html"
args=
"course=course"
/>
%endfor
</section>
<section
class=
'university-column'
>
%for course in universities['BerkeleyX']:
<
%
include
file=
"course.html"
args=
"course=course"
/>
%endfor
</section>
</section>
</section>
</section>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment