-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add documentation for event type and rearrange #441
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small stuff
docs/guide/custom-ui.md
Outdated
@@ -398,15 +398,25 @@ Before you override an editor modal, consider [adding a custom schema field type | |||
|
|||
## Adding custom context menu items | |||
|
|||
Apostrophe offers a context menu that can be used to carry out certain operations on a document, such as 'preview', 'duplicate', and so on. We can add custom context menu items from within any module, targeting any Vue component that implements `AposModal`. For an example of this, see the [code for the draft sharing modal](https://github.com/apostrophecms/apostrophe/blob/main/modules/%40apostrophecms/modal/ui/apos/components/AposModalShareDraft.vue). The menu registration should happen in the initialization phase. It is important to note that context menu operations will appear for all documents, even if added by a module associated with a specific type of document. However, take note of the various options below to limit when they appear. | |||
Apostrophe offers a context menu that can be used to carry out certain operations on a document, such as 'preview', 'duplicate', and so on. You can add custom context menu items from within any module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not new, but shouldn't these be double quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A screenshot is in order here for... context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes to the double quotes from looking at the rest of the document. Added.
I moved the screenshot up tp just below this paragraph.
docs/guide/custom-ui.md
Outdated
|
||
Here is an example of how to add a custom context menu item labeled "My Menu Item". | ||
Custom context menu items can either: | ||
1. Open a modal component that implements `AposModal`. For an example of this, see the [code for the draft sharing modal](https://github.com/apostrophecms/apostrophe/blob/main/modules/%40apostrophecms/modal/ui/apos/components/AposModalShareDraft.vue). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't hurt to say "modal dialog box" just once for SEO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed. Some other changes for SEO juice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things, otherwise great 👍🏼
docs/guide/custom-ui.md
Outdated
|
||
// Example: Fetch related content based on tags | ||
if (data.doc.tags && data.doc.tags.length) { | ||
self.apos.http.get('/api/v1/article', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here:
apos.http.get('/api/v1/article', {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
docs/guide/custom-ui.md
Outdated
|
||
``` javascript | ||
// Listen for the event elsewhere in your code or another module | ||
self.apos.bus.$on('refresh-related-content', (data) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to remove the self
since we frontend and apos is attached to window
apos.bus.$on('refresh-related-content', (data) => {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies to the self.notify
also, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's apos.notify on frontend side.
moduleName: operation.moduleName || this.moduleName, | ||
moduleLabels: this.moduleLabels, | ||
doc, | ||
...docProps(doc), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's documents somewhere what this docProps does, it gets some data from the doc. I don't get the point since we pass doc
.. 🤔.
Maybe we can just get rid of this line since unclear?
edit: May be for some BC stuff here. Let's keep it whatever.
Summary
Summarize the changes briefly, including which issue/ticket this resolves. If it closes an existing Github issue, include "Closes #[issue number]"
This PR rearranges the custom UI documentation to more clearly demonstrate adding an item to the context menu. It also adds new documentation for the
type: 'event'
property. Closes PRO-7106.What are the specific steps to test this change?
For example:
What kind of change does this PR introduce?
(Check at least one)
Make sure the PR fulfills these requirements:
If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.
Other information: