Core: New JS Extension API

Created on 25 Dec 2017  ·  4Comments  ·  Source: flarum/core

As per https://gist.github.com/tobyzerner/7613421bf93a953a33958e323d7ab67e

This will include some other specific changes:

  • Refactor entity controls:

    • flarum/controls/DiscussionControls
    • controls = new DiscussionControls(discussion)
    • controls.items() (don't bother with different “sections”? Need to review the way approval/flags/akismet adding post controls currently works)
    • Better yet: discussionControls(discussion)
  • ItemList improvements

    • Add a toVnodes method, remove the listItems helper
    • Allow method chaining
    • Consider these methods:
    • items.after('delete').add('something', hello)
    • items.before('delete').add('something', hello)
    • items.after('delete', 10).add() // specify a fallback priority
    • items.after(['foo', 'bar'], 10).add() // specify multiple items to add after
typfeature

Most helpful comment

I would love if the edit user modal could also be an item list.

https://github.com/flarum/core/blob/master/js/src/forum/components/EditUserModal.js

All 4 comments

When this is done, we might want to consider #246 as closed?

Related to ItemList could you possible move the login related entries of the LoginModal into a ItemList while you're at this? With your fluent setters this would be awesome.

See https://github.com/flarum/core/blob/master/js/forum/src/components/LogInModal.js

This would allow an extension to disable default authentication (relates to #641) but already gives us more flexibility.

I would love if the edit user modal could also be an item list.

https://github.com/flarum/core/blob/master/js/src/forum/components/EditUserModal.js

Do we want to move this to beta-9 now that the ItemList stuff has ben merged?

I guess this one should still be kept open, because "only" basic infrastructure (Webpack, heh) was done so far. In contrast to #851, which I will close in favor of some smaller issues, one per missing extender type.

Was this page helpful?
0 / 5 - 0 ratings