Resize description/notes textareas as we type
This commit is contained in:
@@ -132,15 +132,13 @@ script.
|
||||
|
||||
$('.js-help').openModalUrl('Help', "{{ url_for('attract.help', project_url=project.url) }}");
|
||||
|
||||
/* Resize textareas */
|
||||
var textAreaFields = $('#item-description, #item-notes');
|
||||
{% if 'PUT' in shot.allowed_methods %}
|
||||
/* Resize textareas */
|
||||
var textAreaFields = $('#item-description, #item-notes');
|
||||
|
||||
textAreaFields.each(function(){
|
||||
var descriptionText = $(this).val(),
|
||||
matches = descriptionText.match(/\n/g),
|
||||
breaks = matches ? matches.length : 2;
|
||||
|
||||
if (descriptionText){
|
||||
$(this).attr('rows', breaks + 2);
|
||||
}
|
||||
});
|
||||
textAreaFields.each(function(){
|
||||
$(this)
|
||||
.autoResize()
|
||||
.blur();
|
||||
});
|
||||
{% endif %}
|
||||
|
@@ -47,7 +47,7 @@
|
||||
|
||||
| {% if 'PUT' in task.allowed_methods %}
|
||||
.input-group
|
||||
textarea#task-description(
|
||||
textarea#item-description(
|
||||
name="description",
|
||||
type="text",
|
||||
rows=1,
|
||||
@@ -160,15 +160,9 @@ script.
|
||||
loadComments("{{ url_for('nodes.comments_for_node', node_id=task['_id']) }}");
|
||||
|
||||
{% if 'PUT' in task.allowed_methods %}
|
||||
/* Resize textarea */
|
||||
var descriptionField = $('#task-description');
|
||||
var descriptionText = descriptionField.val(),
|
||||
matches = descriptionText.match(/\n/g),
|
||||
breaks = matches ? matches.length : 2;
|
||||
|
||||
if (descriptionText){
|
||||
descriptionField.attr('rows',breaks + 4);
|
||||
}
|
||||
$('#item-description')
|
||||
.autoResize()
|
||||
.blur();
|
||||
{% endif %}
|
||||
|
||||
$('.js-help').openModalUrl('Help', "{{ url_for('attract.help', project_url=project.url) }}");
|
||||
|
Reference in New Issue
Block a user