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
ab44ea2b
Commit
ab44ea2b
authored
Sep 22, 2017
by
Diana Huang
Committed by
GitHub
Sep 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16079 from edx/HarryRein/messaging-within-messaging-bug
Fix issue with course message classes.
parents
925cc7b8
fcf5f03b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
23 deletions
+37
-23
openedx/core/djangoapps/util/user_messages.py
+37
-23
No files found.
openedx/core/djangoapps/util/user_messages.py
View file @
ab44ea2b
...
@@ -87,7 +87,7 @@ class UserMessageCollection():
...
@@ -87,7 +87,7 @@ class UserMessageCollection():
raise
NotImplementedError
(
'Subclasses must define a namespace for messages.'
)
raise
NotImplementedError
(
'Subclasses must define a namespace for messages.'
)
@classmethod
@classmethod
def
get_message_html
(
self
,
body_html
,
title
=
None
,
dismissable
=
False
):
def
get_message_html
(
self
,
body_html
,
title
=
None
):
"""
"""
Returns the entire HTML snippet for the message.
Returns the entire HTML snippet for the message.
...
@@ -96,32 +96,13 @@ class UserMessageCollection():
...
@@ -96,32 +96,13 @@ class UserMessageCollection():
not use a title can just pass the body_html.
not use a title can just pass the body_html.
"""
"""
if
title
:
if
title
:
title_area
=
Text
(
_
(
'{header_open}{title}{header_close
}'
))
.
format
(
return
Text
(
_
(
'{header_open}{title}{header_close}{body
}'
))
.
format
(
header_open
=
HTML
(
'<div class="message-header">'
),
header_open
=
HTML
(
'<div class="message-header">'
),
title
=
title
,
title
=
title
,
body
=
body_html
,
header_close
=
HTML
(
'</div>'
)
header_close
=
HTML
(
'</div>'
)
)
)
else
:
return
body_html
title_area
=
''
if
dismissable
:
dismiss_button
=
HTML
(
'<div class="message-actions">'
'<button class="btn-link action-dismiss">'
'<span class="sr">{dismiss_text}</span>'
'<span class="icon fa fa-times" aria-hidden="true"></span></button>'
'</div>'
)
.
format
(
dismiss_text
=
Text
(
_
(
"Dismiss"
))
)
else
:
dismiss_button
=
''
return
Text
(
'{title_area}{body_area}{dismiss_button}'
)
.
format
(
title_area
=
title_area
,
body_area
=
HTML
(
'<div class="message-content">{body_html}</div>'
)
.
format
(
body_html
=
body_html
,
),
dismiss_button
=
dismiss_button
,
)
@classmethod
@classmethod
def
register_user_message
(
self
,
request
,
message_type
,
body_html
,
**
kwargs
):
def
register_user_message
(
self
,
request
,
message_type
,
body_html
,
**
kwargs
):
...
@@ -203,6 +184,39 @@ class PageLevelMessages(UserMessageCollection):
...
@@ -203,6 +184,39 @@ class PageLevelMessages(UserMessageCollection):
NAMESPACE
=
'page_level_messages'
NAMESPACE
=
'page_level_messages'
@classmethod
@classmethod
def
get_message_html
(
self
,
body_html
,
title
=
None
,
dismissable
=
False
):
"""
Returns the entire HTML snippet for the message.
"""
if
title
:
title_area
=
Text
(
_
(
'{header_open}{title}{header_close}'
))
.
format
(
header_open
=
HTML
(
'<div class="message-header">'
),
title
=
title
,
header_close
=
HTML
(
'</div>'
)
)
else
:
title_area
=
''
if
dismissable
:
dismiss_button
=
HTML
(
'<div class="message-actions">'
'<button class="btn-link action-dismiss">'
'<span class="sr">{dismiss_text}</span>'
'<span class="icon fa fa-times" aria-hidden="true"></span></button>'
'</div>'
)
.
format
(
dismiss_text
=
Text
(
_
(
"Dismiss"
))
)
else
:
dismiss_button
=
''
return
Text
(
'{title_area}{body_area}{dismiss_button}'
)
.
format
(
title_area
=
title_area
,
body_area
=
HTML
(
'<div class="message-content">{body_html}</div>'
)
.
format
(
body_html
=
body_html
,
),
dismiss_button
=
dismiss_button
,
)
@classmethod
def
get_namespace
(
self
):
def
get_namespace
(
self
):
"""
"""
Returns the namespace of the message collection.
Returns the namespace of the message collection.
...
...
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