In preparation for an upgrade to Bootstrap 5 I propose that we try to abstract the way we build some components. This will help reduce the number of template changes required during the update. Using Template::Toolkit WRAPPER we can create the main structure for breadcrumbs, currently: <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> <ol class="breadcrumb"> ... </ol> </nav> And also a structure for each navigation item: <li class="breadcrumb-item"> ... </li> This can be done gradually before the Bootstrap upgrade without causing any disruption.
Created attachment 144742 [details] [review] Bug 32507: Use template wrapper to build breadcrumb navigation This patch lays the groundwork for updating the way we build breadcrumb navigation on each page, and implements it on the cities administration page as a proof of concept. The page creates two blocks, 'breadcrumbs' and 'breadcrumb_item' 'breadcrumbs' builds the outer structure of the menu, currently: <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> <ol class="breadcrumb"> It automatically adds the "Home" link which appears on all pages. The 'breadcrumb_item' block builds the list item which contains the individual link. To test, apply the patch and go to Administration -> Cities & towns. On each variation of the page, check the breadcrumbs menu: - On the initial summary view it should be: Home -> Administration -> Cities - Click "New city" and the menu should be: Home -> Administration -> Cities -> New city - When you edit a city: Home -> Administration -> Cities -> Modify city - When you delete a city: Home -> Administration -> Cities -> Confirm deletion of city
Created attachment 144754 [details] [review] Bug 32507: Use template wrapper to build breadcrumb navigation This patch lays the groundwork for updating the way we build breadcrumb navigation on each page, and implements it on the cities administration page as a proof of concept. The page creates two blocks, 'breadcrumbs' and 'breadcrumb_item' 'breadcrumbs' builds the outer structure of the menu, currently: <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> <ol class="breadcrumb"> It automatically adds the "Home" link which appears on all pages. The 'breadcrumb_item' block builds the list item which contains the individual link. To test, apply the patch and go to Administration -> Cities & towns. On each variation of the page, check the breadcrumbs menu: - On the initial summary view it should be: Home -> Administration -> Cities - Click "New city" and the menu should be: Home -> Administration -> Cities -> New city - When you edit a city: Home -> Administration -> Cities -> Modify city - When you delete a city: Home -> Administration -> Cities -> Confirm deletion of city Signed-off-by: David Nind <david@davidnind.com>
Created attachment 145070 [details] [review] Bug 32507: (follow-up) Change parameter name to avoid collisions The variable name "active" is very likely to already be set for other reasons, so changing the parameter name to "bc_active" to avoid problems.
Created attachment 145147 [details] [review] Bug 32507: Use template wrapper to build breadcrumb navigation This patch lays the groundwork for updating the way we build breadcrumb navigation on each page, and implements it on the cities administration page as a proof of concept. The page creates two blocks, 'breadcrumbs' and 'breadcrumb_item' 'breadcrumbs' builds the outer structure of the menu, currently: <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> <ol class="breadcrumb"> It automatically adds the "Home" link which appears on all pages. The 'breadcrumb_item' block builds the list item which contains the individual link. To test, apply the patch and go to Administration -> Cities & towns. On each variation of the page, check the breadcrumbs menu: - On the initial summary view it should be: Home -> Administration -> Cities - Click "New city" and the menu should be: Home -> Administration -> Cities -> New city - When you edit a city: Home -> Administration -> Cities -> Modify city - When you delete a city: Home -> Administration -> Cities -> Confirm deletion of city Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 145148 [details] [review] Bug 32507: (follow-up) Change parameter name to avoid collisions The variable name "active" is very likely to already be set for other reasons, so changing the parameter name to "bc_active" to avoid problems. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Works for me, saves a few lines and is a good example of using the TT WRAPPER directive. Passing QA
Conflict, please rebase.
Created attachment 146400 [details] [review] Bug 32507: Use template wrapper to build breadcrumb navigation This patch lays the groundwork for updating the way we build breadcrumb navigation on each page, and implements it on the cities administration page as a proof of concept. The page creates two blocks, 'breadcrumbs' and 'breadcrumb_item' 'breadcrumbs' builds the outer structure of the menu, currently: <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> <ol class="breadcrumb"> It automatically adds the "Home" link which appears on all pages. The 'breadcrumb_item' block builds the list item which contains the individual link. To test, apply the patch and go to Administration -> Cities & towns. On each variation of the page, check the breadcrumbs menu: - On the initial summary view it should be: Home -> Administration -> Cities - Click "New city" and the menu should be: Home -> Administration -> Cities -> New city - When you edit a city: Home -> Administration -> Cities -> Modify city - When you delete a city: Home -> Administration -> Cities -> Confirm deletion of city Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 146401 [details] [review] Bug 32507: (follow-up) Change parameter name to avoid collisions The variable name "active" is very likely to already be set for other reasons, so changing the parameter name to "bc_active" to avoid problems. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Pushed to master for 23.05. Nice work everyone, thanks!
This will not be pushed to 22.11.x for now.
Many hands makes light work, thankyou everyone! Pushed to 22.11.x for the next release
Backported to support future maintanence.. and we pushed bug 32973 which depends upon it so needed to push this too.
Will not be backported to 22.05.x