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
OpenEdx
edx-platform
Commits
607b99de
Commit
607b99de
authored
Oct 12, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make separate links for lms_preview and lms as needed
parent
d10f56dd
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
20 deletions
+25
-20
cms/djangoapps/contentstore/utils.py
+4
-4
cms/djangoapps/contentstore/views.py
+6
-4
cms/envs/dev.py
+1
-1
cms/static/sass/_unit.scss
+10
-9
cms/templates/edit_subsection.html
+2
-1
cms/templates/unit.html
+1
-0
cms/templates/widgets/header.html
+1
-1
No files found.
cms/djangoapps/contentstore/utils.py
View file @
607b99de
from
django.conf
import
settings
from
django.conf
import
settings
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.draft
import
DRAFT
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
...
@@ -35,13 +34,14 @@ def get_course_location_for_item(location):
...
@@ -35,13 +34,14 @@ def get_course_location_for_item(location):
return
location
return
location
def
get_lms_link_for_item
(
location
):
def
get_lms_link_for_item
(
location
,
preview
=
False
):
location
=
Location
(
location
)
location
=
Location
(
location
)
if
settings
.
LMS_BASE
is
not
None
:
if
settings
.
LMS_BASE
is
not
None
:
lms_link
=
"{lms_base}/courses/{course_id}/jump_to/{location}"
.
format
(
lms_link
=
"//{preview}{lms_base}/courses/{course_id}/jump_to/{location}"
.
format
(
preview
=
'preview.'
if
preview
else
''
,
lms_base
=
settings
.
LMS_BASE
,
lms_base
=
settings
.
LMS_BASE
,
# TODO: These will need to be changed to point to the particular instance of this problem in the particular course
# TODO: These will need to be changed to point to the particular instance of this problem in the particular course
course_id
=
modulestore
()
.
get_containing_courses
(
location
)[
0
]
.
id
,
course_id
=
modulestore
()
.
get_containing_courses
(
location
)[
0
]
.
id
,
location
=
location
,
location
=
location
,
)
)
else
:
else
:
...
...
cms/djangoapps/contentstore/views.py
View file @
607b99de
...
@@ -188,6 +188,7 @@ def edit_subsection(request, location):
...
@@ -188,6 +188,7 @@ def edit_subsection(request, location):
break
break
lms_link
=
get_lms_link_for_item
(
location
)
lms_link
=
get_lms_link_for_item
(
location
)
preview_link
=
get_lms_link_for_item
(
location
,
preview
=
True
)
# make sure that location references a 'sequential', otherwise return BadRequest
# make sure that location references a 'sequential', otherwise return BadRequest
if
item
.
location
.
category
!=
'sequential'
:
if
item
.
location
.
category
!=
'sequential'
:
...
@@ -214,7 +215,8 @@ def edit_subsection(request, location):
...
@@ -214,7 +215,8 @@ def edit_subsection(request, location):
'context_course'
:
course
,
'context_course'
:
course
,
'create_new_unit_template'
:
Location
(
'i4x'
,
'edx'
,
'templates'
,
'vertical'
,
'Empty'
),
'create_new_unit_template'
:
Location
(
'i4x'
,
'edx'
,
'templates'
,
'vertical'
,
'Empty'
),
'lms_link'
:
lms_link
,
'lms_link'
:
lms_link
,
'parent_item'
:
parent
,
'preview_link'
:
preview_link
,
'parent_item'
:
parent
,
'policy_metadata'
:
policy_metadata
'policy_metadata'
:
policy_metadata
})
})
...
@@ -240,8 +242,8 @@ def edit_unit(request, location):
...
@@ -240,8 +242,8 @@ def edit_unit(request, location):
course
.
location
.
course
==
item
.
location
.
course
):
course
.
location
.
course
==
item
.
location
.
course
):
break
break
# The non-draft location
lms_link
=
get_lms_link_for_item
(
item
.
location
)
lms_link
=
get_lms_link_for_item
(
item
.
location
.
_replace
(
revision
=
None
)
)
preview_lms_link
=
get_lms_link_for_item
(
item
.
location
,
preview
=
True
)
component_templates
=
defaultdict
(
list
)
component_templates
=
defaultdict
(
list
)
...
@@ -282,7 +284,7 @@ def edit_unit(request, location):
...
@@ -282,7 +284,7 @@ def edit_unit(request, location):
'unit_location'
:
location
,
'unit_location'
:
location
,
'components'
:
components
,
'components'
:
components
,
'component_templates'
:
component_templates
,
'component_templates'
:
component_templates
,
'draft_preview_link'
:
lms_link
,
'draft_preview_link'
:
preview_
lms_link
,
'published_preview_link'
:
lms_link
,
'published_preview_link'
:
lms_link
,
'subsection'
:
containing_subsection
,
'subsection'
:
containing_subsection
,
'section'
:
containing_section
,
'section'
:
containing_section
,
...
...
cms/envs/dev.py
View file @
607b99de
...
@@ -53,7 +53,7 @@ DATABASES = {
...
@@ -53,7 +53,7 @@ DATABASES = {
}
}
}
}
LMS_BASE
=
"
http://
localhost:8000"
LMS_BASE
=
"localhost:8000"
REPOS
=
{
REPOS
=
{
'edx4edx'
:
{
'edx4edx'
:
{
...
...
cms/static/sass/_unit.scss
View file @
607b99de
...
@@ -310,7 +310,7 @@
...
@@ -310,7 +310,7 @@
}
}
}
}
.preview-button
{
.preview-button
,
.view-button
{
@include
white-button
;
@include
white-button
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
...
@@ -325,7 +325,8 @@
...
@@ -325,7 +325,8 @@
.save-button
,
.save-button
,
.preview-button
,
.preview-button
,
.publish-button
{
.publish-button
,
.view-button
{
font-size
:
11px
;
font-size
:
11px
;
margin-top
:
10px
;
margin-top
:
10px
;
padding
:
6px
15px
8px
;
padding
:
6px
15px
8px
;
...
@@ -427,17 +428,15 @@
...
@@ -427,17 +428,15 @@
}
}
.edit-state-draft
{
.edit-state-draft
{
.visibility
{
.visibility
,
.edit-draft-message
,
.view-button
{
display
:
none
;
display
:
none
;
}
}
.published-alert
{
.published-alert
{
display
:
block
;
display
:
block
;
}
}
.edit-draft-message
{
display
:
none
;
}
}
}
.edit-state-public
{
.edit-state-public
{
...
@@ -446,7 +445,8 @@
...
@@ -446,7 +445,8 @@
.component-actions
,
.component-actions
,
.new-component-item
,
.new-component-item
,
#published-alert
,
#published-alert
,
.publish-draft-message
{
.publish-draft-message
,
.preview-button
{
display
:
none
;
display
:
none
;
}
}
...
@@ -463,7 +463,8 @@
...
@@ -463,7 +463,8 @@
#delete-draft
,
#delete-draft
,
#publish-draft
,
#publish-draft
,
#published-alert
,
#published-alert
,
#create-draft
,
{
#create-draft
,
.view-button
{
display
:
none
;
display
:
none
;
}
}
}
}
cms/templates/edit_subsection.html
View file @
607b99de
...
@@ -89,7 +89,8 @@
...
@@ -89,7 +89,8 @@
</div>
</div>
<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=
"${lms_link}"
target=
"_blank"
class=
"preview-button"
>
Preview
</a>
<a
href=
"${preview_link}"
target=
"_blank"
class=
"preview-button"
>
Preview Drafts
</a>
<a
href=
"${lms_link}"
target=
"_blank"
class=
"preview-button"
>
View Live
</a>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
cms/templates/unit.html
View file @
607b99de
...
@@ -91,6 +91,7 @@
...
@@ -91,6 +91,7 @@
<a
id=
"save-draft"
href=
"#"
class=
"save-button"
>
Save Draft
</a>
<a
id=
"save-draft"
href=
"#"
class=
"save-button"
>
Save Draft
</a>
<a
id=
"delete-draft"
href=
"#"
class=
"save-button"
>
Delete Draft
</a>
<a
id=
"delete-draft"
href=
"#"
class=
"save-button"
>
Delete Draft
</a>
<a
href=
"${draft_preview_link}"
target=
"_blank"
class=
"preview-button"
>
Preview
</a>
<a
href=
"${draft_preview_link}"
target=
"_blank"
class=
"preview-button"
>
Preview
</a>
<a
href=
"${published_preview_link}"
target=
"_blank"
class=
"view-button"
>
View Live
</a>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
cms/templates/widgets/header.html
View file @
607b99de
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<li><a
href=
"${reverse('static_pages', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, coursename=ctx_loc.name))}"
id=
'pages-tab'
>
Pages
</a></li>
<li><a
href=
"${reverse('static_pages', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, coursename=ctx_loc.name))}"
id=
'pages-tab'
>
Pages
</a></li>
<li><a
href=
"${reverse('asset_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}"
id=
'assets-tab'
>
Assets
</a></li>
<li><a
href=
"${reverse('asset_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}"
id=
'assets-tab'
>
Assets
</a></li>
<li><a
href=
"${reverse('manage_users', kwargs=dict(location=ctx_loc))}"
id=
'users-tab'
>
Users
</a></li>
<li><a
href=
"${reverse('manage_users', kwargs=dict(location=ctx_loc))}"
id=
'users-tab'
>
Users
</a></li>
<li><a
href=
"${reverse('import_course', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}"
id=
'import-tab'
class=
"wip-box"
>
Import
</a></li>
<li><a
href=
"${reverse('import_course', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}"
id=
'import-tab'
>
Import
</a></li>
</ul>
</ul>
% endif
% endif
</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