Skip to content

Commit

Permalink
Merge pull request #1055 from nextcloud/backport/1051/stable25
Browse files Browse the repository at this point in the history
[stable25] Replace custom tooltips with native tooltips
  • Loading branch information
nickvergessen authored Jan 17, 2023
2 parents 7139838 + 5790f25 commit fe1b262
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 72 deletions.
4 changes: 2 additions & 2 deletions js/activity-adminSettings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/activity-adminSettings.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/activity-dashboard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/activity-dashboard.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/activity-personalSettings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/activity-personalSettings.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/activity-sidebar.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions js/activity-sidebar.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ object-assign

/*! For license information please see NcUserBubble.js.LICENSE.txt */

/*! For license information please see Tooltip.js.LICENSE.txt */

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
Expand Down
2 changes: 1 addition & 1 deletion js/activity-sidebar.js.map

Large diffs are not rendered by default.

17 changes: 2 additions & 15 deletions js/feedSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ $(function() {
var clipboard = new Clipboard('#rssurl .icon-clippy');
clipboard.on('success', function(e) {
$input = $(e.trigger);
$input.tooltip({placement: 'top', trigger: 'manual', title: t('core', 'Copied!')});
$input.tooltip('show');
_.delay(function() {
$input.tooltip('hide');
}, 3000);
OC.Notification.show(t('core', 'Copied!'), {type: 'success'});
});
clipboard.on('error', function (e) {
$input = $(e.trigger);
Expand All @@ -73,16 +69,7 @@ $(function() {
} else {
actionMsg = t('core', 'Press Ctrl-C to copy.');
}

$input.tooltip({
placement: 'top',
trigger: 'manual',
title: actionMsg
});
$input.tooltip('show');
_.delay(function () {
$input.tooltip('hide');
}, 3000);
OC.Notification.show(actionMsg, {type: 'error'});
});

OCA.Activity.FeedSettings.init();
Expand Down
10 changes: 3 additions & 7 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ $(function(){
}

var content = '<div class="section activity-section group" data-date="' + escapeHTML(dayOfYear) + '">' + "\n"
+' <h2>'+"\n"
+' <span class="has-tooltip" title="' + escapeHTML(dateOfDay) + '">' + escapeHTML(displayDate) + '</span>' + "\n"
+' </h2>' + "\n"
+' <h2 aria-label="' + escapeHTML(dateOfDay) + '" title="' + escapeHTML(dateOfDay) + '">' + escapeHTML(displayDate) + '</h2>' + "\n"
+' <div class="boxcontainer">' + "\n"
+' </div>' + "\n"
+'</div>';
Expand Down Expand Up @@ -245,7 +243,8 @@ $(function(){
+ ((activity.link) ? ' </a>' + "\n" : '')
+ ' </div>' + "\n"

+' <span class="activitytime has-tooltip live-relative-timestamp" data-timestamp="' + activity.timestamp + '" title="' + escapeHTML(OC.Util.formatDate(activity.timestamp)) + '">' + "\n"
+' <span class="activitytime live-relative-timestamp" data-timestamp="' + activity.timestamp + '" aria-label="' + escapeHTML(OC.Util.formatDate(activity.timestamp)) + '"'
+ 'title="' + escapeHTML(OC.Util.formatDate(activity.timestamp)) + '">' + "\n"
+ ' ' + escapeHTML(OC.Util.relativeModifiedDate(activity.timestamp)) + "\n"
+' </span>' + "\n";

Expand Down Expand Up @@ -304,9 +303,6 @@ $(function(){
self.processElements($subject);
});

$element.find('.has-tooltip').tooltip({
placement: 'bottom'
});
}
};

Expand Down
14 changes: 7 additions & 7 deletions js/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ templates['file'] = template({"compiler":[8,">= 4.3.0"],"main":function(containe
return undefined
};

return "<a class=\"filename has-tooltip\" href=\""
+ alias4(((helper = (helper = lookupProperty(helpers,"link") || (depth0 != null ? lookupProperty(depth0,"link") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"link","hash":{},"data":data,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":46}}}) : helper)))
return "<a class=\"filename\" href=\""
+ alias4(((helper = (helper = lookupProperty(helpers,"link") || (depth0 != null ? lookupProperty(depth0,"link") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"link","hash":{},"data":data,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":34}}}) : helper)))
+ "\" title=\""
+ alias4(((helper = (helper = lookupProperty(helpers,"title") || (depth0 != null ? lookupProperty(depth0,"title") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":64}}}) : helper)))
+ alias4(((helper = (helper = lookupProperty(helpers,"title") || (depth0 != null ? lookupProperty(depth0,"title") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":52}}}) : helper)))
+ "\">"
+ alias4(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":1,"column":66},"end":{"line":1,"column":74}}}) : helper)))
+ alias4(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":62}}}) : helper)))
+ "</a>\n";
},"useData":true});
templates['fileNoPath'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
Expand All @@ -82,10 +82,10 @@ templates['fileRoot'] = template({"compiler":[8,">= 4.3.0"],"main":function(cont
return undefined
};

return "<a class=\"filename has-tooltip\" href=\""
+ alias4(((helper = (helper = lookupProperty(helpers,"link") || (depth0 != null ? lookupProperty(depth0,"link") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"link","hash":{},"data":data,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":46}}}) : helper)))
return "<a class=\"filename\" href=\""
+ alias4(((helper = (helper = lookupProperty(helpers,"link") || (depth0 != null ? lookupProperty(depth0,"link") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"link","hash":{},"data":data,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":34}}}) : helper)))
+ "\" title=\""
+ alias4(((helper = (helper = lookupProperty(helpers,"homeTXT") || (depth0 != null ? lookupProperty(depth0,"homeTXT") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"homeTXT","hash":{},"data":data,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":66}}}) : helper)))
+ alias4(((helper = (helper = lookupProperty(helpers,"homeTXT") || (depth0 != null ? lookupProperty(depth0,"homeTXT") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"homeTXT","hash":{},"data":data,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":54}}}) : helper)))
+ "\"><span class=\"icon icon-home\"></span></a>\n";
},"useData":true});
templates['openGraph'] = template({"1":function(container,depth0,helpers,partials,data) {
Expand Down
2 changes: 1 addition & 1 deletion js/templates/file.handlebars
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a class="filename has-tooltip" href="{{link}}" title="{{title}}">{{name}}</a>
<a class="filename" href="{{link}}" title="{{title}}">{{name}}</a>
2 changes: 1 addition & 1 deletion js/templates/fileRoot.handlebars
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a class="filename has-tooltip" href="{{link}}" title="{{homeTXT}}"><span class="icon icon-home"></span></a>
<a class="filename" href="{{link}}" title="{{homeTXT}}"><span class="icon icon-home"></span></a>
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"lint:fix": "eslint --ext .js,.vue src --fix",
"stylelint": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue",
"stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue --fix",
"test": "NODE_ENV=test jest --passWithNoTests src/",
"test:coverage": "NODE_ENV=test jest --coverage src/",
"test:update-snapshots": "NODE_ENV=test jest --updateSnapshot"
"test": "TZ=CET NODE_ENV=test jest --passWithNoTests src/",
"test:coverage": "TZ=CET NODE_ENV=test jest --coverage src/",
"test:update-snapshots": "TZ=CET NODE_ENV=test jest --updateSnapshot"
},
"engines": {
"node": "^16.0.0",
Expand Down
6 changes: 1 addition & 5 deletions src/components/Activity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@
<RichText class="activity-entry__content__message" :text="messageText" :arguments="messageArguments" />
</div>

<span v-tooltip.bottom="activity.formattedDate" class="activity-entry__date">{{ dateFromNow }}</span>
<span :title="activity.formattedDate" :aria-label="activity.formattedDate" class="activity-entry__date">{{ dateFromNow }}</span>
</li>
</template>

<script>
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
import NcUserBubble from '@nextcloud/vue/dist/Components/NcUserBubble.js'
import RichText from '@nextcloud/vue-richtext'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'

import ActivityModel from '../models/ActivityModel.js'

Expand All @@ -63,9 +62,6 @@ export default {
NcAvatar,
RichText,
},
directives: {
tooltip: Tooltip,
},
props: {
/**
* The activity to render.
Expand Down
8 changes: 2 additions & 6 deletions src/components/richArgumentsTypes/FileRichArgument.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,16 @@
<template>
<span class="rich-text-file">
<a v-if="!isRoot && parentPathIsRoot" :href="link">{{ name }}</a>
<a v-if="!isRoot && !parentPathIsRoot" v-tooltip.bottom="t('activity', 'in {path}', {path: parentFolder})" :href="link">{{ name }}</a>
<span v-if="isRoot" v-tooltip.bottom="t('activity', 'Home')" class="icon-home" />
<a v-if="!isRoot && !parentPathIsRoot" :title="t('activity', 'in {path}', {path: parentFolder})" :aria-label="t('activity', 'in {path}', {path: parentFolder})" :href="link">{{ name }}</a>
<span v-if="isRoot" :title="t('activity', 'Home')" aria-label="t('activity', 'Home')" class="icon-home" />
</span>
</template>

<script>
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
import { dirname, isSamePath } from '@nextcloud/paths'

export default {
name: 'FileRichArgument',
directives: {
tooltip: Tooltip,
},
props: {
name: {
type: String,
Expand Down
26 changes: 13 additions & 13 deletions src/tests/__snapshots__/Activity.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ exports[`Display correct information for changes 1`] = `
</div>
<div class="activity-entry__content">
<div data-v-a8ade67f="" class="activity-entry__content__subject rich-text--wrapper">
<div data-v-a8ade67f="">You changed <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a href="http://localhost:8080/index.php/f/776">Test file - renamed.md</a> <!----></span></div>
<div data-v-a8ade67f="">You changed <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a title="" aria-label="" href="http://localhost:8080/index.php/f/776">Test file - renamed.md</a> <!----></span></div>
</div>
<div data-v-a8ade67f="" class="activity-entry__content__message rich-text--wrapper">
<div data-v-a8ade67f=""></div>
</div>
</div> <span class="activity-entry__date v-popper--has-tooltip">11 days ago</span>
</div> <span title="April 29, 2021 10:51 AM" aria-label="April 29, 2021 10:51 AM" class="activity-entry__date">11 days ago</span>
</li>
</div>
`;
Expand All @@ -37,7 +37,7 @@ exports[`Display correct information for comments 1`] = `
<div data-v-a8ade67f="" class="activity-entry__content__message rich-text--wrapper">
<div data-v-a8ade67f="">A comment</div>
</div>
</div> <span class="activity-entry__date v-popper--has-tooltip">11 days ago</span>
</div> <span title="April 29, 2021 11:04 AM" aria-label="April 29, 2021 11:04 AM" class="activity-entry__date">11 days ago</span>
</li>
</div>
`;
Expand All @@ -53,12 +53,12 @@ exports[`Display correct information for creations 1`] = `
</div>
<div class="activity-entry__content">
<div data-v-a8ade67f="" class="activity-entry__content__subject rich-text--wrapper">
<div data-v-a8ade67f="">You created <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a href="http://localhost:8080/index.php/f/776">Test file.md</a> <!----></span></div>
<div data-v-a8ade67f="">You created <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a title="" aria-label="" href="http://localhost:8080/index.php/f/776">Test file.md</a> <!----></span></div>
</div>
<div data-v-a8ade67f="" class="activity-entry__content__message rich-text--wrapper">
<div data-v-a8ade67f=""></div>
</div>
</div> <span class="activity-entry__date v-popper--has-tooltip">11 days ago</span>
</div> <span title="April 29, 2021 10:49 AM" aria-label="April 29, 2021 10:49 AM" class="activity-entry__date">11 days ago</span>
</li>
</div>
`;
Expand All @@ -79,7 +79,7 @@ exports[`Display correct information for favorites 1`] = `
<div data-v-a8ade67f="" class="activity-entry__content__message rich-text--wrapper">
<div data-v-a8ade67f=""></div>
</div>
</div> <span class="activity-entry__date v-popper--has-tooltip">11 days ago</span>
</div> <span title="April 29, 2021 10:52 AM" aria-label="April 29, 2021 10:52 AM" class="activity-entry__date">11 days ago</span>
</li>
</div>
`;
Expand All @@ -95,12 +95,12 @@ exports[`Display correct information for moves 1`] = `
</div>
<div class="activity-entry__content">
<div data-v-a8ade67f="" class="activity-entry__content__subject rich-text--wrapper">
<div data-v-a8ade67f="">You moved <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a href="http://localhost:8080/index.php/f/776">Test file.md</a> <!----></span> to <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a href="http://localhost:8080/index.php/f/753">Documents</a> <!----></span></div>
<div data-v-a8ade67f="">You moved <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a title="" aria-label="" href="http://localhost:8080/index.php/f/776">Test file.md</a> <!----></span> to <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a title="" aria-label="" href="http://localhost:8080/index.php/f/753">Documents</a> <!----></span></div>
</div>
<div data-v-a8ade67f="" class="activity-entry__content__message rich-text--wrapper">
<div data-v-a8ade67f=""></div>
</div>
</div> <span class="activity-entry__date v-popper--has-tooltip">11 days ago</span>
</div> <span title="April 29, 2021 10:49 AM" aria-label="April 29, 2021 10:49 AM" class="activity-entry__date">11 days ago</span>
</li>
</div>
`;
Expand All @@ -116,12 +116,12 @@ exports[`Display correct information for renames 1`] = `
</div>
<div class="activity-entry__content">
<div data-v-a8ade67f="" class="activity-entry__content__subject rich-text--wrapper">
<div data-v-a8ade67f="">You renamed <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a href="http://localhost:8080/index.php/f/776">Test file - renamed.md</a> <!----></span> to <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a href="http://localhost:8080/index.php/f/776">Test file - renamed - looooooooong.md</a> <!----></span></div>
<div data-v-a8ade67f="">You renamed <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a title="" aria-label="" href="http://localhost:8080/index.php/f/776">Test file - renamed.md</a> <!----></span> to <span data-v-a8ade67f="" class="rich-text-file rich-text--component"><!----> <a title="" aria-label="" href="http://localhost:8080/index.php/f/776">Test file - renamed - looooooooong.md</a> <!----></span></div>
</div>
<div data-v-a8ade67f="" class="activity-entry__content__message rich-text--wrapper">
<div data-v-a8ade67f=""></div>
</div>
</div> <span class="activity-entry__date v-popper--has-tooltip">11 days ago</span>
</div> <span title="April 29, 2021 11:12 AM" aria-label="April 29, 2021 11:12 AM" class="activity-entry__date">11 days ago</span>
</li>
</div>
`;
Expand All @@ -142,7 +142,7 @@ exports[`Display correct information for shares 1`] = `
<div data-v-a8ade67f="" class="activity-entry__content__message rich-text--wrapper">
<div data-v-a8ade67f=""></div>
</div>
</div> <span class="activity-entry__date v-popper--has-tooltip">11 days ago</span>
</div> <span title="April 29, 2021 10:49 AM" aria-label="April 29, 2021 10:49 AM" class="activity-entry__date">11 days ago</span>
</li>
</div>
`;
Expand All @@ -163,7 +163,7 @@ exports[`Display correct information for tags 1`] = `
<div data-v-a8ade67f="" class="activity-entry__content__message rich-text--wrapper">
<div data-v-a8ade67f=""></div>
</div>
</div> <span class="activity-entry__date v-popper--has-tooltip">11 days ago</span>
</div> <span title="April 29, 2021 10:50 AM" aria-label="April 29, 2021 10:50 AM" class="activity-entry__date">11 days ago</span>
</li>
</div>
`;
Expand All @@ -184,7 +184,7 @@ exports[`Display correct information for unfavorites 1`] = `
<div data-v-a8ade67f="" class="activity-entry__content__message rich-text--wrapper">
<div data-v-a8ade67f=""></div>
</div>
</div> <span class="activity-entry__date v-popper--has-tooltip">11 days ago</span>
</div> <span title="April 29, 2021 10:52 AM" aria-label="April 29, 2021 10:52 AM" class="activity-entry__date">11 days ago</span>
</li>
</div>
`;

0 comments on commit fe1b262

Please sign in to comment.