[jifty-devel] Display information before deleting a record
(partial patch included)
Henry Baragar
Henry.Baragar at instantiated.ca
Thu Nov 30 13:44:26 EST 2006
On Thursday, November 30 2006 12:56 pm, Jesse Vincent wrote:
> > OK, but the field values are not there without the patch (or something
> > similar).
>
> I don't think I ever expected that the delete action should really have
> more than a couple of arguments. Can you show us your template code?
>
Currently, /delete/contact:
<%args>
$contact
</%args>
<%init>
my $viewer = Jifty->web->new_action(
class => 'DeleteContact',
record => $contact,
);
my $customer = $contact->customer;
</%init>
<&|/_elements/wrapper, title => "Delete ".$contact->name . " from " .
$customer->name &>
<% Jifty->web->form->start() %>
<& '/_elements/form', viewer => $viewer &>
<% Jifty->web->form->submit( label => 'Confirm deletion' ) %>
<% Jifty->web->form->end() %>
</&>
And /_elements/form:
<%args>
$viewer
</%args>
% for my $field ($viewer->argument_names) {
<% $viewer->form_field($field) %>
% }
For comparison, here is /etc/contact:
<%args>
$contact
</%args>
<%init>
my $viewer = Jifty->web->new_action(
class => 'UpdateContact',
record => $contact,
moniker => 'UpdateContact',
);
my $customer = $contact->customer;
</%init>
<&|/_elements/wrapper, title => "Update ".$contact->name . " at " .
$customer->name &>
<% Jifty->web->form->start() %>
<& '/_elements/form', viewer => $viewer &>
<% Jifty->web->form->submit( label => 'Save Changes' ) %>
<% Jifty->web->form->end() %>
<a href="/delete/contact/<% $contact->seq %>">Delete this contact</a>
</&>
Here is an older version of /delete/contact:
<%args>
$contact
</%args>
<%init>
my $viewer = Jifty->web->new_action(
class => 'DeleteContact',
record => $contact,
);
my $customer = $contact->customer;
</%init>
<&|/_elements/wrapper, title => "Delete ".$contact->name . " from " .
$customer->name &>
<% Jifty->web->form->start() %>
<% $viewer->form_value('seq') %>
<% $viewer->form_value('name') %>
<% $viewer->form_value('email') %>
<% Jifty->web->form->submit( label => 'Confirm deletion' ) %>
<% Jifty->web->form->end() %>
</&>
And for completeness, here is the schema part of Model/Contact.pm:
use Billing::Record schema {
column customer =>
type is 'integer',
refers_to Billing::Model::Customer,
render_as 'hidden',
since '0.0.9'
;
column role =>
type is 'varchar(20)',
is mandatory,
default is 'billing',
valid_values are qw/billing other/,
render_as "select",
;
column seq =>
type is 'varchar(5)',
is mandatory,
valid_values are (1..20),
render_as "select",
;
column name =>
type is 'varchar(50)',
is mandatory,
;
column email =>
type is 'varchar(100)',
is mandatory,
;
column telephone =>
type is 'varchar(30)',
default is '',
;
column alt_telephone =>
type is 'varchar(30)',
default is '',
;
column fax =>
type is 'varchar(30)',
default is '',
;
column note =>
type is 'varchar(255)',
default is '',
render_as "textarea",
;
column status =>
type is 'varchar(40)',
default is '',
render_as 'unrendered',
;
column password =>
type is 'varchar(40)',
render_as 'unrendered',
;
};
As you can see, I would like to display at the contact name and email address
as part of the confirmation of the deletion.
Regards,
Henry
> -jesse
>
> > > > ps. Are we supposed to supply tests with submitted patches? HB
> > >
> > > Generally, that's a good way to get them trusted and applied faster.
> > > Patches with tests make me happy :)
> >
> > OK... next time.
> >
> > Henry
> >
> > > _______________________________________________
> > > jifty-devel mailing list
> > > jifty-devel at lists.jifty.org
> > > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> >
> > _______________________________________________
> > jifty-devel mailing list
> > jifty-devel at lists.jifty.org
> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
More information about the jifty-devel
mailing list