For page naming (and URLs for pages): Say you have an app that has authors write stories for publishing:
- page for admins only to list all story
- page for admins only to edit/delete a story
- page for contributors to create/version a story
- page for members to view the story
Each of those pages are quite different in layout, so it’s not just a role difference.
Pages 2 and 3 could be the same page if we hide a bunch of controls and fields that only admins would have access to.
In terms of deployment, the ‘admin’ pages might be in a separate app, along with reused services (Business objects) that are then used by other apps through the use of a library.
So is there a best practice for establishing a URL (i.e. storyView, viewStory, manageStory, etc.) for the above scenario, and that we could generalize?
The naming convention that we use the most is:
- A page that displays a list or table of things is named the same as the plural name of the business object (SupplierLocations for example) and the path is one level with the camel case of the plural name (/supplierLocations in this example)
- A page that displays / interacts with a single item is named with the business object name (SupplierLocation for example) and the paths is two levels (/supplierLocations/ in this example)
If you have specialized versions of these (for admins for example), you can prepend the names with “Admin” and have paths like one of these examples:
- /admin/supplierLocations and /admin/supplierLocations/
- /adminSupplierLocations and /adminSupplierLocations/
If you have two pages that are almost exactly the same, but the path, security, and/or breadcrumb is different, you can move most of the page content into a component and include that in both pages. I use a naming conventions like SupplierLocationDetails or SupplierLocationPageContent for the component.
but if I set the path for the page so include /admin (i.e. /admin/events), then it doesn’t show up in the auto-generated sidenav? How can I have it included?
You would create a page at /admin that has links on it to the underlying pages. The page could be simple links or have lists for the commonly accessed items.
might there be a way to dynamically get all pages with a particular path?
The apexDesignerUserInterfacesService is available in all components. It includes the metadata for all the pages and components. You could scan through the user interfaces and check their paths to find all the ones that start with /admin for example. You could then user that information to construct a list of navigation links. You can search for ApexDesignerUserIntefacesService in your project and/or add this in a component or page:
debug('this.apexDesignerUserInterfacesService', this.apexDesignerUserInterfacesService);