diff --git a/src/templates/attract/shots/view_shot_embed.jade b/src/templates/attract/shots/view_shot_embed.jade index 93f6122..512ea39 100644 --- a/src/templates/attract/shots/view_shot_embed.jade +++ b/src/templates/attract/shots/view_shot_embed.jade @@ -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 %} diff --git a/src/templates/attract/tasks/view_task_embed.jade b/src/templates/attract/tasks/view_task_embed.jade index 5000a27..7f7346c 100644 --- a/src/templates/attract/tasks/view_task_embed.jade +++ b/src/templates/attract/tasks/view_task_embed.jade @@ -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) }}");