alphagov/whitehall — pull request #522 by h-lame (2013-04-30 12:39:59+00:00)
Title: Contact & office ordering for org and world org home pages

Primarily for: https://www.pivotaltracker.com/story/show/45102067
Also for: https://www.pivotaltracker.com/story/show/48509751

Allow orgs to define which contacts will appear on their home page, and to choose the order of those. Do the same thing for world orgs and their offices.

The main bulk of the work is the generic HomePageList object (that contains HomePageListItem objects). I've then made this a bit more specific with a has_home_page_list_of macro for defining more specific methods with names that relate to the name of the list. e.g. ``has_home_page_list_of :contacts`` gives you methods like ``home_page_contacts``, ``contact_shown_on_home_page?``, and ``add_contact_to_home_page``). I didn't just want to drop a new has_many :blah on the org / worldwide org as I wanted a very small and specific api for interacting with it.

The controller code has not been metaprogrammed away like the model code, so it's quite repetitive, any thoughts about fixing that would be much appreciated. Also any advice on things I may have forgotten about the home page list / home page list item objects and their interface with the rest of the system would be good.

In passing we also turn the org & world org admin tabs into vertical tabs (to stop them wrapping onto 2 lines and looking weird) and make the world org display of offices in admin more like the org display of contacts.