<%once>;
my $widget = 'profile';
</%once>
<%args>
$id => undef
</%args>
<%init>;

if ($ARGS{id} or $ARGS{site_id}) {
    $m->comp('edit.html', widget => $widget,
                          id     => $id,
                          %ARGS);
} else {
    # If there is only one site that they have EDIT access to,
    # skip the site chooser screen.
    my $sites = site_list(EDIT);
    if (@$sites == 1) {
        $ARGS{site_id} = $sites->[0]->get_id;
        $m->comp('edit.html', widget => $widget,
                              id     => $id,
                              %ARGS);
    } else {
        $m->comp('new.html', widget => $widget,
                             id     => $id,
                             sites  => $sites);
    }
}
</%init>
