Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back multiline comments #1407

Merged
merged 4 commits into from
Oct 11, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/comments/css/comments.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#commentsTabView .newCommentForm .submit {
position: absolute;
top: 1px;
bottom: 1px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this it looks in Firefox good, but in Chrome not that good. Then I could change this to 5px to look in Chrome good, but in Firefox not centered. The reason is that the surrounding element (a <form>) is in Chrome not fitted around the textarrea but a bit longer at the bottom.

bildschirmfoto von 2016-10-05 17-32-41

@nextcloud/designers Any idea how we could solve this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only 75 px in height in Firefox (and those are the 4 additional pixels that are needed in Chrome) 😞

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it looks without the change to bottom: 5px in chrome:
bildschirmfoto von 2016-10-05 17-34-59

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe @skjnldsv can help with this maybe? 😉

I failed too, for some reason the form height is calculated differently in FF/Chrome and therefore the absolute positioning looks different.

However, now that we want to bring back a dedicated login button in #1641 as the inline one caused confusion and here it looks also weird as soon as the comment is expanded to multiple lines, I thought about changing this form to use a dedicated button too. cc @jancborchardt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChristophWurst @MorrisJobke You need to put a display:block on the textarea. :)
It should do the trick and the form should now take the full textarea size.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

firefox firefox
chrome chrome

right: 8px;
width: 30px;
margin: 0;
Expand All @@ -47,6 +47,10 @@
margin-right: 6px;
}

#commentsTabView .newCommentForm textarea {
resize: none;
}

#commentsTabView .comment {
position: relative;
z-index: 1;
Expand Down
8 changes: 6 additions & 2 deletions apps/comments/js/commentstabview.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
'{{/if}}' +
' </div>' +
' <form class="newCommentForm">' +
' <input type="text" class="message" placeholder="{{newMessagePlaceholder}}" value="{{message}}" />' +
' <textarea rows="1" class="message" placeholder="{{newMessagePlaceholder}}">{{message}}</textarea>' +
' <input class="submit icon-confirm" type="submit" value="" />' +
'{{#if isEditMode}}' +
' <input class="cancel pull-right" type="button" value="{{cancelText}}" />' +
Expand Down Expand Up @@ -174,6 +174,8 @@
}
this.delegateEvents();
this.$el.find('.message').on('keydown input change', this._onTypeComment);

autosize(this.$el.find('.newCommentRow textarea'))
},

_formatItem: function(commentModel) {
Expand Down Expand Up @@ -281,6 +283,9 @@
$formRow.find('.avatar').replaceWith($comment.find('.avatar').clone());
$formRow.find('.has-tooltip').tooltip();

// Enable autosize
autosize($formRow.find('textarea'));

return false;
},

Expand Down Expand Up @@ -346,7 +351,6 @@
}
});


return false;
},

Expand Down
2 changes: 1 addition & 1 deletion apps/comments/tests/js/commentstabviewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ describe('OCA.Comments.CommentsTabView tests', function() {
var $formRow = view.$el.find('.newCommentRow.comment[data-id=1]');
expect($formRow.length).toEqual(1);

$formRow.find('input').val('modified message');
$formRow.find('textarea').val('modified message');
$formRow.find('form').submit();

expect(saveStub.calledOnce).toEqual(true);
Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"davclient.js": "https://github.com/evert/davclient.js.git",
"es6-promise": "https://github.com/jakearchibald/es6-promise.git#~2.3.0",
"base64": "~0.3.0",
"clipboard": "^1.5.12"
"clipboard": "^1.5.12",
"autosize": "^3.0.17"
}
}
3 changes: 2 additions & 1 deletion core/js/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"backbone/backbone.js",
"es6-promise/dist/es6-promise.js",
"davclient.js/lib/client.js",
"clipboard/dist/clipboard.js"
"clipboard/dist/clipboard.js",
"autosize/dist/autosize.js"
],
"libraries": [
"jquery-showpassword.js",
Expand Down
7 changes: 7 additions & 0 deletions core/vendor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,10 @@ base64/*min.js
clipboard/**
!clipboard/dist
!clipboard/dist/clipboard.js

# autosize
autosize/**
!autosize/dist
!autosize/dist/autosize.js
!autosize/.bower.json
!autosize/LICENCE.md
40 changes: 40 additions & 0 deletions core/vendor/autosize/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "autosize",
"description": "Autosize is a small, stand-alone script to automatically adjust textarea height to fit text.",
"dependencies": {},
"keywords": [
"textarea",
"form",
"ui"
],
"authors": [
{
"name": "Jack Moore",
"url": "http://www.jacklmoore.com",
"email": "hello@jacklmoore.com"
}
],
"license": "MIT",
"homepage": "http://www.jacklmoore.com/autosize",
"ignore": [],
"repository": {
"type": "git",
"url": "http://github.com/jackmoore/autosize.git"
},
"main": "dist/autosize.js",
"moduleType": [
"amd",
"node"
],
"version": "3.0.17",
"_release": "3.0.17",
"_resolution": {
"type": "version",
"tag": "3.0.17",
"commit": "144040e4f545fbea9b304706a5200eba9961ee3f"
},
"_source": "https://github.com/jackmoore/autosize.git",
"_target": "^3.0.17",
"_originalSource": "autosize",
"_direct": true
}
21 changes: 21 additions & 0 deletions core/vendor/autosize/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Jack Moore

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading