summaryrefslogtreecommitdiff
path: root/app/views/common
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-07-05 11:41:43 +0200
committerAzul <azul@leap.se>2014-07-05 11:54:11 +0200
commitbdb4b0e275c205b0b44bbe3cc4ec4c162b309b37 (patch)
tree1b92aadd34f890a6332812a01a39769e24f4a733 /app/views/common
parent87e9ccbcdf4f99dd898b0715750092a27fff7e94 (diff)
make link_to_navigation more generic and reuse it
Use link_to_navigation for all important navigation items. It creates a link in a list item for use with bootstrap. It supports an :active flag and an :icon option in the html_options now. It also translates the label. This way it can be used in a lot of places as the generic navigation link.
Diffstat (limited to 'app/views/common')
-rw-r--r--app/views/common/_navigation_item.html.haml10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/views/common/_navigation_item.html.haml b/app/views/common/_navigation_item.html.haml
index 02c54c8..39b20d7 100644
--- a/app/views/common/_navigation_item.html.haml
+++ b/app/views/common/_navigation_item.html.haml
@@ -1,3 +1,9 @@
+-#
+-# A very simple navigation link. It takes a symbol, uses it for the
+-# translation, path and determining if the link is active.
+-#
+-# For something more complex use link_to_navigation directly instead.
+-#
- item = navigation_item.to_s
-%li{:class => ("active" if controller?(item))}
- = link_to t(".#{item}", cascade: true), polymorphic_url(item)
+= link_to_navigation ".#{item}", polymorphic_url(item),
+ active: controller?(item)