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
b7440a51
Commit
b7440a51
authored
May 06, 2014
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dev support for context-sensitive help.
parent
3b258018
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
14 deletions
+78
-14
cms/djangoapps/contentstore/context_processors.py
+33
-10
cms/templates/base.html
+2
-1
cms/templates/edit-tabs.html
+1
-0
cms/templates/textbooks.html
+1
-0
cms/templates/widgets/header.html
+12
-1
docs/config.ini
+29
-2
No files found.
cms/djangoapps/contentstore/context_processors.py
View file @
b7440a51
import
ConfigParser
from
locale
import
getlocale
from
django.conf
import
settings
config_file
=
open
(
settings
.
REPO_ROOT
/
"docs"
/
"config.ini"
)
...
...
@@ -6,15 +7,37 @@ 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
):
def
get_doc_url
(
token
):
try
:
return
config
.
get
(
locale
,
token
)
except
ConfigParser
.
NoOptionError
:
return
config
.
get
(
locale
,
"default"
)
def
get_online_help_info
(
page_token
):
return
{
"doc_url"
:
get_doc_url
}
def
get_config_value
(
section_name
,
key
,
default_key
=
"default"
):
try
:
return
config
.
get
(
section_name
,
key
)
except
(
ConfigParser
.
NoOptionError
,
AttributeError
):
return
config
.
get
(
section_name
,
default_key
)
def
get_page_path
(
page_token
):
return
get_config_value
(
"pages"
,
page_token
)
def
get_langage_path
(
request
):
language_code
=
settings
.
LANGUAGE_CODE
return
get_config_value
(
"locales"
,
language_code
)
def
get_url
(
base_option
):
return
"{base_url}/{language}/{version}/{page_path}"
.
format
(
base_url
=
config
.
get
(
"server_settings"
,
base_option
),
language
=
language_dir
,
version
=
config
.
get
(
"server_settings"
,
"version"
),
page_path
=
page_path
,
)
language_dir
=
get_langage_path
(
request
)
page_path
=
get_page_path
(
page_token
)
return
{
"doc_url"
:
get_url
(
"base_url"
),
"pdf_url"
:
get_url
(
"base_pdf"
),
}
return
{
'get_online_help_info'
:
get_online_help_info
}
cms/templates/base.html
View file @
b7440a51
...
...
@@ -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>
...
...
cms/templates/edit-tabs.html
View file @
b7440a51
<
%
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
_
...
...
cms/templates/textbooks.html
View file @
b7440a51
<
%
inherit
file=
"base.html"
/>
<
%
def
name=
"online_help_token()"
><
%
return
"
textbooks
"
%
></
%
def>
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
<
%!
import
json
%
>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
...
...
cms/templates/widgets/header.html
View file @
b7440a51
...
...
@@ -3,7 +3,9 @@
from
django
.
core
.
urlresolvers
import
reverse
from
django
.
utils
.
translation
import
ugettext
as
_
from
xmodule
.
modulestore
.
django
import
loc_mapper
from
contentstore
.
context_processors
import
doc_url
%
>
<
%
page
args=
"online_help_token"
/>
<div
class=
"wrapper-header wrapper"
id=
"view-top"
>
<header
class=
"primary"
role=
"banner"
>
...
...
@@ -123,6 +125,10 @@
<nav
class=
"nav-account nav-is-signedin nav-dd ui-right"
>
<h2
class=
"sr"
>
${_("Help
&
Account Navigation")}
</h2>
<
%
help_doc_urls =
get_online_help_info(online_help_token)
%
>
<ol>
<li
class=
"nav-item nav-account-help"
>
<h3
class=
"title"
><span
class=
"label"
>
${_("Help")}
</span>
<i
class=
"icon-caret-down ui-toggle-dd"
></i></h3>
...
...
@@ -131,7 +137,7 @@
<div
class=
"nav-sub"
>
<ul>
<li
class=
"nav-item nav-help-documentation"
>
<a
href=
"
http://files.edx.org/Getting_Started_with_Studio.pdf
"
title=
"${_("
This
is
a
PDF
Document
")}"
>
${_("Studio Documentation")}
</a>
<a
href=
"
${help_doc_urls['pdf_url']}
"
title=
"${_("
This
is
a
PDF
Document
")}"
>
${_("Studio Documentation")}
</a>
</li>
<li
class=
"nav-item nav-help-helpcenter"
>
<a
href=
"http://help.edge.edx.org/"
rel=
"external"
>
${_("Studio Help Center")}
</a>
...
...
@@ -139,6 +145,11 @@
<li
class=
"nav-item nav-help-feedback"
>
<a
href=
"http://help.edge.edx.org/discussion/new"
class=
"show-tender"
title=
"${_("
Use
our
feedback
tool
,
Tender
,
to
share
your
feedback
")}"
>
${_("Contact Us")}
</a>
</li>
% if online_help_token:
<li
class=
"nav-item nav-help-online"
>
<a
href=
"${help_doc_urls['doc_url']}"
title=
"${_("
Contextual
Online
Help
")}"
>
${_("Online Help")}
</a>
</li>
% endif
</ul>
</div>
</div>
...
...
docs/config.ini
View file @
b7440a51
[en_us]
default
=
default
# below are the server-wide settings for documentation
[server_settings]
base_url
=
http://edx.readthedocs.org/projects/edx-partner-course-staff
base_pdf
=
https://media.readthedocs.org/pdf/edx-partner-course-staff
version
=
latest
# below are the sub-paths to the documentation for the various pages
[pages]
default
=
index.html
home
=
getting_started/get_started.html
courses
=
building_course/creating_new_course.html
outline
=
creating_content/organizing_course.html
updates
=
creating_content/handouts_updates.html
pages
=
creating_content/pages.html
files
=
creating_content/course_files.html
textbooks
=
creating_content/textbooks.html
schedule
=
building_course/setting_up_student_view.html
grading
=
building_course/establish_grading_policy.html
team
=
building_course/creating_new_course.html#add-course-team-members
advanced
=
index.html
checklist
=
building_course/creating_new_course.html#use-the-course-checklist
import
=
building_course/export_import_course.html
export
=
building_course/export_import_course.html
# below are the language directory names for the different locales
[locales]
default
=
en
en
=
en
en_us
=
en
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