UX: fix post admin menu positioning & closing on mobile

This commit is contained in:
Régis Hanol 2014-10-13 22:38:22 +02:00
parent d926cc13ac
commit d70bb0e58b
4 changed files with 13 additions and 15 deletions

View File

@ -304,9 +304,12 @@ export default Discourse.View.extend({
}, },
clickAdmin: function() { clickAdmin: function() {
var $adminMenu = this.$('.post-admin-menu'); var $postAdminMenu = this.$(".post-admin-menu");
this.set('adminMenu', $adminMenu); $postAdminMenu.show();
$adminMenu.show(); $("html").on("mouseup.post-admin-menu", function() {
$postAdminMenu.hide();
$("html").off("mouseup.post-admin-menu");
});
}, },
clickToggleWiki: function() { clickToggleWiki: function() {

View File

@ -52,12 +52,6 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, {
if (this.get('controller.multiSelect') && (e.metaKey || e.ctrlKey)) { if (this.get('controller.multiSelect') && (e.metaKey || e.ctrlKey)) {
this.get('controller').toggledSelectedPost(this.get('post')); this.get('controller').toggledSelectedPost(this.get('post'));
} }
var $adminMenu = this.get('adminMenu');
if ($adminMenu && !$(e.target).is($adminMenu)) {
$adminMenu.hide();
this.set('adminMenu', null);
}
}, },
selected: function() { selected: function() {

View File

@ -206,8 +206,8 @@ nav.post-controls {
border: 1px solid scale-color-diff(); border: 1px solid scale-color-diff();
position: absolute; position: absolute;
text-align: left; text-align: left;
bottom: 0; bottom: -2px;
right: 0; right: 15px;
z-index: 1000; z-index: 1000;
display: none; display: none;

View File

@ -77,12 +77,13 @@ button {
border: 1px solid scale-color-diff(); border: 1px solid scale-color-diff();
position: absolute; position: absolute;
text-align: left; text-align: left;
bottom: -26px; bottom: 0;
left: 0; left: 135px;
z-index: 1000; z-index: 1000;
display: none; display: none;
h3 { h3 {
margin-top: 0;
color: $primary; color: $primary;
font-size: 1em; font-size: 1em;
} }
@ -140,6 +141,7 @@ a.star {
padding-top: 5px; padding-top: 5px;
padding-bottom: 0px; padding-bottom: 0px;
clear: both; clear: both;
position: relative;
} }
.topic-map { .topic-map {
@ -446,8 +448,7 @@ blockquote > *:last-child {
.gutter { display: none; } .gutter { display: none; }
.posts-wrapper { position: relative; .posts-wrapper { position: relative; }
}
.topic-body.highlighted { .topic-body.highlighted {
background-color: scale-color($tertiary, $lightness: 75%); background-color: scale-color($tertiary, $lightness: 75%);