my $maxrows = delete $attributes{max_rows};
my $rows = $::form->numtextrows($value, $cols, $maxrows, $minrows);
- return $rows > 1
- ? $self->textarea_tag($name, $value, %attributes, rows => $rows, cols => $cols)
- : $self->input_tag($name, $value, %attributes, size => $cols);
+ $attributes{id} ||= _tag_id();
+ my $id = $attributes{id};
+
+ return $self->textarea_tag($name, $value, %attributes, rows => $rows, cols => $cols) if $rows > 1;
+
+ return '<span>'
+ . $self->input_tag($name, $value, %attributes, size => $cols)
+ . "<img src=\"image/edit-entry.png\" onclick=\"kivi.switch_areainput_to_textarea('${id}')\" style=\"margin-left: 2px;\">"
+ . '</span>';
}
sub multiselect2side {
return true;
};
+
+ ns.switch_areainput_to_textarea = function(id) {
+ var $input = $('#' + id);
+ if (!$input.length)
+ return;
+
+ var $area = $('<textarea></textarea>');
+
+ $area.prop('rows', 3);
+ $area.prop('cols', $input.prop('size') || 40);
+ $area.prop('name', $input.prop('name'));
+ $area.prop('id', $input.prop('id'));
+ $area.val($input.val());
+
+ $input.parent().replaceWith($area);
+ $area.focus();
+ };
});
kivi = namespace('kivi');