Refactor (Admin) JavaScript #168

Closed
Biont opened this Issue Sep 7, 2015 · 0 comments

Comments

2 participants
@Biont
Collaborator

Biont commented Sep 7, 2015

This issue will keep track of commits and discussion concerning the planned refactoring of MLP's (back-end) JavaScript.

Currently, the JS is very barebone and closed down. There are a couple of private objects hosting a bunch of functions that we need to implement our back-end functionality.
Now, for small things like the term translation selectors, this is probably not a big deal. No need to overcomplicate things.

But on the post translator, or more specifically, the Translation meta box, this approach makes it impossible (or at least rather cumbersome) to implement custom functionality. If we're dedicated to making it easy for developers to extend MLP, our JS should not stand in the way of doing that.

I would propose reworking the Post Editor JS so that each Translation meta box, as well as all elements in it, are turned into Backbone objects. This should make it very easy to customize and extend them.

Roadmap:

  • admin.js
    • admin.js: copyPost() -> post-translator/CopyPost.js
    • admin.js: setToggle() -> common/Common.js
    • advanced_translator.js
    • nav_menu_meta_box.js -> nav-menus/NavMenus.js
    • plugin_activator.js -> network/AddNewSite.js
    • relationship_control.js -> post-translator/RelationshipControl.js
    • relationship_control.js -> post-translator/RCSearch.js
    • term_translator.js -> term-translator/TermTranslator.js
  • frontend.js
    • quicklink.js -> quicklink/Quicklinks.js
  • inline scripts
    • Mlp_New_Site_View.php -> network/AddNewSite.js
    • Mlp_Relationship_Control_Meta_Box_View.php -> post-translator/RelationshipControl.js
    • Mlp_User_Backend_Language.php -> user-settings/UserBackendLanguage.js
  • Provide access to Copy Post feature for third-party developers
    • post-translator/CopyPost.js: copyPostData: allow custom data to be added
    • post-translator/CopyPost.js: updatePostData: fire event and pass data
    • Mlp_Advanced_Translator::process_post_data: provide a filter for the $data array

@Biont Biont added this to the v2.3.0 milestone Sep 7, 2015

@tfrommen tfrommen added the refactoring label Sep 7, 2015

@tfrommen tfrommen removed this from the v2.3.0 milestone Nov 24, 2015

@tfrommen tfrommen added this to the v2.4.0 milestone Dec 17, 2015

@tfrommen tfrommen self-assigned this Dec 17, 2015

tfrommen added a commit that referenced this issue Dec 18, 2015

@tfrommen tfrommen changed the title from Refactor Admin JS to Refactor (Admin) JavaScript Dec 18, 2015

tfrommen added a commit that referenced this issue Dec 21, 2015

tfrommen added a commit that referenced this issue Dec 22, 2015

tfrommen added a commit that referenced this issue Dec 22, 2015

tfrommen added a commit that referenced this issue Dec 23, 2015

tfrommen added a commit that referenced this issue Dec 23, 2015

tfrommen added a commit that referenced this issue Dec 23, 2015

tfrommen added a commit that referenced this issue Dec 23, 2015

tfrommen added a commit that referenced this issue Jan 18, 2016

tfrommen added a commit that referenced this issue Jan 19, 2016

tfrommen added a commit that referenced this issue Jan 19, 2016

tfrommen added a commit that referenced this issue Jan 20, 2016

tfrommen added a commit that referenced this issue Jan 20, 2016

tfrommen added a commit that referenced this issue Jan 21, 2016

tfrommen added a commit that referenced this issue Jan 21, 2016

tfrommen added a commit that referenced this issue Jan 21, 2016

tfrommen added a commit that referenced this issue Jan 21, 2016

@tfrommen tfrommen closed this in 7938d80 Jan 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment