Skip to content

Commit

Permalink
fix-all-modals-crpper
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinchauhan2889 committed Oct 24, 2020
1 parent c0ea0a5 commit 14f6b47
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 16 deletions.
89 changes: 79 additions & 10 deletions app/components/modals/modal-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,50 @@ import { isTesting } from 'open-event-frontend/utils/testing';

export default UiModal.extend({
tagName : 'div',
classNameBindings : ['isFullScreen:fullscreen', 'isSmall:small', 'isLarge:large', 'noCropper'],
classNames : ['centered-modal'],
classNameBindings : ['isFullScreen:fullscreen', 'isSmall:small', 'isLarge:large'],

openObserver: observer('isOpen', 'noCroppper', function() {
openObserver: observer('isOpen', function() {
const $element = $(this.element);
if (this.isOpen) {
if (this.noCropper) {
$element.modal({
centered: false
}).modal('show');
} else {
$element.modal('show');
}
$element.modal({
centered : false,
duration : isTesting ? 0 : 200,
dimmerSettings : {
dimmerName : `${this.elementId}-modal-dimmer`,
variation : 'inverted'
},
onHide: () => {
this.set('isOpen', false);
if (this.onHide) {
this.onHide();
}
},
onDeny: () => {
if (this.onDeny) {
this.onDeny();
}
return true;
},
onApprove: () => {
if (this.onApprove) {
this.onApprove();
}
return true;
},

onVisible: () => {
this.set('isOpen', true);
const $element = $(this.element);
$element.modal('refresh');
$element.find('[data-content]').popup({
inline: true
});
if (this.onVisible) {
this.onVisible();
}
}
}).modal('show');
} else {
$element.modal('hide');
}
Expand Down Expand Up @@ -97,7 +129,44 @@ export default UiModal.extend({

didInitSemantic() {
if (this.isOpen) {
$(this.element).modal('show');
$(this.element).modal({
centered : false,
duration : isTesting ? 0 : 200,
dimmerSettings : {
dimmerName : `${this.elementId}-modal-dimmer`,
variation : 'inverted'
},
onHide: () => {
this.set('isOpen', false);
if (this.onHide) {
this.onHide();
}
},
onDeny: () => {
if (this.onDeny) {
this.onDeny();
}
return true;
},
onApprove: () => {
if (this.onApprove) {
this.onApprove();
}
return true;
},

onVisible: () => {
this.set('isOpen', true);
const $element = $(this.element);
$element.modal('refresh');
$element.find('[data-content]').popup({
inline: true
});
if (this.onVisible) {
this.onVisible();
}
}
}).modal('show');
}
}
});
1 change: 0 additions & 1 deletion app/components/modals/session-notify-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default class SessionNotifyModal extends ModalBase {
constructor() {
super(...arguments);
this.noCropper = true;
this.initialize();
}
Expand Down
3 changes: 0 additions & 3 deletions app/components/modals/tax-info-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import { orderBy } from 'lodash-es';

export default ModalBase.extend(FormMixin, {
isSmall : false,
options : {
closable: false
},

autoScrollToErrors : true,
isTaxIncludedInPrice : 'include',
Expand Down
4 changes: 2 additions & 2 deletions app/styles/partials/overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ body.dimmable.undetached.dimmed {
}
}

.no-cropper {
.centered-modal {
margin-left: auto !important;
margin-top: 50px !important;
margin-top: auto !important;
}
1 change: 1 addition & 0 deletions app/templates/components/modals/tax-info-modal.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<i class="black close icon"></i>
<div class="header">
{{t 'Add tax information'}}
</div>
Expand Down

0 comments on commit 14f6b47

Please sign in to comment.