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

Allow apps to add new actions in the “New” filemenu #19945

Closed
otetard opened this issue Oct 21, 2015 · 4 comments · Fixed by #20051
Closed

Allow apps to add new actions in the “New” filemenu #19945

otetard opened this issue Oct 21, 2015 · 4 comments · Fixed by #20051
Milestone

Comments

@otetard
Copy link
Contributor

otetard commented Oct 21, 2015

Hi,

I would be good to allow apps to add actions to the “New” (+) filemenu from the files app. To do so that would (AFAIK) need to do some modifications in the JavaScript code of the files app (in newfilemenu.js and filelist.js) :

  • in filelist.js, add a new function getNewFileMenu() to be able to retrieve the NewFileMenu instance (and instanciate it, if it’s not already done);
  • in newfilemenu.js, in the render() function, move items that are sent to template() to a private instance variable (for example NewFileMenu._menuItems);
  • add a new function registerAction() in newfilemenu.js that could be used by plugins to add items to the menu.

I already did a proof of concept of this, but as JavaScript is not my mother tongue, it would require some polish.

Olivier;

@MorrisJobke
Copy link
Contributor

cc @PVince81

@PVince81
Copy link
Contributor

Sounds good.

Ideal would be to have the extending class register itself using OC.Plugins.register("OCA.Files.NewFileMenu", ...' like for example here: https://github.com/owncloud/core/blob/v8.2.0/apps/files/js/favoritesplugin.js#L115

The plugin could then attach itself to the NewFileMenu instance and call a new function addMenuEntry(entrySpec) to add new entries. Each entry would look like these https://github.com/owncloud/core/blob/v8.2.0/apps/files/js/newfilemenu.js#L202 with an additional attribute template with the template (or render method) and another one action with a function to perform the action.

@otetard
Copy link
Contributor Author

otetard commented Oct 21, 2015

Thanks for the feedback.

I did a first try in this branch: feature/newfilemenu_extend. Currently, this does not include the ability to add items with specific HTML templates.

Olivier;

@PVince81
Copy link
Contributor

You could send a PR here so we can continue discussing

@MorrisJobke MorrisJobke added this to the 9.0-current milestone Oct 30, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants