fix hovercard aspect selectio z-index by moving it out of the stream element
- create handlebars template for hovercards - fix notifications-dropdown (workaround) to remain open when aspect selector is clicked
This commit is contained in:
parent
6df79f6983
commit
36e92b322f
7 changed files with 45 additions and 31 deletions
|
|
@ -23,6 +23,7 @@
|
||||||
* Set sharing notification as read when viewing profile [#5009](https://github.com/diaspora/diaspora/pull/5009)
|
* Set sharing notification as read when viewing profile [#5009](https://github.com/diaspora/diaspora/pull/5009)
|
||||||
* Ensure a consistent border on text input elements [#5069](https://github.com/diaspora/diaspora/pull/5069)
|
* Ensure a consistent border on text input elements [#5069](https://github.com/diaspora/diaspora/pull/5069)
|
||||||
* Escape person name in contacts json returned by Conversations#new
|
* Escape person name in contacts json returned by Conversations#new
|
||||||
|
* Make sure all parts of the hovercard are always in front [#5188](https://github.com/diaspora/diaspora/pull/5188)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* Port admin pages to bootstrap, polish user search results, allow accounts to be closed from the backend [#5046](https://github.com/diaspora/diaspora/pull/5046)
|
* Port admin pages to bootstrap, polish user search results, allow accounts to be closed from the backend [#5046](https://github.com/diaspora/diaspora/pull/5046)
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,23 @@
|
||||||
|
|
||||||
app.views.Hovercard = Backbone.View.extend({
|
app.views.Hovercard = app.views.Base.extend({
|
||||||
el: '#hovercard_container',
|
templateName: 'hovercard',
|
||||||
|
id: 'hovercard_container',
|
||||||
|
|
||||||
|
events: {
|
||||||
|
'mouseleave': '_mouseleaveHandler'
|
||||||
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
this.render();
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.on('mouseenter', '.hovercardable', _.bind(this._mouseenterHandler, this))
|
.on('mouseenter', '.hovercardable', _.bind(this._mouseenterHandler, this))
|
||||||
.on('mouseleave', '.hovercardable', _.bind(this._mouseleaveHandler, this));
|
.on('mouseleave', '.hovercardable', _.bind(this._mouseleaveHandler, this));
|
||||||
|
|
||||||
this.show_me = false;
|
this.show_me = false;
|
||||||
|
this.parent = null; // current 'hovercarable' element that caused HC to appear
|
||||||
|
|
||||||
|
// cache some element references
|
||||||
this.avatar = this.$('.avatar');
|
this.avatar = this.$('.avatar');
|
||||||
this.dropdown = this.$('.dropdown_list');
|
this.dropdown = this.$('.dropdown_list');
|
||||||
this.dropdown_container = this.$('#hovercard_dropdown_container');
|
this.dropdown_container = this.$('#hovercard_dropdown_container');
|
||||||
|
|
@ -18,16 +27,22 @@ app.views.Hovercard = Backbone.View.extend({
|
||||||
this.active = true;
|
this.active = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
postRenderTemplate: function() {
|
||||||
|
this.$el.appendTo($('body'))
|
||||||
|
},
|
||||||
|
|
||||||
deactivate: function() {
|
deactivate: function() {
|
||||||
this.active = false;
|
this.active = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
href: function() {
|
href: function() {
|
||||||
return this.$el.parent().attr('href');
|
return this.parent.attr('href');
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseenterHandler: function(event) {
|
_mouseenterHandler: function(event) {
|
||||||
if(this.active == false) { return false }
|
if( this.active == false ||
|
||||||
|
$.contains(this.el, event.target) ) { return false; }
|
||||||
|
|
||||||
var el = $(event.target);
|
var el = $(event.target);
|
||||||
if( !el.is('a') ) {
|
if( !el.is('a') ) {
|
||||||
el = el.parents('a');
|
el = el.parents('a');
|
||||||
|
|
@ -44,7 +59,9 @@ app.views.Hovercard = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseleaveHandler: function(event) {
|
_mouseleaveHandler: function(event) {
|
||||||
if(this.active == false) { return false }
|
if( this.active == false ||
|
||||||
|
$.contains(this.el, event.relatedTarget) ) { return false; }
|
||||||
|
|
||||||
this.show_me = false;
|
this.show_me = false;
|
||||||
if( this.$el.is(':visible') ) {
|
if( this.$el.is(':visible') ) {
|
||||||
this.$el.fadeOut('fast');
|
this.$el.fadeOut('fast');
|
||||||
|
|
@ -66,10 +83,10 @@ app.views.Hovercard = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
hc.hide();
|
hc.hide();
|
||||||
hc.prependTo(el);
|
this.parent = el;
|
||||||
this._positionHovercard();
|
this._positionHovercard();
|
||||||
this._populateHovercard();
|
this._populateHovercard();
|
||||||
}, 500),
|
}, 700),
|
||||||
|
|
||||||
_populateHovercard: function() {
|
_populateHovercard: function() {
|
||||||
var href = this.href();
|
var href = this.href();
|
||||||
|
|
@ -114,9 +131,8 @@ app.views.Hovercard = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_positionHovercard: function() {
|
_positionHovercard: function() {
|
||||||
var p = this.$el.parent();
|
var p_pos = this.parent.offset();
|
||||||
var p_pos = p.position();
|
var p_height = this.parent.height();
|
||||||
var p_height = p.height();
|
|
||||||
|
|
||||||
this.$el.css({
|
this.$el.css({
|
||||||
top: p_pos.top + p_height - 25,
|
top: p_pos.top + p_height - 25,
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,9 @@
|
||||||
|
|
||||||
self.documentBody.click(function(evt) {
|
self.documentBody.click(function(evt) {
|
||||||
var inDropdown = $(evt.target).parents().is(self.dropdown);
|
var inDropdown = $(evt.target).parents().is(self.dropdown);
|
||||||
|
var inHovercard = $.contains(app.hovercard.el, evt.target);
|
||||||
|
|
||||||
if(!inDropdown && self.dropdownShowing()) {
|
if(!inDropdown && !inHovercard && self.dropdownShowing()) {
|
||||||
self.badgeLink.click();
|
self.badgeLink.click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@
|
||||||
#hovercard_container {
|
#hovercard_container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: none;
|
display: none;
|
||||||
z-index: 10;
|
z-index: 2000;
|
||||||
|
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
|
|
|
||||||
|
|
@ -67,23 +67,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="hovercard_container">
|
|
||||||
<div id="hovercard">
|
|
||||||
<img class="avatar">
|
|
||||||
<h4>
|
|
||||||
<a class="person"></a>
|
|
||||||
</h4>
|
|
||||||
<div class="handle"></div>
|
|
||||||
<div id="hovercard_dropdown_container"></div>
|
|
||||||
<div class="hovercard_footer">
|
|
||||||
<div class="footer_container">
|
|
||||||
<div class="hashtags"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul class="dropdown" id="user_menu">
|
<ul class="dropdown" id="user_menu">
|
||||||
<li class="user-menu-trigger">
|
<li class="user-menu-trigger">
|
||||||
<div class="user-menu-more-indicator">
|
<div class="user-menu-more-indicator">
|
||||||
|
|
|
||||||
13
app/assets/templates/hovercard_tpl.jst.hbs
Normal file
13
app/assets/templates/hovercard_tpl.jst.hbs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<div id="hovercard">
|
||||||
|
<img class="avatar">
|
||||||
|
<h4>
|
||||||
|
<a class="person"></a>
|
||||||
|
</h4>
|
||||||
|
<div class="handle"></div>
|
||||||
|
<div id="hovercard_dropdown_container"></div>
|
||||||
|
<div class="hovercard_footer">
|
||||||
|
<div class="footer_container">
|
||||||
|
<div class="hashtags"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -3,7 +3,7 @@ When(/^I activate the first hovercard$/) do
|
||||||
end
|
end
|
||||||
|
|
||||||
Then(/^I should see a hovercard$/) do
|
Then(/^I should see a hovercard$/) do
|
||||||
page.should have_css('#hovercard')
|
page.should have_css('#hovercard', visible: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
When(/^I deactivate the first hovercard$/) do
|
When(/^I deactivate the first hovercard$/) do
|
||||||
|
|
@ -11,7 +11,7 @@ When(/^I deactivate the first hovercard$/) do
|
||||||
end
|
end
|
||||||
|
|
||||||
Then(/^I should not see a hovercard$/) do
|
Then(/^I should not see a hovercard$/) do
|
||||||
page.should_not have_css('#hovercard')
|
page.should_not have_css('#hovercard', visible: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
When (/^I hover "([^"]*)" within "([^"]*)"$/) do |name, selector|
|
When (/^I hover "([^"]*)" within "([^"]*)"$/) do |name, selector|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue