<& '/widgets/wrappers/sharky/table_top.mc',
    caption => "Category Keywords",
    number  => 1,
&>

<dl class="viewmeta">
% foreach my $cat ($story->get_categories) {
    <dt><% $lang->maketext('Category') %></dt>
    <dd><% $cat->get_name %></dd>

    <dt><% $lang->maketext('Keywords') %></dt>
    <dd><% join(', ', map { $_->get_name } $cat->get_keywords) %></dd>
% }
</dl>

<& '/widgets/wrappers/sharky/table_bottom.mc' &>

<& '/widgets/wrappers/sharky/table_top.mc',
    caption => "Story Keywords",
    number  => 2
&>

<& '/widgets/add_more/add_more.mc',
    type    => 'keyword',
    param => $param,
    fields => [qw(keyword)],
    name => 'keyword',
    deleteLabelOnly => 1,
    reset_key => $story->get_id,
    objs => $keywords,
    incr => 4,
    no_edit => [qw(keyword)],
    num => @$keywords >= 4 ? @$keywords + 2 : 4
&>

<& '/widgets/wrappers/sharky/table_bottom.mc' &>

<& '/widgets/profile/formButtons.mc',
    type    => 'story',
    section => 'workflow',
    no_del  => 1,
    return  => '/workflow/profile/story',
    widget  => $widget,
    cb      => 'add_kw_cb',
&>

<%args>
$widget
$param => undef
</%args>

<%init>;
my $story = get_state_data($widget, 'story');
my $keywords = $story->get_keywords || [];
</%init>
