mirror of
https://github.com/documize/community.git
synced 2025-07-28 01:29:43 +02:00
tooltips
This commit is contained in:
parent
c4dfa42087
commit
9259bf0c99
5 changed files with 254 additions and 205 deletions
|
@ -11,12 +11,13 @@
|
||||||
|
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import netUtil from '../../utils/net';
|
import netUtil from '../../utils/net';
|
||||||
|
import TooltipMixin from '../../mixins/tooltip';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
inject: { service }
|
inject: { service }
|
||||||
} = Ember;
|
} = Ember;
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend(TooltipMixin, {
|
||||||
folderService: service('folder'),
|
folderService: service('folder'),
|
||||||
folder: null,
|
folder: null,
|
||||||
appMeta: service(),
|
appMeta: service(),
|
||||||
|
@ -51,6 +52,17 @@ export default Ember.Component.extend({
|
||||||
this.set('view.search', (route === 'search') ? true : false);
|
this.set('view.search', (route === 'search') ? true : false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
didRender() {
|
||||||
|
if (this.get('session.isAdmin')) {
|
||||||
|
this.addTooltip(document.getElementById("workspace-settings"));
|
||||||
|
}
|
||||||
|
if (this.get("session.authenticated")) {
|
||||||
|
this.addTooltip(document.getElementById("workspace-logout"));
|
||||||
|
} else {
|
||||||
|
this.addTooltip(document.getElementById("workspace-login"));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
switchAccount(domain) {
|
switchAccount(domain) {
|
||||||
this.audit.record('switched-account');
|
this.audit.record('switched-account');
|
||||||
|
|
|
@ -20,20 +20,20 @@ export default Ember.Component.extend({
|
||||||
let temp = _.groupBy(results, 'documentId');
|
let temp = _.groupBy(results, 'documentId');
|
||||||
let documents = [];
|
let documents = [];
|
||||||
|
|
||||||
_.each(temp, function(document) {
|
_.each(temp, function (document) {
|
||||||
let refs = [];
|
let refs = [];
|
||||||
|
|
||||||
if (document.length > 1) {
|
if (document.length > 1) {
|
||||||
refs = document.slice(1);
|
refs = document.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(refs, function(ref, index) {
|
_.each(refs, function (ref, index) {
|
||||||
ref.comma = index === refs.length-1 ? "" : ", ";
|
ref.comma = index === refs.length - 1 ? "" : ", ";
|
||||||
});
|
});
|
||||||
|
|
||||||
let hasRefs = refs.length > 0;
|
let hasRefs = refs.length > 0;
|
||||||
|
|
||||||
documents.pushObject( {
|
documents.pushObject({
|
||||||
doc: document[0],
|
doc: document[0],
|
||||||
ref: refs,
|
ref: refs,
|
||||||
hasReferences: hasRefs
|
hasReferences: hasRefs
|
||||||
|
@ -45,7 +45,6 @@ export default Ember.Component.extend({
|
||||||
if (results.length > 0) {
|
if (results.length > 0) {
|
||||||
let references = results.length === 1 ? "reference" : "references";
|
let references = results.length === 1 ? "reference" : "references";
|
||||||
let i = results.length;
|
let i = results.length;
|
||||||
let j = documents.length;
|
|
||||||
phrase = `${i} ${references}`;
|
phrase = `${i} ${references}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
text-align: left;
|
text-align: left;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
@extend .z-depth-1;
|
@extend .z-depth-1;
|
||||||
|
z-index: 999;
|
||||||
|
|
||||||
> .message {
|
> .message {
|
||||||
margin: 3px 0;
|
margin: 3px 0;
|
||||||
|
|
|
@ -3,23 +3,32 @@
|
||||||
.tooltip-element {
|
.tooltip-element {
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
&:after, &:before {
|
|
||||||
|
&:after,
|
||||||
|
&:before {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
&:after, &:before {
|
|
||||||
|
&:after,
|
||||||
|
&:before {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
&.tooltip-open {
|
&.tooltip-open {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-theme-arrows {
|
&.tooltip-theme-arrows {
|
||||||
|
z-index: 999;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
|
|
||||||
.tooltip-content {
|
.tooltip-content {
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -29,6 +38,7 @@
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
line-height: 1.1em;
|
line-height: 1.1em;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: "";
|
content: "";
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -40,8 +50,10 @@
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-bottom.tooltip-element-attached-center .tooltip-content {
|
&.tooltip-element-attached-bottom.tooltip-element-attached-center .tooltip-content {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
top: 100%;
|
top: 100%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
@ -49,8 +61,10 @@
|
||||||
border-top-color: $color-tooltip;
|
border-top-color: $color-tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-top.tooltip-element-attached-center .tooltip-content {
|
&.tooltip-element-attached-top.tooltip-element-attached-center .tooltip-content {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
bottom: 100%;
|
bottom: 100%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
@ -58,8 +72,10 @@
|
||||||
border-bottom-color: $color-tooltip;
|
border-bottom-color: $color-tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-right.tooltip-element-attached-middle .tooltip-content {
|
&.tooltip-element-attached-right.tooltip-element-attached-middle .tooltip-content {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
left: 100%;
|
left: 100%;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
@ -67,8 +83,10 @@
|
||||||
border-left-color: $color-tooltip;
|
border-left-color: $color-tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-left.tooltip-element-attached-middle .tooltip-content {
|
&.tooltip-element-attached-left.tooltip-element-attached-middle .tooltip-content {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
right: 100%;
|
right: 100%;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
@ -76,17 +94,21 @@
|
||||||
border-right-color: $color-tooltip;
|
border-right-color: $color-tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-top {
|
&.tooltip-element-attached-top {
|
||||||
&.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content {
|
&.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
bottom: 100%;
|
bottom: 100%;
|
||||||
left: 8px;
|
left: 8px;
|
||||||
border-bottom-color: $color-tooltip;
|
border-bottom-color: $color-tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-right.tooltip-target-attached-bottom .tooltip-content {
|
&.tooltip-element-attached-right.tooltip-target-attached-bottom .tooltip-content {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
bottom: 100%;
|
bottom: 100%;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
|
@ -94,17 +116,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-bottom {
|
&.tooltip-element-attached-bottom {
|
||||||
&.tooltip-element-attached-left.tooltip-target-attached-top .tooltip-content {
|
&.tooltip-element-attached-left.tooltip-target-attached-top .tooltip-content {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
top: 100%;
|
top: 100%;
|
||||||
left: 8px;
|
left: 8px;
|
||||||
border-top-color: $color-tooltip;
|
border-top-color: $color-tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-right.tooltip-target-attached-top .tooltip-content {
|
&.tooltip-element-attached-right.tooltip-target-attached-top .tooltip-content {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
top: 100%;
|
top: 100%;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
|
@ -112,17 +138,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-top {
|
&.tooltip-element-attached-top {
|
||||||
&.tooltip-element-attached-right.tooltip-target-attached-left .tooltip-content {
|
&.tooltip-element-attached-right.tooltip-target-attached-left .tooltip-content {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
top: 8px;
|
top: 8px;
|
||||||
left: 100%;
|
left: 100%;
|
||||||
border-left-color: $color-tooltip;
|
border-left-color: $color-tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-left.tooltip-target-attached-right .tooltip-content {
|
&.tooltip-element-attached-left.tooltip-target-attached-right .tooltip-content {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
top: 8px;
|
top: 8px;
|
||||||
right: 100%;
|
right: 100%;
|
||||||
|
@ -130,17 +160,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-bottom {
|
&.tooltip-element-attached-bottom {
|
||||||
&.tooltip-element-attached-right.tooltip-target-attached-left .tooltip-content {
|
&.tooltip-element-attached-right.tooltip-target-attached-left .tooltip-content {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
bottom: 8px;
|
bottom: 8px;
|
||||||
left: 100%;
|
left: 100%;
|
||||||
border-left-color: $color-tooltip;
|
border-left-color: $color-tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-element-attached-left.tooltip-target-attached-right .tooltip-content {
|
&.tooltip-element-attached-left.tooltip-target-attached-right .tooltip-content {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
bottom: 8px;
|
bottom: 8px;
|
||||||
right: 100%;
|
right: 100%;
|
||||||
|
@ -149,14 +183,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
||||||
.tooltip-content {
|
.tooltip-content {
|
||||||
padding: 0.5em 1em;
|
padding: 0.5em 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
&.tooltip-open-transitionend {
|
&.tooltip-open-transitionend {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tooltip-after-open {
|
&.tooltip-after-open {
|
||||||
transition: opacity 600ms 400ms;
|
transition: opacity 600ms 400ms;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
|
@ -29,14 +29,14 @@
|
||||||
|
|
||||||
<ul class="bottom-zone">
|
<ul class="bottom-zone">
|
||||||
{{#if session.session.content.authenticated.user.admin}}
|
{{#if session.session.content.authenticated.user.admin}}
|
||||||
<li class="{{if view.settings 'selected'}}">
|
<li id="workspace-settings" class="{{if view.settings 'selected'}}" data-tooltip="Settings" data-tooltip-position="right center">
|
||||||
{{#link-to 'customize.general'}}
|
{{#link-to 'customize.general'}}
|
||||||
<i class="material-icons icon-tool">tune</i>
|
<i class="material-icons icon-tool">tune</i>
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if session.authenticated}}
|
{{#if session.authenticated}}
|
||||||
<li>
|
<li id="workspace-logout" data-tooltip="Logout" data-tooltip-position="right center">
|
||||||
{{#link-to 'auth.logout'}}
|
{{#link-to 'auth.logout'}}
|
||||||
<i class="material-icons icon-tool">exit_to_app</i>
|
<i class="material-icons icon-tool">exit_to_app</i>
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
{{else}}
|
{{else}}
|
||||||
<li>
|
<li id="workspace-login" data-tooltip="Login" data-tooltip-position="right center">
|
||||||
{{#link-to 'auth.login'}}
|
{{#link-to 'auth.login'}}
|
||||||
<i class="material-icons icon-tool">lock_open</i>
|
<i class="material-icons icon-tool">lock_open</i>
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue