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
f82c2e00
Commit
f82c2e00
authored
Aug 20, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplified mustache helper loading
parent
1c161a76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
lms/djangoapps/django_comment_client/mustache_helpers.py
+10
-10
No files found.
lms/djangoapps/django_comment_client/mustache_helpers.py
View file @
f82c2e00
from
django.core.urlresolvers
import
reverse
import
django.core.urlresolvers
as
urlresolvers
import
urllib
import
urllib
import
sys
import
inspect
def
pluralize
(
content
,
text
):
def
pluralize
(
content
,
text
):
num
,
word
=
text
.
split
(
' '
)
num
,
word
=
text
.
split
(
' '
)
...
@@ -9,10 +11,10 @@ def pluralize(content, text):
...
@@ -9,10 +11,10 @@ def pluralize(content, text):
return
num
+
' '
+
word
return
num
+
' '
+
word
def
url_for_user
(
content
,
user_id
):
def
url_for_user
(
content
,
user_id
):
return
reverse
(
'django_comment_client.forum.views.user_profile'
,
args
=
[
content
[
'course_id'
],
user_id
])
return
urlresolvers
.
reverse
(
'django_comment_client.forum.views.user_profile'
,
args
=
[
content
[
'course_id'
],
user_id
])
def
url_for_tags
(
content
,
tags
):
# assume that
tags
is in the format u'a, b, c'
def
url_for_tags
(
content
,
tags
):
# assume that
attribute 'tags'
is in the format u'a, b, c'
return
reverse
(
'django_comment_client.forum.views.forum_form_discussion'
,
args
=
[
content
[
'course_id'
]])
+
'?'
+
urllib
.
urlencode
({
'tags'
:
tags
})
return
urlresolvers
.
reverse
(
'django_comment_client.forum.views.forum_form_discussion'
,
args
=
[
content
[
'course_id'
]])
+
'?'
+
urllib
.
urlencode
({
'tags'
:
tags
})
def
close_thread_text
(
content
):
def
close_thread_text
(
content
):
if
content
.
get
(
'closed'
):
if
content
.
get
(
'closed'
):
...
@@ -20,9 +22,7 @@ def close_thread_text(content):
...
@@ -20,9 +22,7 @@ def close_thread_text(content):
else
:
else
:
return
'Close thread'
return
'Close thread'
mustache_helpers
=
{
current_module
=
sys
.
modules
[
__name__
]
'pluralize'
:
pluralize
,
all_functions
=
inspect
.
getmembers
(
current_module
,
inspect
.
isfunction
)
'url_for_tags'
:
url_for_tags
,
'url_for_user'
:
url_for_user
,
mustache_helpers
=
{
k
:
v
for
k
,
v
in
all_functions
if
not
k
.
startswith
(
'_'
)}
'close_thread_text'
:
close_thread_text
,
}
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