localgovdrupal / localgov

Installation profile for the LocalGov Drupal distribution.
GNU General Public License v2.0
81 stars 18 forks source link

Change the order of tabs in the Content view #718

Open willguv opened 3 months ago

willguv commented 3 months ago

This is the current order

Image

Media and Alert banners are used often but are too far over to the right

I think the order should be:

The reasoning for this is as follows:

MariosORION commented 3 months ago

This needed a combination of changes in the following PRs:

The resulting order of the Content page tabs after the above PRs make it into the main branch are:

willguv commented 3 months ago

Thanks @MariosORION !

finnlewis commented 3 months ago

Thanks for this @MariosORION ! Here's how I tested:

  1. Fresh install (on Gitpod @willguv :smile: )
  2. Enabling localgov_demo module.
  3. Composer required all the branches. (@willguv like this https://docs.localgovdrupal.org/devs/how-to/how-to-test-modules-with-gitpod.html#_5-testing-branches-from-github )
  4. Clear the cache. (drush cr)
  5. See the following order of the local tasks:

image

Crikey, quite a few pull requests to get through to re-arrange the tabs! I guess that makes sense.
Although, thinking about it now, could all this code be in one module? localgov_core for example? Oh no... I see now, lots of them are the default weight from config: https://github.com/localgovdrupal/localgov_directories/pull/379/files

Sorry! Totally makes sense!

Thanks @MariosORION and @willguv :smiley_cat:

willguv commented 3 months ago

This is brilliant, thanks Finn for testing and writing up these docs. I'll be able to take modules and branches for a spin, freeing up dev time. Will encourage others to get involved too.

Also thanks very much @MariosORION for picking this up at short notice.

Great work all round!

MariosORION commented 3 months ago

This is great, thanks both! Indeed @finnlewis , I wanted to keep the changes as "local" as possible hence the separate PRs. I was thinking about a testing workflow for this kind of change (e.g. referencing the actual branches in composer.json for local testing) - it looks like the Gitpod approach works really well - nice one! 👍👍

finnlewis commented 3 months ago

@MariosORION - quick question ( came up while reviewing and merging) - do the local tasks weights get exported as config, and so is it something that a specific site can override with config import?

MariosORION commented 3 months ago

@finnlewis short answer is yes. Long answer: Local tasks are made to primarily be static. Defaults are defined in example.links.task.yml files and hook_menu_local_tasks_alter can be used to alter these. The PRs here use a combination of the two, depending on the relative weight required for each item and how each item's weight is already defined (or altered) in the corresponding module. A specific site could override all of these using the same hook (also assuming that the weight of the module of the specific site where the hook implementation is added is greater than the weights of the modules utilising the same hook in these PRs).

willguv commented 2 months ago

Just installed this - looks great, thanks @MariosORION!

MariosORION commented 2 months ago

Great to hear, @willguv !