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