Skip to content
Snippets Groups Projects
Commit 8f72394e authored by Calen Pennington's avatar Calen Pennington
Browse files

Merge remote-tracking branch 'edx/master' into opaque-keys-merge-master

Conflicts:
	cms/templates/widgets/header.html
parents ba7abf42 6c7ca7ae
No related merge requests found
Showing
with 200 additions and 30 deletions
import ConfigParser
from django.conf import settings
import logging
log = logging.getLogger(__name__)
# Open and parse the configuration file when the module is initialized
config_file = open(settings.REPO_ROOT / "docs" / "config.ini")
config = ConfigParser.ConfigParser()
config.readfp(config_file)
def doc_url(request):
# in the future, we will detect the locale; for now, we will
# hardcode en_us, since we only have English documentation
locale = "en_us"
def doc_url(request=None): # pylint: disable=unused-argument
"""
This function is added in the list of TEMPLATE_CONTEXT_PROCESSORS, which is a django setting for
a tuple of callables that take a request object as their argument and return a dictionary of items
to be merged into the RequestContext.
This function returns a dict with get_online_help_info, making it directly available to all mako templates.
Args:
request: Currently not used, but is passed by django to context processors.
May be used in the future for determining the language of choice.
"""
def get_online_help_info(page_token=None):
"""
Args:
page_token: A string that identifies the page for which the help information is requested.
It should correspond to an option in the docs/config.ini file. If it doesn't, the "default"
option is used instead.
Returns:
A dict mapping the following items
* "doc_url" - a string with the url corresponding to the online help location for the given page_token.
* "pdf_url" - a string with the url corresponding to the location of the PDF help file.
"""
def get_config_value_with_default(section_name, option, default_option="default"):
"""
Args:
section_name: name of the section in the configuration from which the option should be found
option: name of the configuration option
default_option: name of the default configuration option whose value should be returned if the
requested option is not found
"""
try:
return config.get(section_name, option)
except (ConfigParser.NoOptionError, AttributeError):
log.debug("Didn't find a configuration option for '%s' section and '%s' option", section_name, option)
return config.get(section_name, default_option)
def get_doc_url():
"""
Returns:
The URL for the documentation
"""
return "{url_base}/{language}/{version}/{page_path}".format(
url_base=config.get("help_settings", "url_base"),
language=get_config_value_with_default("locales", settings.LANGUAGE_CODE),
version=config.get("help_settings", "version"),
page_path=get_config_value_with_default("pages", page_token),
)
def get_pdf_url():
"""
Returns:
The URL for the PDF document using the pdf_settings and the help_settings (version) in the configuration
"""
return "{pdf_base}/{version}/{pdf_file}".format(
pdf_base=config.get("pdf_settings", "pdf_base"),
version=config.get("help_settings", "version"),
pdf_file=config.get("pdf_settings", "pdf_file"),
)
def get_doc_url(token):
try:
return config.get(locale, token)
except ConfigParser.NoOptionError:
return config.get(locale, "default")
return {
"doc_url": get_doc_url(),
"pdf_url": get_pdf_url(),
}
return {"doc_url": get_doc_url}
return {'get_online_help_info': get_online_help_info}
# disable missing docstring
# pylint: disable=C0111
# pylint: disable=W0621
# pylint: disable=W0613
from lettuce import world, step
from component_settings_editor_helpers import enter_xml_in_advanced_problem
......@@ -8,11 +9,16 @@ from xmodule.modulestore.locations import SlashSeparatedCourseKey
from contentstore.utils import reverse_usage_url
@step('I export the course$')
def i_export_the_course(step):
@step('I go to the export page$')
def i_go_to_the_export_page(step):
world.click_tools()
link_css = 'li.nav-course-tools-export a'
world.css_click(link_css)
@step('I export the course$')
def i_export_the_course(step):
step.given('I go to the export page')
world.css_click('a.action-export')
......@@ -32,7 +38,7 @@ def i_enter_bad_xml(step):
@step('I edit and enter an ampersand$')
def i_enter_bad_xml(step):
def i_enter_an_ampersand(step):
enter_xml_in_advanced_problem(step, "<problem>&</problem>")
......
# pylint: disable=C0111
# pylint: disable=W0621
# pylint: disable=W0613
import os
from lettuce import world
from lettuce import world, step
from django.conf import settings
......@@ -14,7 +18,8 @@ def import_file(filename):
world.css_click(outline_css)
def go_to_import():
@step('I go to the import page$')
def go_to_import(step):
menu_css = 'li.nav-course-tools'
import_css = 'li.nav-course-tools-import a'
world.css_click(menu_css)
......
@shard_1
Feature: CMS.Help
As a course author, I am able to access online help
Scenario: Users can access online help on course listing page
Given There are no courses
And I am logged into Studio
Then I should see online help for "get_started"
Scenario: Users can access online help within a course
Given I have opened a new course in Studio
And I click the course link in My Courses
Then I should see online help for "organizing_course"
And I go to the course updates page
Then I should see online help for "updates"
And I go to the pages page
Then I should see online help for "pages"
And I go to the files and uploads page
Then I should see online help for "files"
And I go to the textbooks page
Then I should see online help for "textbooks"
And I select Schedule and Details
Then I should see online help for "setting_up"
And I am viewing the grading settings
Then I should see online help for "grading"
And I am viewing the course team settings
Then I should see online help for "course-team"
And I select the Advanced Settings
Then I should see online help for "index"
And I select Checklists from the Tools menu
Then I should see online help for "checklist"
And I go to the import page
Then I should see online help for "import"
And I go to the export page
Then I should see online help for "export"
Scenario: Users can access online help on the unit page
Given I am in Studio editing a new unit
Then I should see online help for "units"
Scenario: Users can access online help on the subsection page
Given I have opened a new course section in Studio
And I have added a new subsection
And I click on the subsection
Then I should see online help for "subsections"
# pylint: disable=C0111
# pylint: disable=W0621
# pylint: disable=W0613
from nose.tools import assert_false # pylint: disable=no-name-in-module
from lettuce import step, world
@step(u'I should see online help for "([^"]*)"$')
def see_online_help_for(step, page_name):
# make sure the online Help link exists on this page and contains the expected page name
elements_found = world.browser.find_by_xpath(
'//li[contains(@class, "nav-account-help")]//a[contains(@href, "{page_name}")]'.format(
page_name=page_name
)
)
assert_false(elements_found.is_empty())
# make sure the PDF link on the sock of this page exists
# for now, the PDF link stays constant for all the pages so we just check for "pdf"
elements_found = world.browser.find_by_xpath(
'//section[contains(@class, "sock")]//li[contains(@class, "js-help-pdf")]//a[contains(@href, "pdf")]'
)
assert_false(elements_found.is_empty())
......@@ -6,7 +6,7 @@ from lettuce import world, step
from nose.tools import assert_equal, assert_true # pylint: disable=E0611
from common import type_in_codemirror, open_new_course
from advanced_settings import change_value
from course_import import import_file, go_to_import
from course_import import import_file
DISPLAY_NAME = "Display Name"
MAXIMUM_ATTEMPTS = "Maximum Attempts"
......@@ -218,11 +218,6 @@ def i_have_empty_course(step):
open_new_course()
@step(u'I go to the import page')
def i_go_to_import(_step):
go_to_import()
@step(u'I import the file "([^"]*)"$')
def i_import_the_file(_step, filename):
import_file(filename)
......
......@@ -4,6 +4,10 @@ Specific overrides to the base prod settings to make development easier.
from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import
# Don't use S3 in devstack, fall back to filesystem
del DEFAULT_FILE_STORAGE
MEDIA_ROOT = "/edx/var/edxapp/uploads"
DEBUG = True
USE_I18N = True
TEMPLATE_DEBUG = DEBUG
......
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "files" %></%def>
<%!
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
......
......@@ -264,7 +264,8 @@
<!-- view -->
<div class="wrapper wrapper-view">
<%include file="widgets/header.html" />
<% online_help_token = self.online_help_token() if hasattr(self, 'online_help_token') else None %>
<%include file="widgets/header.html" args="online_help_token=online_help_token" />
<div id="page-alert"></div>
......@@ -276,7 +277,7 @@
<script type="text/javascript">
require(['js/sock']);
</script>
<%include file="widgets/sock.html" />
<%include file="widgets/sock.html" args="online_help_token=online_help_token" />
% endif
<%include file="widgets/footer.html" />
......
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "checklist" %></%def>
<%!
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
......
......@@ -2,6 +2,7 @@
from django.utils.translation import ugettext as _
%>
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "updates" %></%def>
<%namespace name='static' file='static_content.html'/>
<!-- TODO decode course # from context_course into title -->
......
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "pages" %></%def>
<%namespace name='static' file='static_content.html'/>
<%!
from django.utils.translation import ugettext as _
......
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "subsection" %></%def>
<%!
import logging
from util.date_utils import get_default_time_display, almost_same_datetime
......
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "export" %></%def>
<%namespace name='static' file='static_content.html'/>
<%!
......
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "import" %></%def>
<%namespace name='static' file='static_content.html'/>
<%!
from django.utils.translation import ugettext as _
......
<%! from django.utils.translation import ugettext as _ %>
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "home" %></%def>
<%block name="title">${_("My Courses")}</%block>
<%block name="bodyclass">is-signedin index view-dashboard</%block>
......@@ -275,18 +275,18 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) {
% endif
</article>
<aside class="content-supplementary" role="complimentary">
<div class="bit">
<h3 class="title title-3">${_('Need help?')}</h3>
<p>${_('If you are new to Studio and having trouble getting started, there are a few things that may be of help:')}</p>
<h3 class="title title-3">${_('New to edX Studio?')}</h3>
<p>${_('Click Help in the upper-right corner to get more more information about the Studio page you are viewing. You can also use the links at the bottom of the page to access our continously updated documentation and other Studio resources.')}</p>
<ol class="list-actions">
<li class="action-item">
<a href="http://files.edx.org/Getting_Started_with_Studio.pdf" title="This is a PDF Document">${_('Get started by reading Studio\'s Documentation')}</a>
<a href="${get_online_help_info(online_help_token())['doc_url']}" target="_blank">${_("Getting Started with edX Studio")}</a>
</li>
<li class="action-item">
<a href="http://help.edge.edx.org/discussion/new" class="show-tender" title="Use our feedback tool, Tender, to request help">${_('Request help with Studio')}</a>
<a href="http://help.edge.edx.org/discussion/new" class="show-tender" title="Use our feedback tool, Tender, to request help">${_('Request help with edX Studio')}</a>
</li>
</ol>
</div>
......
......@@ -3,6 +3,7 @@
<%! from django.core.urlresolvers import reverse %>
<%! from student.roles import CourseInstructorRole %>
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "team" %></%def>
<%block name="title">${_("Course Team Settings")}</%block>
<%block name="bodyclass">is-signedin course users view-team</%block>
......
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "outline" %></%def>
<%!
import logging
from util.date_utils import get_default_time_display
......
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "schedule" %></%def>
<%block name="title">${_("Schedule &amp; Details Settings")}</%block>
<%block name="bodyclass">is-signedin course schedule view-settings feature-upload</%block>
......
<%inherit file="base.html" />
<%def name="online_help_token()"><% return "advanced" %></%def>
<%namespace name='static' file='static_content.html'/>
<%!
from django.utils.translation import ugettext as _
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment