add show/hide to tooltip

This commit is contained in:
Anaketa 2017-03-10 17:57:18 +01:00 committed by giorgia
parent 63febf391b
commit d7dedc4649
7 changed files with 60 additions and 25 deletions

View File

@ -8,14 +8,14 @@ export default Ember.Component.extend({
classNameBindings: [':btn', 'noText'], classNameBindings: [':btn', 'noText'],
attributeBindings: ['disabled', 'translatedTitle:title'], attributeBindings: ['disabled', 'translatedTitle:title'],
noText: Ember.computed.empty('translatedLabel'), //if translatedLable = null/empty then noText = true noText: Ember.computed.empty('translatedLabel'),
@computed("title") //this.get('title') @computed("title")
translatedTitle(title) { translatedTitle(title) {
if (title) return I18n.t(title); if (title) return I18n.t(title);
}, },
@computed("label")//this.get('label') @computed("label")
translatedLabel(label) { translatedLabel(label) {
if (label) return I18n.t(label); if (label) return I18n.t(label);
}, },

View File

@ -8,6 +8,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
saving: false, saving: false,
deleting: false, deleting: false,
panels: null, panels: null,
hiddenTooltip: true,
_initPanels: function() { _initPanels: function() {
this.set('panels', []); this.set('panels', []);
@ -16,6 +17,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
onShow() { onShow() {
this.changeSize(); this.changeSize();
this.titleChanged(); this.titleChanged();
this.set('hiddenTooltip', true);
}, },
changeSize: function() { changeSize: function() {
@ -101,6 +103,13 @@ export default Ember.Controller.extend(ModalFunctionality, {
self.set('deleting', false); self.set('deleting', false);
} }
}); });
},
toggleDeleteTooltip() {
// check if is touch device
if ( $('html').hasClass('discourse-touch') ) {
this.toggleProperty('hiddenTooltip');
}
} }
} }

View File

@ -30,10 +30,12 @@
{{else}} {{else}}
<div class="disable_info_wrap"> <div class="disable_info_wrap">
{{d-button disabled=deleteDisabled {{d-button disabled=deleteDisabled
class="disable-no-hover"
action="toggleDeleteTooltip"
icon="question-circle" icon="question-circle"
label="category.delete"}} label="category.delete"}}
<div class="cannot_delete_reason"> <div class="cannot_delete_reason {{if hiddenTooltip "hidden" ""}}">
{{{model.cannot_delete_reason}}} {{{model.cannot_delete_reason}}}
</div> </div>
</div> </div>

View File

@ -332,8 +332,34 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.disable_info_wrap {
position: relative;
display: inline-block;
float: right;
.cannot_delete_reason {
position: absolute;
background: dark-light-choose(scale-color($primary, $lightness: 10%), scale-color($secondary, $lightness: 10%));
color: dark-light-choose(scale-color($primary, $lightness: 100%), scale-color($secondary, $lightness: 0%));
text-align: center;
border-radius: 2px;
padding: 12px 8px;
&::after {
top: 100%;
left: 57%;
border: solid transparent;
content: " ";
position: absolute;
border-top-color: dark-light-choose(scale-color($primary, $lightness: 10%), scale-color($secondary, $lightness: 10%));
border-width: 8px;
}
}
}
} }
.incoming-email-modal { .incoming-email-modal {
.btn { .btn {
transition: none; transition: none;

View File

@ -76,3 +76,11 @@
.clickable { .clickable {
cursor: pointer; cursor: pointer;
} }
// Buttons
// ---------------------------------------------------
.disable-no-hover:hover {
background: dark-light-choose(scale-color($primary, $lightness: 90%), scale-color($secondary, $lightness: 60%));;
color: $primary;
}

View File

@ -116,36 +116,20 @@
} }
} }
} }
.disable_info_wrap { .disable_info_wrap {
position: relative;
display: inline-block;
float: right;
margin-top: -70px; margin-top: -70px;
padding-top: 70px; padding-top: 70px;
padding-left: 170px; @media all and (min-width: 550px) {
padding-left: 170px;
}
.cannot_delete_reason { .cannot_delete_reason {
position: absolute;
top: 4px; top: 4px;
right: 4px; right: 4px;
max-width: 380px; max-width: 380px;
min-width: 300px; min-width: 300px;
background: dark-light-choose(scale-color($primary, $lightness: 10%), scale-color($secondary, $lightness: 10%));
color: dark-light-choose(scale-color($primary, $lightness: 100%), scale-color($secondary, $lightness: 0%));
text-align: center;
border-radius: 2px;
padding: 12px 8px;
display: none; display: none;
&::after {
top: 100%;
left: 57%;
border: solid transparent;
content: " ";
position: absolute;
border-top-color: dark-light-choose(scale-color($primary, $lightness: 10%), scale-color($secondary, $lightness: 10%));
border-width: 8px;
}
} }
@include hover { @include hover {

View File

@ -38,7 +38,7 @@
width: 95%; width: 95%;
} }
// we need a little extra room on mobile for the // we need a little extra room on mobile for the
// stuff inside the footer to fit // stuff inside the footer to fit
.modal-footer { .modal-footer {
padding-right: 0; padding-right: 0;
@ -133,6 +133,12 @@
} }
} }
} }
.disable_info_wrap .cannot_delete_reason {
top: -114px;
right: 8px;
min-width: 200px;
}
} }
.tabbed-modal { .tabbed-modal {