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
d532f8de
Commit
d532f8de
authored
Dec 26, 2015
by
Dmitry Viskov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render LMS main navigation (tabs) with template, override templates for a specific list item
parent
57af11c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
25 deletions
+88
-25
common/test/test_microsites/test_microsite/templates/courseware/tabs.html
+33
-0
lms/djangoapps/courseware/tests/test_microsites.py
+15
-0
lms/templates/courseware/course_navigation.html
+7
-25
lms/templates/courseware/tabs.html
+33
-0
No files found.
common/test/test_microsites/test_microsite/templates/courseware/tabs.html
0 → 100644
View file @
d532f8de
## mako
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%
page
args=
"tab_list, active_page, default_tab, tab_image"
/>
<
%
def
url_class
(
is_active
)
:
if
is_active:
return
"
active
"
return
""
%
>
% for tab in tab_list:
<
%
tab_is_active =
tab.tab_id
in
(
active_page
,
default_tab
)
tab_class =
url_class(tab_is_active)
%
>
<li>
<a
href=
"${tab.link_func(course, reverse) | h}"
class=
"${tab_class}"
>
Test Microsite Tab: ${_(tab.name) | h}
% if tab_is_active:
<span
class=
"sr"
>
, current location
</span>
%endif
% if tab_image:
## Translators: 'needs attention' is an alternative string for the
## notification image that indicates the tab "needs attention".
<img
src=
"${tab_image}"
alt=
"${_('needs attention')}"
/>
%endif
</a>
</li>
% endfor
lms/djangoapps/courseware/tests/test_microsites.py
View file @
d532f8de
...
...
@@ -209,6 +209,21 @@ class TestMicrosites(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
assertNotContains
(
resp
,
'Robot_Super_Course'
)
self
.
assertContains
(
resp
,
'Robot_Course_Outside_Microsite'
)
def
test_microsite_course_custom_tabs
(
self
):
"""
Enroll user in a course scoped in a Microsite and make sure that
template with tabs is overridden
"""
self
.
setup_users
()
email
,
password
=
self
.
STUDENT_INFO
[
1
]
self
.
login
(
email
,
password
)
self
.
enroll
(
self
.
course
,
True
)
resp
=
self
.
client
.
get
(
reverse
(
'courseware'
,
args
=
[
unicode
(
self
.
course
.
id
)]),
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
)
self
.
assertContains
(
resp
,
'Test Microsite Tab:'
)
@override_settings
(
SITE_NAME
=
settings
.
MICROSITE_TEST_HOSTNAME
)
def
test_visible_about_page_settings
(
self
):
"""
...
...
lms/templates/courseware/course_navigation.html
View file @
d532f8de
...
...
@@ -15,11 +15,6 @@ if active_page is None and active_page_context is not UNDEFINED:
#
If
active_page
is
not
passed
in
as
an
argument
,
it
may
be
in
the
context
as
active_page_context
active_page =
active_page_context
def
url_class
(
is_active
)
:
if
is_active:
return
"
active
"
return
""
def
selected
(
is_selected
)
:
return
"
selected
"
if
is_selected
else
""
...
...
@@ -83,27 +78,14 @@ include_special_exams = settings.FEATURES.get('ENABLE_SPECIAL_EXAMS', False) and
% if disable_tabs is UNDEFINED or not disable_tabs:
<nav
class=
"${active_page} wrapper-course-material"
aria-label=
"${_('Course Material')}"
>
<div
class=
"course-material"
>
<ol
class=
"course-tabs"
>
% for tab in get_course_tab_list(request, course):
<
%
tab_is_active =
(tab.tab_id
==
active_page
)
or
(
tab
.
tab_id =
=
default_tab
)
%
>
<li>
<a
href=
"${tab.link_func(course, reverse) | h}"
class=
"${url_class(tab_is_active)}"
>
${_(tab.name) | h}
% if tab_is_active:
<span
class=
"sr"
>
, current location
</span>
%endif
% if tab_image:
## Translators: 'needs attention' is an alternative string for the
## notification image that indicates the tab "needs attention".
<img
src=
"${tab_image}"
alt=
"${_('needs attention')}"
/>
%endif
</a>
</li>
% endfor
<
%
tab_list =
get_course_tab_list(request,
course
)
tabs_tmpl =
static.get_template_path('/courseware/tabs.html')
%
>
<ol
class=
"course-tabs"
>
<
%
include
file=
"${tabs_tmpl}"
args=
"tab_list=tab_list,active_page=active_page,default_tab=default_tab,tab_image=tab_image"
/>
<
%
block
name=
"extratabs"
/>
</ol>
</ol>
</div>
</nav>
%endif
...
...
lms/templates/courseware/tabs.html
0 → 100644
View file @
d532f8de
## mako
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%
page
args=
"tab_list, active_page, default_tab, tab_image"
/>
<
%
def
url_class
(
is_active
)
:
if
is_active:
return
"
active
"
return
""
%
>
% for tab in tab_list:
<
%
tab_is_active =
tab.tab_id
in
(
active_page
,
default_tab
)
tab_class =
url_class(tab_is_active)
%
>
<li>
<a
href=
"${tab.link_func(course, reverse) | h}"
class=
"${tab_class}"
>
${_(tab.name) | h}
% if tab_is_active:
<span
class=
"sr"
>
, current location
</span>
%endif
% if tab_image:
## Translators: 'needs attention' is an alternative string for the
## notification image that indicates the tab "needs attention".
<img
src=
"${tab_image}"
alt=
"${_('needs attention')}"
/>
%endif
</a>
</li>
% endfor
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