Skip to content

Commit

Permalink
quick fix on popup animation ghost
Browse files Browse the repository at this point in the history
  • Loading branch information
santisiri committed Oct 31, 2017
1 parent de8d0f2 commit dd852b4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
3 changes: 2 additions & 1 deletion i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,5 +461,6 @@
"you": "You",
"all-members": "Other Members",
"your-delegations": "Your Delegations",
"unlogged-cant-vote": "You need to be logged in to vote."
"unlogged-cant-vote": "You need to be logged in to vote.",
"email-recovery-instructions": "Password reset instructions will be sent to the Email used to register an account."
}
1 change: 0 additions & 1 deletion imports/ui/modules/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ const _animate = (display, id) => {
$(divId).css('opacity', '0');
$(divId).velocity({ opacity: 1 }, { duration: (animationSettings.duration / 2) });
} else {
console.log('HIDE IT');
$(divId).css('opacity', '1');
$(divId).velocity({ opacity: 0 }, {
duration: (animationSettings.duration / 2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export default class ForgotPassword extends Component {
<input id="recovery-email" type="text" placeholder={TAPi18n.__('email-sample')} className="w-input login-input" />
{warning}
</div>
<div className="w-clearfix login-field">
{TAPi18n.__('email-recovery-instructions')}
</div>
<div type="submit" id="recovery-button" className="button login-button" onClick={this.handleSubmit}>
<div>{TAPi18n.__('continue-password-recovery')}</div>
</div>
Expand Down
18 changes: 2 additions & 16 deletions imports/ui/templates/widgets/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,22 @@ import { animationSettings } from '/imports/ui/modules/animation';
import './popup.html';

function autoPosition(height) {
console.log('TEST - autoPosition()');
const screenH = $(window).height();
let pos = parseInt(((screenH - height) / 2) - 10, 10);
if (pos <= 70) {
console.log('TEST - pos <=70');
pos = 70;
}
console.log('TEST - pos: ', pos);
return pos;
}

Template.popup.onRendered(() => {
console.log('TEST - onRendered()');
$(`#card-${Template.instance().data.id}`).attr('legacyheight', $(`#card-${Template.instance().data.id}`)[0].getBoundingClientRect().height);
$(`#card-${Template.instance().data.id}`).resize(function () {
if (Meteor.Device.isPhone()) {
const divId = `#${this.id}`;
console.log('TEST - divId: ', divId);
if (!$(divId).is('.velocity-animating')) {
console.log('TEST - invoke autoPosition from onRendered');
if (!$(divId).is('.velocity-animating') && divId !== '#login-null') {
const newMargin = autoPosition($(divId)[0].getBoundingClientRect().height);
const newHeight = $(divId)[0].getBoundingClientRect().height;
// $(divId).css('height', $(divId).attr('legacyheight'));
$(divId).velocity({ marginTop: newMargin }, { duration: animationSettings.duration, easing: 'ease-out' });
Meteor.setTimeout(function () {
$(divId).velocity('stop');
Expand All @@ -53,11 +46,7 @@ Template.popup.helpers({
return Meteor.Device.isPhone();
},
modalPosition() {
console.log('TEST - modalPosition()');
if (Session.get(this.id).position.height) {
console.log('TEST - true IF in modalPosition()');
console.log('TEST - this.id ', this.id);
console.log('TEST - invoke autoPosition from modalPosition');
return `margin-top: ${autoPosition($(`#card-${this.id}`)[0].getBoundingClientRect().height)}px;`;
}
return '';
Expand All @@ -71,10 +60,7 @@ Template.popup.events({
animatePopup(false, this.id);
}
},
'click .modal'(event) {
console.log('click');
console.log(event.target.id);
console.log(this.id);
'mousedown .modal'(event) {
event.stopPropagation();
if (event.target.id === this.id) {
animatePopup(false, this.id);
Expand Down

1 comment on commit dd852b4

@medied
Copy link
Member

@medied medied commented on dd852b4 Oct 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌🏽

Please sign in to comment.