Fix some bugs in product view template

This commit is contained in:
Lance Edgar 2016-12-20 16:09:59 -06:00
parent 8afaf80128
commit feef8a5ecc

View file

@ -2,8 +2,6 @@
<%inherit file="/master/view.mako" /> <%inherit file="/master/view.mako" />
<%namespace file="/forms/lib.mako" import="render_field_readonly" /> <%namespace file="/forms/lib.mako" import="render_field_readonly" />
<% product = instance %>
<%def name="head_tags()"> <%def name="head_tags()">
${parent.head_tags()} ${parent.head_tags()}
<style type="text/css"> <style type="text/css">
@ -23,8 +21,8 @@
<%def name="context_menu_items()"> <%def name="context_menu_items()">
${parent.context_menu_items()} ${parent.context_menu_items()}
% if version_count is not Undefined and request.has_perm('product.versions.view'): % if version_count is not Undefined and request.has_perm('instance.versions.view'):
<li>${h.link_to("View Change History ({})".format(version_count), url('product.versions', uuid=product.uuid))}</li> <li>${h.link_to("View Change History ({})".format(version_count), url('product.versions', uuid=instance.uuid))}</li>
% endif % endif
</%def> </%def>
@ -86,7 +84,7 @@
<th>Code</th> <th>Code</th>
</thead> </thead>
<tbody> <tbody>
% for i, code in enumerate(product._codes, 1): % for i, code in enumerate(instance._codes, 1):
<tr class="${'odd' if i % 2 else 'even'}"> <tr class="${'odd' if i % 2 else 'even'}">
<td>${code.ordinal}</td> <td>${code.ordinal}</td>
<td>${code.code}</td> <td>${code.code}</td>
@ -160,7 +158,7 @@
<th>Unit Cost</th> <th>Unit Cost</th>
</thead> </thead>
<tbody> <tbody>
% for i, cost in enumerate(product.costs, 1): % for i, cost in enumerate(instance.costs, 1):
<tr class="${'odd' if i % 2 else 'even'}"> <tr class="${'odd' if i % 2 else 'even'}">
<td class="center">${'X' if cost.preference == 1 else ''}</td> <td class="center">${'X' if cost.preference == 1 else ''}</td>
<td>${cost.vendor}</td> <td>${cost.vendor}</td>