Reimplemented first tab link detention in template instead of tag

This commit is contained in:
Roberto Rosario
2011-05-25 01:35:43 -04:00
parent df1dc904fb
commit 6e67f1e37c
3 changed files with 4 additions and 4 deletions

View File

@@ -177,11 +177,11 @@
{% if form_navigation_links %} {% if form_navigation_links %}
<div class="secondary-navigation"> <div class="secondary-navigation">
<ul class="wat-cf"> <ul class="wat-cf">
{% with form_navigation_links as object_navigation_links %}
{% with "true" as as_li %} {% with "true" as as_li %}
{% with "true" as hide_active_anchor %} {% with "true" as hide_active_anchor %}
{% with "active" as li_class_active %} {% with "active" as li_class_active %}
{% with "first" as li_class_first %} {% with "first" as li_class_first %}
{% with form_navigation_links as object_navigation_links %}
{% include "generic_navigation.html" %} {% include "generic_navigation.html" %}
{% endwith %} {% endwith %}
{% endwith %} {% endwith %}

View File

@@ -9,7 +9,7 @@
{% evaluate_link condition as conditional_display %} {% evaluate_link condition as conditional_display %}
{% if conditional_display %} {% if conditional_display %}
{% if as_li %} {% if as_li %}
<li class="{% if link.first and li_class_first %}{{ li_class_first}} {% endif %}{% if link.active and li_class_active %}{{ li_class_active }}{% endif %}"> <li class="{% if forloop.first and li_class_first %}{{ li_class_first}} {% endif %}{% if link.active and li_class_active %}{{ li_class_active }}{% endif %}">
{% endif %} {% endif %}
{% include "generic_link_instance.html" %} {% include "generic_link_instance.html" %}
{% if as_li %}</li>{% endif %} {% if as_li %}</li>{% endif %}

View File

@@ -26,7 +26,8 @@ def process_links(links, view_name, url):
""" """
items = [] items = []
active_item = None active_item = None
for item, count in zip(links, range(len(links))): #for item, count in zip(links, range(len(links))):
for item in links:
item_view = 'view' in item and item['view'] item_view = 'view' in item and item['view']
item_url = 'url' in item and item['url'] item_url = 'url' in item and item['url']
new_link = item.copy() new_link = item.copy()
@@ -42,7 +43,6 @@ def process_links(links, view_name, url):
if view_name == child_view or url == child_url: if view_name == child_view or url == child_url:
active_item = item active_item = item
new_link.update({ new_link.update({
'first': count == 0,
'url': item_view and reverse(item_view) or item_url or u'#', 'url': item_view and reverse(item_view) or item_url or u'#',
}) })
items.append(new_link) items.append(new_link)