<%class>
use JSON;
use URI::Escape;
has 'data';
has 'cb' => ( isa => 'Int');
</%class>
<%init>
my $args = eval {
return from_json(uri_unescape($.data), { ascii => 1});
};
$m->redirect('/login') unless $USER && $USER->{'logged_in'};
$args->{'authors'} = [] unless $args->{'authors'} && ref($args->{'authors'}) eq 'ARRAY';
</%init>
<li class="header">
<p>
Authors
       
show sidebar
</p>
</li>
% my @author_box = ();
% foreach my $a (sort { $a->{'last_name'} cmp $b->{'last_name'} || $a->{'first_name'} cmp $b->{'first_name'} } @{$args->{'authors'}}) {
<li>
<p>
<a href="javascript:void(0)" onclick="remove_author(<% $a->{'id'} %>);" class="right icon-small icon-delete-small"></a>
<% $a->{'last_name'} %>, <% $a->{'first_name'} %> (<% $a->{'initials'} %>)
    
<input type="checkbox" name="cb" value="" onclick="$(this).attr('value', this.checked ? 1 : 0)">
</p>
</li>
% }
<li>
<p>
<input type="submit" value="Add" class="right" onclick="add_author();"/>
<input id="new_author" style="width:75%;" />
<input type="hidden" id="new_author_data" />
</p>
</li>