Add rows to textareas for notes/descriptions according to line breaks
This commit is contained in:
@@ -480,8 +480,3 @@ input, input.form-control
|
||||
|
||||
#comments-container
|
||||
margin-top: 0
|
||||
|
||||
#comments-container
|
||||
.comment-reply-container
|
||||
+container-box
|
||||
padding: 10px 10px 20px 10px
|
||||
|
@@ -24,7 +24,7 @@ html(lang="en")
|
||||
body("{% block bodyattrs %}{% if project %}data-project-url='{{ project.url }}'{% endif %}{% endblock %}")
|
||||
#app-main
|
||||
#col_sidebar
|
||||
nav.sidebar(role="navigation")
|
||||
nav.sidebar(role='navigation')
|
||||
ul
|
||||
li
|
||||
a.navbar-item.attract(href="{{ url_for('attract.index') }}",
|
||||
|
@@ -13,9 +13,10 @@
|
||||
|
||||
| {% if 'PUT' in shot.allowed_methods %}
|
||||
.input-transparent-group
|
||||
textarea.input-transparent(
|
||||
textarea#item-description.input-transparent(
|
||||
name="description",
|
||||
type="text",
|
||||
rows=1,
|
||||
placeholder='Description') {{ shot.description | hide_none }}
|
||||
|
||||
.input-transparent-group
|
||||
@@ -27,9 +28,10 @@
|
||||
| {% endfor %}
|
||||
|
||||
.input-transparent-group
|
||||
textarea.input-transparent(
|
||||
textarea#item-notes.input-transparent(
|
||||
name="notes",
|
||||
type="text",
|
||||
rows=1,
|
||||
placeholder='Notes') {{ shot.properties.notes | hide_none }}
|
||||
|
||||
.input-group-separator
|
||||
@@ -118,3 +120,16 @@ script.
|
||||
loadComments("{{ url_for('nodes.comments_for_node', node_id=shot['_id']) }}");
|
||||
|
||||
$('.js-help').openModalUrl('Help', "{{ url_for('attract.help', project_url=project.url) }}");
|
||||
|
||||
/* 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);
|
||||
}
|
||||
});
|
||||
|
@@ -161,8 +161,6 @@ script.
|
||||
matches = descriptionText.match(/\n/g),
|
||||
breaks = matches ? matches.length : 2;
|
||||
|
||||
console.log(matches);
|
||||
|
||||
if (descriptionText){
|
||||
descriptionField.attr('rows',breaks + 4);
|
||||
}
|
||||
|
Reference in New Issue
Block a user