-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
adds TabsEditingDescriptor, pluggen in VideoAlphaDescriptor #386
Conversation
expect($.fn.trigger.calls.length).toEqual(1) | ||
|
||
describe "save", -> | ||
it "if CodeMirror exist, data should be retreived", -> |
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 test isn't really about codemirror, just getValue.
I am on vacation all next week. When my comments are addressed, @dmitchell is another Studio person who can review the code (he's back in the office on Tuesday, I believe). |
@auraz i wasn't able to get the style sheet you added for the video alpha tabs working, so I have some ugly rules in the unit sass file I would like to clean up before merge if possible, but the tabs are looking like they should for now. let's talk in standup on monday. |
@auraz, @dmitchell may be a better person to review the code than me. I think he is back in the office Tuesday June 16. |
@rocha ok, thank you |
</section> | ||
|
||
<div class="component-edit-header" style="display: block"/> | ||
</div> |
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.
Probably should have newline at end of file.
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.
fixed.
@cahrens: on the previous PR for this (https://github.com/edx/edx-platform/pull/370#issuecomment-20838804), you noted that the placement of the help text in settings was too high, but this is unrelated to this PR, so I would like to address that in a separate PR. |
These tests are failing here and as well as in master, this is unrelated to current PR
|
@@ -0,0 +1,125 @@ | |||
window.TabsEditingDescriptorModel = |
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.
Why is there a global TabsEditingDescriptorModel, vs. TabsEditingDescriptor maintaining an instance?
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.
Because html templates are loaded before xmodule descriptor is instantiated.
Template need to register save functions and callback.
That's why TabsEditingDescriptorModel is global, so tab templates can register their functions.
I would like to have TabsEditingDescriptorModel part of TabsEditingDescriptor, but due to described behavior, I do not know how to do that. If you have ideas please share.
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.
@cpennington Do you have ideas about this? Will there be a solution in the xblock world?
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.
I don't follow the explanation of why this needs to be global. Can you point to particular lines of code that would work for a local instance loaded after the html is loaded onto the page?
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.
@cpennington For example, in codemirror-edit.html (one of tabs) there are two functions:
- window.TabsEditingDescriptorModel.addModelUpdate, which registers modelUpdate callback for current tab.
- window.TabsEditingDescriptorModel.addOnSwitch, which registers tab onswitch function.
At the very moment of loading templates for tabs, tabs-aggregator.coffee is loaded, so window.TabsEditingDescriptorModel is defined,
but descriptor instance is not created (TabsEditingDescriptor.constructor is not invoked).
We have next order of loading in studio:
- At page load, all js files are loaded, this is where window.TabsEditingDescriptorModel is created.
- At adding component, all templates are loaded. This is where TabsEditingDescriptorModel.addModelUpdate and TabsEditingDescriptorModel.addOnSwitch are invoked,
- On pressing edit button in studio, for editing component, descriptor instance is created (TabsEditingDescriptor.constructor is invoked).
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.
Couldn't the two functions from 2. be invoked by the TabsEditingDescriptor? All of the javascript in codemirror-edit.html is initialization code that I'd expect to only get called when the editor is actually needed. And then if those two functions are called when the edit button is clicked, we don't need to put TabsEditingDescriptorModel in the global namespace either.
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.
I think the issue is that TabsEditingDescriptor is a generic class. It should not be tied to the video module. How about the function calls occurring in a JavaScript file registered by VideoAlphaDescriptor? Right now, VideoAlphaDescritpor only registers HTML and CSS files. But I would expect this sort of initialization to happen in a JavaScript file instead of an HTML template.
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.
@cpennington Sorry, I do not understand, what do you proposing. If I add javascript code in tab's js/html, it goes somewhere, now it belongs to window.TabsEditingDescriptorModel. Don proposed move TabsEditingDescriptorModel to CMS.models. I agree that " All of the javascript in codemirror-edit.html is initialization code that I'd expect to only get called when the editor is actually needed". But those functions from tab need to be put somewhere before being invoked.
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.
@cahrens If i move them to tab's js, they anyway will be put somewhere on js load. How it will solve the problem?
@cahrens @dmitchell It is ok to move TabsEditingDescriptorModel definition to CMS.models? |
Nothing in common should refer to CMS.models. |
@cahrens @cpennington @dmitchell During talking with Cale, we figured out with solution to make TabEditingDescriptorModel class property of TabEditingDescriptor. All works fine. Look again over PR please. @cahrens Regarding moving out js code from tab templates to tab js files. I prefer not to do it in this PR. As now it will not solve any current issue. But will introduce more complexity to the code. If we will need it in future, we can always do it in another PR. Also I do not want for this PR to grow more. I try to make PR granular, as we have lot dependencies with videoalpha. |
I think there may be refinements available for the future (for instance, jquery already has a notion of binding methods to events, which might require less code on our part for the onSwitch binding). However, I'm 👍 on this as is. |
"""Descriptor for `VideoAlphaModule`.""" | ||
module_class = VideoAlphaModule | ||
template_dir_name = "videoalpha" |
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.
I don't think this template_dir_name is actually used for videoalpha. I think this should refer to a directory under /edx-platform/common/lib/xmodule/xmodule/templates, and there is no videoalpha directory there since there are not multiple types of videoalpha instances that can be created.
I believe it is safe to just delete this line. Or I guess in some places we actually put template_dir_name = None.
Note that cleanup should be done at some point to other xmodules, as a cleanup related to Don's PR to remove the majority of our template files.
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.
@cahrens As far i understood, we do not need template_dir_name for video alpha right now, as it is advanced component. Removed.
Just one question and a minor cleanup item. Otherwise, 👍 In the future, it would be helpful to not rebase after every iteration of the code. That makes it impossible to just review the diffs from the last commit (when iterating during the PR process). Instead, make changes as new commits and squash everything only once the review is complete. |
Updates comment Make Model descriptor class property. Fix tests
@cahrens Comments addressed. I will no do rebase after every iteration. Thank you. |
@isInactiveClass = "is-inactive" | ||
@isCurrent = "current" | ||
loadFixtures 'tabs-edit.html' | ||
@descriptor = new window.TabsEditingDescriptor($('.base_wrapper')) |
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 is the only place I can see where you reference this from window. Am I missing something?
I was on vacation. I don't think i have anything to add. I didn't keep up w/ the namespace discussion. |
adds TabsEditingDescriptor, pluggen in VideoAlphaDescriptor
Fix metadata inheritance
mattdrayer/MCKIN-2988: Added stop to backwards data migration.
…ird-party-auth-password Change the logic of password generation of third-party-auth openedx#369
…ird-party-auth-password Change the logic of password generation of third-party-auth openedx#369 (cherry picked from commit 6478819)
…ssion_test_for_direct_access Fix of discussion test broken by direct access
* update PUT response to include serializer.data * delete sites and return microsite ids for PUT and POST responses * check for exisiting Sites for PUT * remove unnecessary code
* Proversity/add microsites api ficus (openedx#385) * microsite api for ficus, markdown not displaying correctly in browsable api * work on tests for ficus, reverse url not working for TestCase * catch organization exception * reverse is now working * update test working, need to assert 404s * remove typo * update working again * post test failing * revert changes * swtiching branches, saving work * tests all passing * removes prints, deal with pylint * more pylint * remove unused code * more pylint * add some comments * clean up code and add course_id * update PUT response to include serializer.data (openedx#386) * update PUT response to include serializer.data * delete sites and return microsite ids for PUT and POST responses * check for exisiting Sites for PUT * remove unnecessary code * UPD: recap xblock update to taged version * remove editable flag from freetextresponse req * fix bad last accessed conditional
* update PUT response to include serializer.data * delete sites and return microsite ids for PUT and POST responses * check for exisiting Sites for PUT * remove unnecessary code
* Proversity/add microsites api ficus (#385) * microsite api for ficus, markdown not displaying correctly in browsable api * work on tests for ficus, reverse url not working for TestCase * catch organization exception * reverse is now working * update test working, need to assert 404s * remove typo * update working again * post test failing * revert changes * swtiching branches, saving work * tests all passing * removes prints, deal with pylint * more pylint * remove unused code * more pylint * add some comments * clean up code and add course_id * update PUT response to include serializer.data (#386) * update PUT response to include serializer.data * delete sites and return microsite ids for PUT and POST responses * check for exisiting Sites for PUT * remove unnecessary code * UPD: recap xblock update to taged version * remove editable flag from freetextresponse req * fix bad last accessed conditional
Introduces tabs for Videoalpha in studio.
@cahrens and @dmitchell please review.
For now, subtitles tabs is disabled, as it empty. It will be enabled in transcripts PR.
.