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
a88bb7ca
Commit
a88bb7ca
authored
Oct 17, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hide 'View Live' button if no units have been published
parent
6011d6d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
cms/djangoapps/contentstore/views.py
+10
-2
cms/templates/edit_subsection.html
+2
-0
No files found.
cms/djangoapps/contentstore/views.py
View file @
a88bb7ca
...
@@ -55,7 +55,7 @@ from cache_toolbox.core import set_cached_content, get_cached_content, del_cache
...
@@ -55,7 +55,7 @@ from cache_toolbox.core import set_cached_content, get_cached_content, del_cache
from
auth.authz
import
is_user_in_course_group_role
,
get_users_in_course_group_by_role
from
auth.authz
import
is_user_in_course_group_role
,
get_users_in_course_group_by_role
from
auth.authz
import
get_user_by_email
,
add_user_to_course_group
,
remove_user_from_course_group
from
auth.authz
import
get_user_by_email
,
add_user_to_course_group
,
remove_user_from_course_group
from
auth.authz
import
INSTRUCTOR_ROLE_NAME
,
STAFF_ROLE_NAME
,
create_all_course_groups
from
auth.authz
import
INSTRUCTOR_ROLE_NAME
,
STAFF_ROLE_NAME
,
create_all_course_groups
from
.utils
import
get_course_location_for_item
,
get_lms_link_for_item
,
compute_unit_state
,
get_date_display
from
.utils
import
get_course_location_for_item
,
get_lms_link_for_item
,
compute_unit_state
,
get_date_display
,
UnitState
from
xmodule.templates
import
all_templates
from
xmodule.templates
import
all_templates
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.xml_importer
import
import_from_xml
...
@@ -214,6 +214,13 @@ def edit_subsection(request, location):
...
@@ -214,6 +214,13 @@ def edit_subsection(request, location):
policy_metadata
=
dict
((
key
,
value
)
for
key
,
value
in
item
.
metadata
.
iteritems
()
policy_metadata
=
dict
((
key
,
value
)
for
key
,
value
in
item
.
metadata
.
iteritems
()
if
key
not
in
[
'display_name'
,
'start'
,
'due'
,
'format'
]
and
key
not
in
item
.
system_metadata_fields
)
if
key
not
in
[
'display_name'
,
'start'
,
'due'
,
'format'
]
and
key
not
in
item
.
system_metadata_fields
)
can_view_live
=
False
for
unit
in
item
.
get_children
():
state
=
compute_unit_state
(
unit
)
if
state
==
UnitState
.
public
or
state
==
UnitState
.
draft
:
can_view_live
=
True
break
return
render_to_response
(
'edit_subsection.html'
,
return
render_to_response
(
'edit_subsection.html'
,
{
'subsection'
:
item
,
{
'subsection'
:
item
,
'context_course'
:
course
,
'context_course'
:
course
,
...
@@ -221,7 +228,8 @@ def edit_subsection(request, location):
...
@@ -221,7 +228,8 @@ def edit_subsection(request, location):
'lms_link'
:
lms_link
,
'lms_link'
:
lms_link
,
'preview_link'
:
preview_link
,
'preview_link'
:
preview_link
,
'parent_item'
:
parent
,
'parent_item'
:
parent
,
'policy_metadata'
:
policy_metadata
'policy_metadata'
:
policy_metadata
,
'can_view_live'
:
can_view_live
})
})
...
...
cms/templates/edit_subsection.html
View file @
a88bb7ca
...
@@ -95,7 +95,9 @@
...
@@ -95,7 +95,9 @@
<div
class=
"row unit-actions"
>
<div
class=
"row unit-actions"
>
<a
href=
"#"
class=
"save-button save-subsection"
data-id=
"${subsection.location}"
>
Save
</a>
<a
href=
"#"
class=
"save-button save-subsection"
data-id=
"${subsection.location}"
>
Save
</a>
<a
href=
"${preview_link}"
target=
"_blank"
class=
"preview-button"
>
Preview Drafts
</a>
<a
href=
"${preview_link}"
target=
"_blank"
class=
"preview-button"
>
Preview Drafts
</a>
%if can_view_live:
<a
href=
"${lms_link}"
target=
"_blank"
class=
"preview-button"
>
View Live
</a>
<a
href=
"${lms_link}"
target=
"_blank"
class=
"preview-button"
>
View Live
</a>
%endif
</div>
</div>
</div>
</div>
</div>
</div>
...
...
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