apostrophecms / apostrophecms/apostrophe

Add an option to build a custom nav in admin bar

Open
#3,575 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
4.6k
Forks
650
Avg merge
19h 21m
Merged PRs (30d)
23

Description

## The problem to solve

I'm building a website for a client. It's a magazine, so their main pice type is going to be articles. I haven't seen a single option to allow the "Articles" piece type to show up first in the admin menu bar.

## Proposed solution

add an option to the `@apostrophecms/admin-bar` module to set an order for admin bar items and groups, and then add the remaining non-ordered doc-types to the end of the menu bar.

```js
// app.js

require('apostrophe')({
shortName: 'lorem-ipsum',
modules: {
'@apostrophecms/admin-bar' : {
options: {
structure: [
'article',
'author',
'@apostrophecms/pages',
//menu item like in "addGroups" option
{ label: 'Media', items: ['@apostrophecms/image', '@apostrophecms/image-tag', '@apostrophecms/file', '@apostrophecms/file-tag'] ,
'@apostrophecms/users'
//items not manually added should be added here.
],
... //other options

```

## Alternatives

Perhaps a more "easy" route would be to establish an order option in all doc-types:
```js
// /modules/article/index.js
module.exports = {
extend: '@apostrophecms/piece-type',
options: {
label: 'Article',
pluralLabel: 'Articles',
order: 1
},
```
So that the Admin bar can order them with that number. If two types have the same "order" value, the first one loaded should take priority. Core apostrophecms types should not have a default order so that user-defined types can take priority.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the @apostrophecms/admin-bar module and the proposed configuration in app.js, then compare it with the alternative order option in modules/article/index.js. Define how ordered items and groups should be configured, how unlisted document types are appended, and how ties or core types are handled; the work is done when the admin bar follows the documented ordering behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.