-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Fixes the usability issues with the comment section delete and edit #7800
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
facd1ca
Fixes issue where saving a non-modified comment kept the edit window …
Abijeet b3e1026
Fixes div being added placed directly under ul during editing of comm…
Abijeet 61b38a1
Fixes the following UI issues,
Abijeet 001cd98
Converts the css file to scss file, and adds border-top to comments.
Abijeet 872853a
Moves the edit and delete options into a dropdown menu.
Abijeet 6d2716d
Added ellipsis for longer usernames.
Abijeet 01c5a31
Adds a tooltip for the submit / save button in comments.
Abijeet 18096f5
Disabled comment changes opacity only for message text.
Abijeet 16bf932
Fixing failing test cases due to change in functionality.
Abijeet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| /* | ||
| * Copyright (c) 2018 | ||
| * | ||
| * This file is licensed under the Affero General Public License version 3 | ||
| * or later. | ||
| * | ||
| * See the COPYING-README file. | ||
| * | ||
| */ | ||
|
|
||
| /* global Handlebars */ | ||
| (function() { | ||
| var TEMPLATE_MENU = | ||
| '<ul>' + | ||
| '{{#each items}}' + | ||
| '<li>' + | ||
| '<a href="#" class="menuitem action {{name}} permanent" data-action="{{name}}">' + | ||
| '{{#if iconClass}}' + | ||
| '<span class="icon {{iconClass}}"></span>' + | ||
| '{{else}}' + | ||
| '<span class="no-icon"></span>' + | ||
| '{{/if}}' + | ||
| '<span>{{displayName}}</span>' + | ||
| '</li>' + | ||
| '{{/each}}' + | ||
| '</ul>'; | ||
|
|
||
| /** | ||
| * Construct a new CommentsModifyMenuinstance | ||
| * @constructs CommentsModifyMenu | ||
| * @memberof OC.Comments | ||
| */ | ||
| var CommentsModifyMenu = OC.Backbone.View.extend({ | ||
| tagName: 'div', | ||
| className: 'commentsModifyMenu popovermenu bubble menu', | ||
| _scopes: [ | ||
| { | ||
| name: 'edit', | ||
| displayName: t('comments', 'Edit comment'), | ||
| iconClass: 'icon-rename' | ||
| }, | ||
| { | ||
| name: 'delete', | ||
| displayName: t('comments', 'Delete comment'), | ||
| iconClass: 'icon-delete' | ||
| } | ||
| ], | ||
| initialize: function() { | ||
|
|
||
| }, | ||
| events: { | ||
| 'click a.action': '_onClickAction' | ||
| }, | ||
|
|
||
| template: Handlebars.compile(TEMPLATE_MENU), | ||
|
|
||
| /** | ||
| * Event handler whenever an action has been clicked within the menu | ||
| * | ||
| * @param {Object} event event object | ||
| */ | ||
| _onClickAction: function(event) { | ||
| var $target = $(event.currentTarget); | ||
| if (!$target.hasClass('menuitem')) { | ||
| $target = $target.closest('.menuitem'); | ||
| } | ||
|
|
||
| OC.hideMenus(); | ||
|
|
||
| this.trigger('select:menu-item-clicked', event, $target.data('action')); | ||
| }, | ||
|
|
||
| /** | ||
| * Renders the menu with the currently set items | ||
| */ | ||
| render: function() { | ||
| this.$el.html(this.template({ | ||
| items: this._scopes | ||
| })); | ||
| }, | ||
|
|
||
| /** | ||
| * Displays the menu | ||
| */ | ||
| show: function(context) { | ||
| this._context = context; | ||
|
|
||
| for(var i in this._scopes) { | ||
| this._scopes[i].active = false; | ||
| } | ||
|
|
||
|
|
||
| var $el = $(context.target); | ||
| var offsetIcon = $el.offset(); | ||
| var offsetContainer = $el.closest('.authorRow').offset(); | ||
|
|
||
| // adding some extra top offset to push the menu below the button. | ||
| var position = { | ||
| top: offsetIcon.top - offsetContainer.top + 48, | ||
| left: '', | ||
| right: '' | ||
| }; | ||
|
|
||
| position.left = offsetIcon.left - offsetContainer.left; | ||
|
|
||
| if (position.left > 200) { | ||
| // we need to position the menu to the right. | ||
| position.left = ''; | ||
| position.right = this.$el.closest('.comment').find('.date').width(); | ||
| this.$el.removeClass('menu-left').addClass('menu-right'); | ||
| } else { | ||
| this.$el.removeClass('menu-right').addClass('menu-left'); | ||
| } | ||
| this.$el.css(position); | ||
| this.render(); | ||
| this.$el.removeClass('hidden'); | ||
|
|
||
| OC.showMenu(null, this.$el); | ||
| } | ||
| }); | ||
|
|
||
| OCA.Comments = OCA.Comments || {}; | ||
| OCA.Comments.CommentsModifyMenu = CommentsModifyMenu; | ||
| })(OC, OCA); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes the empty input to have a too big cursor in Safari:
See also this thread https://stackoverflow.com/a/9132362
I could also not figure out how to enforce this without the
display: block;,font-size,line-heightandheightall didn't worked out :/There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the first character is typed all is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MorrisJobke - I'll check this over the weekend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged this and we should fix this little issue in #9150
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got a new laptop and was setting it up. :) This kind of took a back seat.