From: <sa...@kr...> - 2007-01-30 22:25:17
|
Revision: 3541 Author: sam Date: 2007-01-30 17:25:00 -0500 (Tue, 30 Jan 2007) Log Message: ----------- Fixed element editor to not display a delete button when no elements allow deletion. Also suppressed the Order column when nothing is reorderable. Modified Paths: -------------- trunk/krang/docs/changelog.pod trunk/krang/lib/Krang/CGI/ElementEditor.pm trunk/krang/templates/ElementEditor/edit.tmpl Modified: trunk/krang/docs/changelog.pod =================================================================== --- trunk/krang/docs/changelog.pod 2007-01-30 15:53:43 UTC (rev 3540) +++ trunk/krang/docs/changelog.pod 2007-01-30 22:25:00 UTC (rev 3541) @@ -7,6 +7,12 @@ =over +=item * + +Fixed element editor to not display a delete button when no elements +allow deletion. Also suppressed the Order column when nothing is +reorderable. [Sam] + =item * Send no-cache HTTP headers for all L<Krang::CGI> requests. This Modified: trunk/krang/lib/Krang/CGI/ElementEditor.pm =================================================================== --- trunk/krang/lib/Krang/CGI/ElementEditor.pm 2007-01-30 15:53:43 UTC (rev 3540) +++ trunk/krang/lib/Krang/CGI/ElementEditor.pm 2007-01-30 22:25:00 UTC (rev 3541) @@ -229,10 +229,13 @@ my @children = $element->children; # figure out list of slots that are reorderable - my @avail_ord = grep { $children[$_-1]->reorderable } (1 .. @children); + my @avail_ord = grep { $children[$_-1]->reorderable } (1 .. @children); + my $avail_del = grep { $_->allow_delete } @children; - # let the template know if none are reorderable so no button displayed - $template->param( no_reorder => 1 ) if not @avail_ord; + # let the template know if none are reorderable/deleteable so no + # button displayed + $template->param(no_reorder => 1) if not @avail_ord; + $template->param(no_delete => 1) if not $avail_del; foreach my $child (@children) { # setup form, making it invalid if needed Modified: trunk/krang/templates/ElementEditor/edit.tmpl =================================================================== --- trunk/krang/templates/ElementEditor/edit.tmpl 2007-01-30 15:53:43 UTC (rev 3540) +++ trunk/krang/templates/ElementEditor/edit.tmpl 2007-01-30 22:25:00 UTC (rev 3541) @@ -206,8 +206,8 @@ <tr class="form-head" style="border-bottom:1px solid #bababa;"> <td width="125">Element</td> <td width="275">Data Entry</td> - <td width="85">Order</td> - <td width="75"><input type="checkbox" onclick="checkall(this, 'remove_')"></td> + <td width="85"><tmpl_unless no_reorder>Order</tmpl_unless></td> + <td width="75"><tmpl_unless no_reorder><input type="checkbox" onclick="checkall(this, 'remove_')"></tmpl_unless></td> </tr> <tmpl_loop child_loop> @@ -256,7 +256,7 @@ </table> </td> <td align="center" class="form-cell"><tmpl_if no_reorder> <tmpl_else><input type="button" value="Reorder" onClick='reorder()' class="button"></tmpl_if></td> - <td align="center" class="form-cell"><input type="button" value="Delete" onClick='remove_children()' class="button"></td> + <td align="center" class="form-cell"><tmpl_unless no_delete><input type="button" value="Delete" onClick='remove_children()' class="button"></tmpl_unless></td> </tr> </table> <br> |