-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add move option to a modal window #2547
Conversation
Related FE PR |
90f9205
to
6906f1e
Compare
d2aeabd
to
5ad8ca8
Compare
cms/urls.py
Outdated
@@ -146,8 +146,8 @@ | |||
name='xblock_outline_handler'), | |||
re_path(fr'^xblock/container/{settings.USAGE_KEY_PATTERN}$', contentstore_views.xblock_container_handler, | |||
name='xblock_container_handler'), | |||
re_path(fr'^xblock/{settings.USAGE_KEY_PATTERN}/editor$', edit_view_xblock, | |||
name='xblock_editor_handler'), | |||
re_path(fr'^xblock/{settings.USAGE_KEY_PATTERN}/actions/(?P<action_name>[^/]+)$$', xblock_actions_view, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to remove $
}; | ||
|
||
xblockView.render(); | ||
require(['js/models/xblock_info', 'js/views/xblock', 'js/views/utils/xblock_utils', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to remove unused dependencies
@@ -72,8 +73,10 @@ | |||
CREATE_IF_NOT_FOUND = ["course_info"] | |||
|
|||
# Useful constants for defining predicates | |||
NEVER = lambda x: False | |||
ALWAYS = lambda x: True | |||
def NEVER(x): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove formating change
@@ -208,6 +208,11 @@ function($, _, Backbone, gettext, BaseModal, ViewUtils, XBlockViewUtils, XBlockE | |||
// Notify child views to stop listening events | |||
Backbone.trigger('xblock:editorModalHidden'); | |||
|
|||
window.parent.postMessage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Send message for edit
@@ -185,6 +185,10 @@ function($, Backbone, _, gettext, BaseView, XBlockViewUtils, MoveXBlockUtils, Ht | |||
targetParentLocator: this.targetParentXBlockInfo.id | |||
} | |||
); | |||
window.parent.postMessage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Send message for move
5ad8ca8
to
b077870
Compare
@@ -119,6 +119,10 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview'], | |||
event.preventDefault(); | |||
event.stopPropagation(); // Make sure parent modals don't see the click | |||
} | |||
window.parent.postMessage({ | |||
method: 'close_edit_modal', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message is incorrect, it should be generic for modals
@require_http_methods("GET") | ||
@login_required | ||
def edit_view_xblock(request, usage_key_string): | ||
def xblock_actions_view(request, usage_key_string, action_name): | ||
""" | ||
The handler for rendered edit xblock view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update Docstring to describe the rendering for different xblock actions
"""
Return rendered xblock action view.
The action name should be provided as an argument.
Valid options for action name are edit and move.
"""
@@ -208,6 +208,11 @@ function($, _, Backbone, gettext, BaseModal, ViewUtils, XBlockViewUtils, XBlockE | |||
// Notify child views to stop listening events | |||
Backbone.trigger('xblock:editorModalHidden'); | |||
|
|||
window.parent.postMessage({ | |||
method: 'close_edit_modal', | |||
msg: 'Sends a message when the modal window is closed' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update message to specifically state about edit modal
Description
Adding Move modal functionality