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
904007a9
Commit
904007a9
authored
Dec 10, 2014
by
Braden MacDonald
Committed by
E. Kolpakov
Jan 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: don't need to reload the whole page to refresh_children from the container view
parent
e498872a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
common/lib/xmodule/xmodule/public/js/library_content_edit.js
+12
-8
No files found.
common/lib/xmodule/xmodule/public/js/library_content_edit.js
View file @
904007a9
/* JavaScript for special editing operations that can be done on LibraryContentXBlock */
window
.
LibraryContentAuthorView
=
function
(
runtime
,
element
)
{
"use strict"
;
var
usage_id
=
$
(
element
).
data
(
'usage-id'
);
var
$element
=
$
(
element
);
var
usage_id
=
$element
.
data
(
'usage-id'
);
// The "Update Now" button is not a child of 'element', as it is in the validation message area
// But it is still inside this xblock's wrapper element, which we can easily find:
var
$wrapper
=
$
(
element
)
.
parents
(
'*[data-locator="'
+
usage_id
+
'"]'
);
var
$wrapper
=
$
element
.
parents
(
'*[data-locator="'
+
usage_id
+
'"]'
);
// We can't bind to the button itself because in the bok choy test environment,
// it may not yet exist at this point in time... not sure why.
...
...
@@ -21,12 +22,15 @@ window.LibraryContentAuthorView = function (runtime, element) {
state
:
'end'
,
element
:
element
});
// runtime.refreshXBlock(element);
// The above does not work, because this XBlock's runtime has no reference
// to the page (XBlockContainerPage). Only the Vertical XBlock's runtime has
// a reference to the page, and we have no way of getting a reference to it.
// So instead we:
location
.
reload
();
if
(
$element
.
closest
(
'.wrapper-xblock'
).
is
(
':not(.level-page)'
))
{
// We are on a course unit page. The notify('save') should refresh this block,
// but that is only working on the container page view of this block.
// Why? On the unit page, this XBlock's runtime has no reference to the
// XBlockContainerPage - only the top-level XBlock (a vertical) runtime does.
// But unfortunately there is no way to get a reference to our parent block's
// JS 'runtime' object. So instead we must refresh the whole page:
location
.
reload
();
}
});
});
};
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