Commit f9923bc8 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 302955: Remove the "delete" link for the default milestone - Patch by Gavin…

Bug 302955: Remove the "delete" link for the default milestone - Patch by Gavin Shelley <bugzilla@chimpychompy.org> r=LpSolit a=justdave
parent bc7607c1
...@@ -84,6 +84,7 @@ unless ($action) { ...@@ -84,6 +84,7 @@ unless ($action) {
$vars->{'product'} = $product->name; $vars->{'product'} = $product->name;
$vars->{'milestones'} = \@milestones; $vars->{'milestones'} = \@milestones;
$vars->{'default_milestone'} = $product->default_milestone;
$template->process("admin/milestones/list.html.tmpl", $template->process("admin/milestones/list.html.tmpl",
$vars) $vars)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
......
...@@ -54,24 +54,37 @@ ...@@ -54,24 +54,37 @@
name => "sortkey" name => "sortkey"
heading => "Sortkey" heading => "Sortkey"
}, },
{
name => "action"
heading => "Action"
content => "Delete"
contentlink => delete_contentlink
}
] ]
%] %]
[% columns.push({ [%# We want to override the usual 'Delete' link for the default
heading => "Action" milestone %]
content => "Delete" [% overrides.action = [ {
contentlink => delete_contentlink match_value => "$default_milestone"
}) %] match_field => 'name'
override_content => 1
content => "(Default milestone)"
override_contentlink => 1
contentlink => undef
} ]
%]
[% PROCESS admin/table.html.tmpl [% PROCESS admin/table.html.tmpl
columns = columns columns = columns
data = milestones data = milestones
overrides = overrides
%] %]
<p> <p>
[% PROCESS admin/milestones/footer.html.tmpl [% PROCESS admin/milestones/footer.html.tmpl
no_edit_other_milestones_link = 1 no_edit_other_milestones_link = 1
%] %]
[% PROCESS global/footer.html.tmpl %] [% PROCESS global/footer.html.tmpl %]
...@@ -50,6 +50,21 @@ ...@@ -50,6 +50,21 @@
# Each hash contains data for a single row of data. The # Each hash contains data for a single row of data. The
# keys are column names from columns subhashes name field. # keys are column names from columns subhashes name field.
# #
# overrides:
# Provides a method for overriding individual table cells. This is
# a hash, whose key is the column name, so the column must be
# named for one of it's cells to be overwritten. The hash value is
# an array. Each item in this array is a hash specifying
# row-matching criteria, and any overridden values. The
# row-matching criteria consist of keys:
# match_field: The name of the row value we want to match
# match_value: The value to match against
# Each column value mentioned in the 'columns' documentation above
# can be overwritten (apart from name and heading). To override a
# table-cell value 'xxx', specify a new 'xxx' value, and specify a
# 'override_xxx' value as well. See
# admin/milestones/list.html.tmpl for example
#
#%] #%]
[% PROCESS "global/field-descs.none.tmpl" %] [% PROCESS "global/field-descs.none.tmpl" %]
...@@ -70,12 +85,47 @@ ...@@ -70,12 +85,47 @@
[%################### TABLE CONTENT ######################%] [%################### TABLE CONTENT ######################%]
[% FOREACH row = data %] [% FOREACH row = data %]
<tr> <tr>
[% FOREACH c = columns %] [% FOREACH c = columns %]
<td [% IF c.align %] align="[% c.align FILTER html %]" [% END %]>
[%# Copy to local variables, as we may update these %]
[% IF c.contentlink %] [% contentlink = c.contentlink
[% link_uri = c.contentlink %] content = c.content
content_use_field = c.content_use_field
align = c.align
allow_html_content = c.allow_html_content
yesno_field = c.yesno_field
%]
[%# Are there any specific overrides for this column? %]
[% FOREACH override = overrides.${c.name} %]
[%# Is the override for this row? %]
[% IF override.match_value == row.${override.match_field} %]
[% contentlink = override.contentlink
IF override.override_contentlink %]
[% content = override.content
IF override.override_content %]
[% content_use_field = override.content_use_field
IF override.override_content_use_field %]
[% align = override.align
IF override.override_align %]
[% allow_html_content = override.allow_html_content
IF override.override_allow_html_content %]
[% yesno_field = override.yesno_field
IF override.override_yesno_field %]
[% LAST %]
[% END %]
[% END %]
<td [% IF align %] align="[% align FILTER html %]" [% END %]>
[% IF contentlink %]
[% link_uri = contentlink %]
[% WHILE link_uri.search('%%(.+?)%%')%] [% WHILE link_uri.search('%%(.+?)%%')%]
[% FOREACH m = link_uri.match('%%(.+?)%%') %] [% FOREACH m = link_uri.match('%%(.+?)%%') %]
[% IF row.$m %] [% IF row.$m %]
...@@ -89,20 +139,20 @@ ...@@ -89,20 +139,20 @@
<a href="[% link_uri %]"> <a href="[% link_uri %]">
[% END %] [% END %]
[% IF c.content_use_field %] [% IF content_use_field %]
[% colname = row.${c.name} %] [% colname = row.${c.name} %]
[% field_descs.${colname} FILTER html %] [% field_descs.${colname} FILTER html %]
[% ELSIF c.content %] [% ELSIF content %]
[% c.content %] [% content FILTER none %]
[% ELSE %] [% ELSE %]
[% IF c.yesno_field %] [% IF yesno_field %]
[% IF row.${c.name} %] [% IF row.${c.name} %]
Yes Yes
[% ELSE %] [% ELSE %]
No No
[% END %] [% END %]
[% ELSE %] [% ELSE %]
[% IF c.allow_html_content %] [% IF allow_html_content %]
[% row.${c.name} FILTER none %] [% row.${c.name} FILTER none %]
[% ELSE %] [% ELSE %]
[% row.${c.name} FILTER html %] [% row.${c.name} FILTER html %]
...@@ -110,7 +160,7 @@ ...@@ -110,7 +160,7 @@
[% END %] [% END %]
[% END %] [% END %]
[% IF c.contentlink %] [% IF contentlink %]
</a> </a>
[% END %] [% END %]
......
...@@ -493,8 +493,7 @@ ...@@ -493,8 +493,7 @@
], ],
'admin/table.html.tmpl' => [ 'admin/table.html.tmpl' => [
'link_uri', 'link_uri'
'c.content'
], ],
'admin/classifications/del.html.tmpl' => [ 'admin/classifications/del.html.tmpl' => [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment