hugo/hugolib
bep d013edb7f8 Implement HasMenuCurrent and IsMenuCurrent for Nodes
Prior to this commit, `HasMenuCurrent` and `IsMenuCurrent` on `Node` always returned false.

This made it hard (if possible at all) to mark the currently selected menu item/group for non-Page content (home page, category pages etc.), i.e. for menus defined in the site configuration.

This commit provides an implementation of these two methods.

Notable design choices:

* These menu items have a loose coupling to the the resources they navigate to; the `Url` is the best common identificator. To facilitate a consistent matching, and to get it in line with the menu items connected to `Page`, relative Urls (Urls starting with '/') for menu items in the site configuration are converted to permaLinks using the same rules used for others’.
* `IsMenuCurrent` only looks at the children of the current node; this is in line with the implementation on `Page`.
* Due to this loose coupling, `IsMenuCurrent` have to search downards in the tree to make sure that the node is inside the current menu. This could have been made simpler if it could answer `yes` to any match of any menu item matching the current resource.

This commit also adds a set of unit tests for the menu system.

Fixes #367
2014-11-01 22:34:49 -04:00
..
benchmark_test.go permitting empty files again. Fixing some tests to now pass. 2014-05-01 14:11:56 -04:00
handler_file.go Handler WIP 2014-11-01 12:05:37 -04:00
handler_page.go Handler WIP 2014-11-01 12:05:37 -04:00
handlers.go Handler WIP 2014-11-01 12:05:37 -04:00
menu.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
menu_test.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
node.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
page.go Migrating Hugo to Afero for filesystem calls. 2014-11-01 11:57:29 -04:00
page_permalink_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
page_taxonomy_test.go fix tags not being in lowercase, #491 2014-09-11 17:03:31 -04:00
page_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
page_time_integration_test.go permitting empty files again. Fixing some tests to now pass. 2014-05-01 14:11:56 -04:00
pageGroup.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
pageSort.go Change all uses of sort.Sort to sort.Stable.Using sort.Stable ensures that even if the sort keys are the same, the order of the sort will not randomly change. Using the old sort.Sort, if you had pages with no date, the lists of those pages would randomly reorder every time you regenerate the list, causing spurious changes to the output. Now they'll always get ordered in the same way. 2014-09-09 09:22:16 -04:00
path_seperators_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
path_seperators_windows_test.go Add Disqus support out of the box. Move template/bundle into hugolib. 2014-04-23 02:53:12 -04:00
permalinks.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
permalinks_test.go permitting empty files again. Fixing some tests to now pass. 2014-05-01 14:11:56 -04:00
planner.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
redis.cn.md Adding benchmark for parsing pages using unicode. 2013-08-09 17:36:32 -07:00
rss_test.go Fixing all tests to pass with new Viper Config 2014-04-07 11:44:51 -04:00
shortcode.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
shortcode_test.go add 'width' parameter to 'figure' shortcode 2014-10-15 12:09:26 -04:00
site.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
site_show_plan_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
site_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
site_url_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
siteinfo_test.go Fix permalink functionality, which was broken in 62dd1d4. 2014-05-12 15:47:52 -04:00
sitemap.go Add Sitemaps config values handling 2014-05-09 23:11:33 -04:00
sitemap_test.go Add Sitemap testing 2014-05-09 23:11:42 -04:00
summary.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
taxonomy.go Sort by title if dates are the same 2014-09-11 17:23:01 -04:00
taxonomy_test.go permitting empty files again. Fixing some tests to now pass. 2014-05-01 14:11:56 -04:00
template.go Make First accept any int 2014-10-15 12:39:09 -04:00
template_embedded.go add 'width' parameter to 'figure' shortcode 2014-10-15 12:09:26 -04:00
template_test.go Make First accept any int 2014-10-15 12:39:09 -04:00