Skip to content
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

Merged
merged 2 commits into from
Aug 5, 2013

Conversation

auraz
Copy link
Contributor

@auraz auraz commented Jul 12, 2013

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.
.

@ghost ghost assigned cahrens Jul 12, 2013
expect($.fn.trigger.calls.length).toEqual(1)

describe "save", ->
it "if CodeMirror exist, data should be retreived", ->
Copy link

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.

@cahrens
Copy link

cahrens commented Jul 12, 2013

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).

@frrrances
Copy link
Contributor

@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.

@rocha
Copy link
Contributor

rocha commented Jul 15, 2013

@auraz, @dmitchell may be a better person to review the code than me. I think he is back in the office Tuesday June 16.

@auraz
Copy link
Contributor Author

auraz commented Jul 16, 2013

@rocha ok, thank you

</section>

<div class="component-edit-header" style="display: block"/>
</div>
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@frrrances
Copy link
Contributor

@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.

@auraz
Copy link
Contributor Author

auraz commented Jul 25, 2013

These tests are failing here and as well as in master, this is unrelated to current PR

  • Course Overview, runshould save model when save is clicked and should show a confirmation on save.

@@ -0,0 +1,125 @@
window.TabsEditingDescriptorModel =
Copy link

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?

Copy link
Contributor Author

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.

Copy link

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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:

  1. At page load, all js files are loaded, this is where window.TabsEditingDescriptorModel is created.
  2. At adding component, all templates are loaded. This is where TabsEditingDescriptorModel.addModelUpdate and TabsEditingDescriptorModel.addOnSwitch are invoked,
  3. On pressing edit button in studio, for editing component, descriptor instance is created (TabsEditingDescriptor.constructor is invoked).

Copy link
Contributor

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.

Copy link

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

@auraz
Copy link
Contributor Author

auraz commented Jul 31, 2013

@cahrens @dmitchell It is ok to move TabsEditingDescriptorModel definition to CMS.models?

@cahrens
Copy link

cahrens commented Jul 31, 2013

Nothing in common should refer to CMS.models.

@auraz
Copy link
Contributor Author

auraz commented Aug 2, 2013

@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.

@cpennington
Copy link
Contributor

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"
Copy link

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.

Copy link
Contributor Author

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.

@cahrens
Copy link

cahrens commented Aug 2, 2013

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.

auraz added 2 commits August 5, 2013 13:38
Updates comment
Make Model descriptor class property.
Fix tests
@auraz
Copy link
Contributor Author

auraz commented Aug 5, 2013

@cahrens Comments addressed. I will no do rebase after every iteration. Thank you.
@dmitchell Cale and Christina said ok, is it ok, or you will look over?

@isInactiveClass = "is-inactive"
@isCurrent = "current"
loadFixtures 'tabs-edit.html'
@descriptor = new window.TabsEditingDescriptor($('.base_wrapper'))
Copy link
Contributor

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?

@dmitchell
Copy link
Contributor

I was on vacation. I don't think i have anything to add. I didn't keep up w/ the namespace discussion.

auraz added a commit that referenced this pull request Aug 5, 2013
adds TabsEditingDescriptor, pluggen in VideoAlphaDescriptor
@auraz auraz merged commit 16cee19 into master Aug 5, 2013
@auraz auraz deleted the alex/editor-tabs-for-videoalpha branch August 5, 2013 15:58
chrisrossi pushed a commit to jazkarta/edx-platform that referenced this pull request Mar 31, 2014
e-kolpakov referenced this pull request in open-craft/edx-platform Mar 3, 2015
mattdrayer/MCKIN-2988: Added stop to backwards data migration.
hachiyanagi-ks added a commit to nttks/edx-platform that referenced this pull request Oct 2, 2015
…ird-party-auth-password

Change the logic of password generation of third-party-auth openedx#369
hachiyanagi-ks added a commit to nttks/edx-platform that referenced this pull request Oct 6, 2015
…ird-party-auth-password

Change the logic of password generation of third-party-auth openedx#369
(cherry picked from commit 6478819)
diegomillan pushed a commit to eduNEXT/edx-platform that referenced this pull request Sep 14, 2016
…ssion_test_for_direct_access

Fix of discussion test broken by direct access
jfavellar90 pushed a commit to eduNEXT/edx-platform that referenced this pull request Apr 11, 2018
* 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
jfavellar90 pushed a commit to eduNEXT/edx-platform that referenced this pull request Apr 11, 2018
* 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
dgamanenko referenced this pull request in raccoongang/edx-platform Jun 14, 2018
* 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
dgamanenko referenced this pull request in raccoongang/edx-platform Jun 14, 2018
* 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
xavierchan pushed a commit to xavierchan/edx-platform-1 that referenced this pull request May 20, 2019
Sujeet1379 pushed a commit to chandrudev/edx-platform that referenced this pull request Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants