Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
4a162dad
Commit
4a162dad
authored
12 years ago
by
Victor Shnayder
Browse files
Options
Downloads
Patches
Plain Diff
bugfixes for static tabs
- move courseware wiki views above catch-all rule - handle courses with no custom tabs
parent
7a88223e
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lms/djangoapps/courseware/tabs.py
+4
-2
4 additions, 2 deletions
lms/djangoapps/courseware/tabs.py
lms/djangoapps/courseware/views.py
+1
-1
1 addition, 1 deletion
lms/djangoapps/courseware/views.py
lms/urls.py
+27
-23
27 additions, 23 deletions
lms/urls.py
with
32 additions
and
26 deletions
lms/djangoapps/courseware/tabs.py
+
4
−
2
View file @
4a162dad
...
...
@@ -235,12 +235,14 @@ def get_default_tabs(user, course, active_page):
return
tabs
def
get_static_tab_by_slug
(
tabs
,
tab_slug
):
def
get_static_tab_by_slug
(
course
,
tab_slug
):
"""
Look for a tab with type
'
static_tab
'
and the specified
'
tab_slug
'
. Returns
the tab (a config dict), or None if not found.
"""
for
tab
in
tabs
:
if
course
.
tabs
is
None
:
return
None
for
tab
in
course
.
tabs
:
# if the tab is misconfigured, this will blow up. The validation code should check...
if
tab
[
'
type
'
]
==
'
static_tab
'
and
tab
[
'
url_slug
'
]
==
tab_slug
:
return
tab
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/courseware/views.py
+
1
−
1
View file @
4a162dad
...
...
@@ -353,7 +353,7 @@ def static_tab(request, course_id, tab_slug):
"""
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'
load
'
)
tab
=
tabs
.
get_static_tab_by_slug
(
course
.
tabs
,
tab_slug
)
tab
=
tabs
.
get_static_tab_by_slug
(
course
,
tab_slug
)
if
tab
is
None
:
raise
Http404
...
...
This diff is collapsed.
Click to expand it.
lms/urls.py
+
27
−
23
View file @
4a162dad
...
...
@@ -97,6 +97,33 @@ urlpatterns = ('',
if
settings
.
PERFSTATS
:
urlpatterns
+=
(
url
(
r
'
^reprofile$
'
,
'
perfstats.views.end_profile
'
),)
# Multicourse wiki (Note: wiki urls must be above the courseware ones because of
# the custom tab catch-all)
if
settings
.
WIKI_ENABLED
:
from
wiki.urls
import
get_pattern
as
wiki_pattern
from
django_notify.urls
import
get_pattern
as
notify_pattern
# Note that some of these urls are repeated in course_wiki.course_nav. Make sure to update
# them together.
urlpatterns
+=
(
# First we include views from course_wiki that we use to override the default views.
# They come first in the urlpatterns so they get resolved first
url
(
'
^wiki/create-root/$
'
,
'
course_wiki.views.root_create
'
,
name
=
'
root_create
'
),
url
(
r
'
^wiki/
'
,
include
(
wiki_pattern
())),
url
(
r
'
^notify/
'
,
include
(
notify_pattern
())),
# These urls are for viewing the wiki in the context of a course. They should
# never be returned by a reverse() so they come after the other url patterns
url
(
r
'
^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/course_wiki/?$
'
,
'
course_wiki.views.course_wiki_redirect
'
,
name
=
"
course_wiki
"
),
url
(
r
'
^courses/(?:[^/]+/[^/]+/[^/]+)/wiki/
'
,
include
(
wiki_pattern
())),
)
if
settings
.
COURSEWARE_ENABLED
:
urlpatterns
+=
(
# Hook django-masquerade, allowing staff to view site as other users
...
...
@@ -180,29 +207,6 @@ if settings.COURSEWARE_ENABLED:
include
(
'
django_comment_client.urls
'
))
)
# Multicourse wiki
if
settings
.
WIKI_ENABLED
:
from
wiki.urls
import
get_pattern
as
wiki_pattern
from
django_notify.urls
import
get_pattern
as
notify_pattern
# Note that some of these urls are repeated in course_wiki.course_nav. Make sure to update
# them together.
urlpatterns
+=
(
# First we include views from course_wiki that we use to override the default views.
# They come first in the urlpatterns so they get resolved first
url
(
'
^wiki/create-root/$
'
,
'
course_wiki.views.root_create
'
,
name
=
'
root_create
'
),
url
(
r
'
^wiki/
'
,
include
(
wiki_pattern
())),
url
(
r
'
^notify/
'
,
include
(
notify_pattern
())),
# These urls are for viewing the wiki in the context of a course. They should
# never be returned by a reverse() so they come after the other url patterns
url
(
r
'
^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/course_wiki/?$
'
,
'
course_wiki.views.course_wiki_redirect
'
,
name
=
"
course_wiki
"
),
url
(
r
'
^courses/(?:[^/]+/[^/]+/[^/]+)/wiki/
'
,
include
(
wiki_pattern
())),
)
if
settings
.
QUICKEDIT
:
urlpatterns
+=
(
url
(
r
'
^quickedit/(?P<id>[^/]*)$
'
,
'
dogfood.views.quickedit
'
),)
urlpatterns
+=
(
url
(
r
'
^dogfood/(?P<id>[^/]*)$
'
,
'
dogfood.views.df_capa_problem
'
),)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment