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
DEV: Add more structure for admin plugin config nav #26707
DEV: Add more structure for admin plugin config nav #26707
Conversation
* Simplify config nav link generation to always inject the Settings tab * Auto-redirect to the first non-settings config link (if there is one) when the user lands on /admin/plugins/:plugin_id * Add `extras` to admin plugin serializer so plugins can add more data on first load
Relies on discourse/discourse#26707 from core TODO: Restyle the list page, delete any unnecessary route or template files
Extracted from the CalendarDateTimePicker to make it more generic
@@ -0,0 +1,20 @@ | |||
import i18n from "discourse-common/helpers/i18n"; |
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.
You can do this? I thought you were supposed to export the template as a constant
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 works too, but it's better to do it with a constant so the component has a name (useful in debugging/exploring with the Ember Inspector)
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.
Oh interesting, I was disappointed that ember inspector didn't give this a name, so I will do the const thing.
What happened here is that, I did something like:
export default <template>adssad</template>
And prettier autocorrected it to get rid of the export.
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.
Hmm I still get unknownTemplateOnlyComponent
in the ember extension, even though I changed it to export in the same way as another template component I have here https://github.com/discourse/discourse/blob/5495279fb7995d4ff6ad57363437ccae60471262/app/assets/javascripts/admin/addon/components/admin-plugins-list.gjs . Not a huge deal, just seems unexpected.
The initial setup done in fb0d563 clashed with other plugins, I found this when trying to do the same for Gamification. This uses a better routing setup and removes the need to define the config nav link for Settings -- that is always inserted. Relies on discourse/discourse#26707
This changes Gamification to follow the adminPlugins.show route convention from core, which we are changing all plugins to use instead of their own custom routes for advanced configuration. This moves some routes and paths around, and moves additional data for the admin leaderboards routes into `extras` on the plugin show API call. It also adds some CSS classes to the templates, and a system spec for the admin leaderboard functionality. The next PR will redesign the leaderboards list to follow convention, and refactor into components rather than just using route controllers + templates. Relies on discourse/discourse#26707 from core
tab
when the user lands on /admin/plugins/:plugin_id
extras
to admin plugin serializer so plugins can add moredata on first load