Skip to content
This repository was archived by the owner on Feb 20, 2019. It is now read-only.

document extending the new menu in files app #1839

Merged
merged 3 commits into from
Oct 29, 2015
Merged

Conversation

MorrisJobke
Copy link
Contributor

@PVince81
Copy link
Contributor

Nice, thanks 👍

});
}
};
OC.Plugins.register('OCA.Files.NewFileMenu', myNewFileEntry);
Copy link
Contributor

Choose a reason for hiding this comment

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

may I suggest renaming this to myFileMenuPlugin instead ?
Because at this point you can add several entries.

Optionally you could also hack/override/extend the existing function classes to make them do additional stuff.

@MorrisJobke
Copy link
Contributor Author

@PVince81 done :P

@PVince81
Copy link
Contributor

Great 👍

OC.Plugins.register('OCA.Files.NewFileMenu', myFileMenuPlugin);

This will register a new menu entry in the "New" menu of the files app. The
method ``attach()`` is called once the menu is build. This usually happens right
Copy link
Contributor

Choose a reason for hiding this comment

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

s/build/built/

@carlaschroder
Copy link
Contributor

Looks perty.

carlaschroder pushed a commit that referenced this pull request Oct 29, 2015
document extending the new menu in files app
@carlaschroder carlaschroder merged commit 584ac6a into master Oct 29, 2015
@carlaschroder carlaschroder deleted the extend-core-ui branch October 29, 2015 16:29
OC.Plugins.register('OCA.Files.NewFileMenu', myFileMenuPlugin);

This will register a new menu entry in the "New" menu of the files app. The
method ``attach()`` is called once the menu is built. This usually happens right
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it called once, or everytime the button is pressed? might be interesting to know

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

The menu is created when first clicking the "+" button. Then it is reused for subsequent clicks.
This means that the plugin is only called once.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe saying "is called once when the menu is built" will get that across.

@devuan2
Copy link

devuan2 commented Jun 14, 2016

I'm trying to get this functionality working in 9.0. I've added the code above to my script.js file but the '+' menu does not appear altered under the Files app. I can modify the '+' menu by hacking around in /apps/files/js/newfilemenu.js, but it would be best not to have to alter core to get this working. Can someone point to an example app using this functionality?

@PVince81
Copy link
Contributor

@devuan2 see how the text editor adds its entry: https://github.com/owncloud/files_texteditor/blob/master/js/editor.js#L606

@devuan2
Copy link

devuan2 commented Jun 14, 2016

Ah, perfect. Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants