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",
|
||||
|
||||
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');
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ createWidget('topic-admin-menu-button', {
|
|||
if (state.expanded) {
|
||||
result.push(this.attach('topic-admin-menu', { position: state.position,
|
||||
fixed: attrs.fixed,
|
||||
topic: attrs.topic }));
|
||||
topic: attrs.topic,
|
||||
openUpwards: attrs.openUpwards }));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -71,7 +72,12 @@ export default createWidget('topic-admin-menu', {
|
|||
const { top, left } = attrs.position;
|
||||
const position = attrs.fixed ? 'fixed' : 'absolute';
|
||||
|
||||
return { style: `position: ${position}; top: ${top}px; left: ${left}px;` };
|
||||
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;` };
|
||||
}
|
||||
},
|
||||
|
||||
html(attrs) {
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
|
||||
ul.dropdown-menu {
|
||||
right: 0.5em;
|
||||
top: 23px;
|
||||
bottom: auto;
|
||||
top: auto;
|
||||
bottom: 25px;
|
||||
left: auto;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue