When functionality is repeated across the site, it can be taken out of templates and moved into Partial Views – these partial views are repeatable chunks of code that can be placed within templates to achieve a specific goal.

Mega menu

The MegaMenu partial view (ulgMegaMenuPartial.html) renders the menu across the top of the site. The dropdowns highlight the pages underneath a section and featured items.

The MegaMenu partial, has the following logic.

  1. Got to the parent section (either a section page or the homepage) for this page
  2. Enumerate all pages in the section
    1. Order is determined by the sort order in Umbraco – meaning you can change the order by sorting the content in the Umbraco back end.
    2. Visible() only returns page that don’t have umbracoNaviHide set or that the user has permission to see
  3. Create a list from the pages
    1. For each item, enumerate the top X (default 6) items and put them in the drop down.
    2. Find the first 3 items which “featured in menu” set and put them in the featured section
  4. When the menu gets to the pre-defined length (which is set on section) – put all other items in the more drop down.

Contact Details

Throughout the uLocalGov starter kit, contact details have been moved out of content and into a contact us section. This allows for greater control over how users can contact the council, and allows for tracking of contact.

The main partial view for contact is ulgContactLinks. Given a contact node, it renders out the links for telephone, email and address into the side section of a page.

When a user clicks on telephone they are taken to the contact page with the number on it, by handling contact this way, it can be measured from each page.

News

The news is a basic set of Partial views to render news on the homepage (ulgHomepageNews) and list news on a news archive (ulNewsList)

Landing Page Lists

Landing pages form the back bone of the navigation of the site. a basic landing page consists of a number of ‘straight to…’ links for popular items with the remaining items being placed I the ‘more…’ section

The number of items in the straight to is controlled in the landing page

Links are rendered in their Umbraco sort order – changing the order of nodes inside Umbraco changes this order

The “Straight To” and ”More…” text is set in dictionary items. Allowing you to change it once throughout the site (and have it in welsh)

LocalGov MVC Starterkit, 2013