FIX: Try to be a little smarter about which way topic menus open
This commit is contained in:
parent
6eb87e6f62
commit
8c6274ba88
|
@ -5,6 +5,6 @@ export default MountWidget.extend({
|
||||||
widget: "topic-admin-menu-button",
|
widget: "topic-admin-menu-button",
|
||||||
|
|
||||||
buildArgs() {
|
buildArgs() {
|
||||||
return this.getProperties('topic', 'fixed');
|
return this.getProperties('topic', 'fixed', 'openUpwards');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ export default ContainerView.extend({
|
||||||
const topic = this.get('topic');
|
const topic = this.get('topic');
|
||||||
|
|
||||||
if (!mobileView && this.currentUser.get('staff')) {
|
if (!mobileView && this.currentUser.get('staff')) {
|
||||||
const viewArgs = { topic, delegated: this.get('topicDelegated') };
|
const viewArgs = { topic, delegated: this.get('topicDelegated'), openUpwards: true };
|
||||||
this.attachViewWithArgs(viewArgs, 'topic-admin-menu-button');
|
this.attachViewWithArgs(viewArgs, 'topic-admin-menu-button');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ createWidget('topic-admin-menu-button', {
|
||||||
if (state.expanded) {
|
if (state.expanded) {
|
||||||
result.push(this.attach('topic-admin-menu', { position: state.position,
|
result.push(this.attach('topic-admin-menu', { position: state.position,
|
||||||
fixed: attrs.fixed,
|
fixed: attrs.fixed,
|
||||||
topic: attrs.topic }));
|
topic: attrs.topic,
|
||||||
|
openUpwards: attrs.openUpwards }));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -71,7 +72,12 @@ export default createWidget('topic-admin-menu', {
|
||||||
const { top, left } = attrs.position;
|
const { top, left } = attrs.position;
|
||||||
const position = attrs.fixed ? 'fixed' : 'absolute';
|
const position = attrs.fixed ? 'fixed' : 'absolute';
|
||||||
|
|
||||||
|
if (attrs.openUpwards) {
|
||||||
|
const bottom = $(document).height() - top;
|
||||||
|
return { style: `position: ${position}; bottom: ${bottom}px; left: ${left}px;` };
|
||||||
|
} else {
|
||||||
return { style: `position: ${position}; top: ${top}px; left: ${left}px;` };
|
return { style: `position: ${position}; top: ${top}px; left: ${left}px;` };
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
html(attrs) {
|
html(attrs) {
|
||||||
|
|
|
@ -39,8 +39,8 @@
|
||||||
|
|
||||||
ul.dropdown-menu {
|
ul.dropdown-menu {
|
||||||
right: 0.5em;
|
right: 0.5em;
|
||||||
top: 23px;
|
top: auto;
|
||||||
bottom: auto;
|
bottom: 25px;
|
||||||
left: auto;
|
left: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue