Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Refactor (Admin) JavaScript #168

@Biont

Description

@Biont

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions