Commit 91ce2149 by cahrens

Fix for Studio #96.

parent 90ce6967
...@@ -73,20 +73,38 @@ def get_course_for_item(location): ...@@ -73,20 +73,38 @@ def get_course_for_item(location):
def get_lms_link_for_item(location, preview=False): def get_lms_link_for_item(location, preview=False):
location = Location(location)
if settings.LMS_BASE is not None: if settings.LMS_BASE is not None:
lms_link = "//{preview}{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 '', 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 course_id=get_course_id(location),
course_id=modulestore().get_containing_courses(location)[0].id, location=Location(location)
location=location,
) )
else: else:
lms_link = None lms_link = None
return lms_link return lms_link
def get_lms_link_for_about_page(location):
"""
Returns the url to the course about page from the location tuple.
"""
if settings.LMS_BASE is not None:
lms_link = "//{lms_base}/courses/{course_id}/about".format(
lms_base=settings.LMS_BASE,
course_id=get_course_id(location)
)
else:
lms_link = None
return lms_link
def get_course_id(location):
"""
Returns the course_id from a given the location tuple.
"""
# TODO: These will need to be changed to point to the particular instance of this problem in the particular course
return modulestore().get_containing_courses(Location(location))[0].id
class UnitState(object): class UnitState(object):
draft = 'draft' draft = 'draft'
......
...@@ -77,6 +77,8 @@ DATABASES = { ...@@ -77,6 +77,8 @@ DATABASES = {
} }
} }
LMS_BASE = "localhost:8000"
CACHES = { CACHES = {
# This is the cache used for most things. Askbot will not work without a # This is the cache used for most things. Askbot will not work without a
# functioning cache -- it relies on caching to load its settings in places. # functioning cache -- it relies on caching to load its settings in places.
......
...@@ -73,7 +73,7 @@ from contentstore import utils ...@@ -73,7 +73,7 @@ from contentstore import utils
<div class="field"> <div class="field">
<div class="input"> <div class="input">
<input type="text" class="long" id="course-name" value="[Course Name]" disabled="disabled"> <input type="text" class="long" id="course-name" value="[Course Name]" disabled="disabled">
<span class="tip tip-stacked">This is used in <a href="${utils.get_lms_link_for_item(context_course.location, True)}">your course URL</a>, and cannot be changed</span> <span class="tip tip-stacked">This is used in <a href="${utils.get_lms_link_for_about_page(context_course.location)}">your course URL</a>, and cannot be changed</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -83,7 +83,7 @@ from contentstore import utils ...@@ -83,7 +83,7 @@ from contentstore import utils
<div class="field"> <div class="field">
<div class="input"> <div class="input">
<input type="text" class="long" id="course-organization" value="[Course Organization]" disabled="disabled"> <input type="text" class="long" id="course-organization" value="[Course Organization]" disabled="disabled">
<span class="tip tip-stacked">This is used in <a href="${utils.get_lms_link_for_item(context_course.location, True)}">your course URL</a>, and cannot be changed</span> <span class="tip tip-stacked">This is used in <a href="${utils.get_lms_link_for_about_page(context_course.location)}">your course URL</a>, and cannot be changed</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -93,7 +93,7 @@ from contentstore import utils ...@@ -93,7 +93,7 @@ from contentstore import utils
<div class="field"> <div class="field">
<div class="input"> <div class="input">
<input type="text" class="short" id="course-number" value="[Course No.]" disabled="disabled"> <input type="text" class="short" id="course-number" value="[Course No.]" disabled="disabled">
<span class="tip tip-stacked">This is used in <a href="${utils.get_lms_link_for_item(context_course.location, True)}">your course URL</a>, and cannot be changed</span> <span class="tip tip-stacked">This is used in <a href="${utils.get_lms_link_for_about_page(context_course.location)}">your course URL</a>, and cannot be changed</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -213,7 +213,7 @@ from contentstore import utils ...@@ -213,7 +213,7 @@ from contentstore import utils
<div class="field"> <div class="field">
<div class="input"> <div class="input">
<textarea class="long tall tinymce text-editor" id="course-overview"></textarea> <textarea class="long tall tinymce text-editor" id="course-overview"></textarea>
<span class="tip tip-stacked">Introductions, prerequisites, FAQs that are used on <a href="${utils.get_lms_link_for_item(context_course.location, True)}">your course summary page</a></span> <span class="tip tip-stacked">Introductions, prerequisites, FAQs that are used on <a href="${utils.get_lms_link_for_about_page(context_course.location)}">your course summary page</a></span>
</div> </div>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment