From 90938df96706a4f69a9aaf698e89b77cd9b34b42 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 25 Oct 2013 11:17:11 -0400 Subject: [PATCH] FIX: make it possible to close popup-input-tips on touch devices, and position them a bit better --- .../templates/popup_input_tip.js.handlebars | 2 +- .../discourse/views/popup_input_tip_view.js | 8 ++--- .../{desktop => common}/input_tip.scss | 9 +++--- app/assets/stylesheets/desktop/.gitkeep | 0 app/assets/stylesheets/mobile/.gitkeep | 0 app/assets/stylesheets/mobile/compose.scss | 11 +++---- app/assets/stylesheets/mobile/input_tip.scss | 29 ------------------- 7 files changed, 16 insertions(+), 43 deletions(-) rename app/assets/stylesheets/{desktop => common}/input_tip.scss (79%) delete mode 100644 app/assets/stylesheets/desktop/.gitkeep delete mode 100644 app/assets/stylesheets/mobile/.gitkeep delete mode 100644 app/assets/stylesheets/mobile/input_tip.scss diff --git a/app/assets/javascripts/discourse/templates/popup_input_tip.js.handlebars b/app/assets/javascripts/discourse/templates/popup_input_tip.js.handlebars index 8fa9bc38f55..763b7b99f98 100644 --- a/app/assets/javascripts/discourse/templates/popup_input_tip.js.handlebars +++ b/app/assets/javascripts/discourse/templates/popup_input_tip.js.handlebars @@ -1,2 +1,2 @@ - + {{view.validation.reason}} \ No newline at end of file diff --git a/app/assets/javascripts/discourse/views/popup_input_tip_view.js b/app/assets/javascripts/discourse/views/popup_input_tip_view.js index a1a7ad1c216..c17467a9383 100644 --- a/app/assets/javascripts/discourse/views/popup_input_tip_view.js +++ b/app/assets/javascripts/discourse/views/popup_input_tip_view.js @@ -17,6 +17,10 @@ Discourse.PopupInputTipView = Discourse.View.extend({ bouncePixels: 6, bounceDelay: 100, + click: function(e) { + this.set('shownAt', false); + }, + good: function() { return !this.get('validation.failed'); }.property('validation'), @@ -25,10 +29,6 @@ Discourse.PopupInputTipView = Discourse.View.extend({ return this.get('validation.failed'); }.property('validation'), - hide: function() { - this.set('shownAt', false); - }, - bounce: function() { if( this.get('shownAt') ) { var $elem = this.$(); diff --git a/app/assets/stylesheets/desktop/input_tip.scss b/app/assets/stylesheets/common/input_tip.scss similarity index 79% rename from app/assets/stylesheets/desktop/input_tip.scss rename to app/assets/stylesheets/common/input_tip.scss index e87ff9d49a7..41389bd60aa 100644 --- a/app/assets/stylesheets/desktop/input_tip.scss +++ b/app/assets/stylesheets/common/input_tip.scss @@ -1,5 +1,5 @@ -@import "common/foundation/variables"; -@import "common/foundation/mixins"; +@import "foundation/variables"; +@import "foundation/mixins"; .popup-tip { position: absolute; @@ -16,14 +16,15 @@ &.hide, &.good { display: none; } - a.close { + .close { float: right; color: $black; opacity: 0.5; font-size: 15px; margin-left: 4px; + cursor: pointer; } - a.close:hover { + .close:hover { opacity: 1.0; } } \ No newline at end of file diff --git a/app/assets/stylesheets/desktop/.gitkeep b/app/assets/stylesheets/desktop/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/app/assets/stylesheets/mobile/.gitkeep b/app/assets/stylesheets/mobile/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/app/assets/stylesheets/mobile/compose.scss b/app/assets/stylesheets/mobile/compose.scss index 2da6d56ca30..f57a0ac0c3e 100644 --- a/app/assets/stylesheets/mobile/compose.scss +++ b/app/assets/stylesheets/mobile/compose.scss @@ -279,14 +279,15 @@ display: none; display: inline; } .title-input .popup-tip { - width: 300px; - left: -8px; - margin-top: 8px; + width: 240px; + right: 5px; } .category-input .popup-tip { width: 240px; - left: 432px; - top: -7px; + right: 5px; + } + .textarea-wrapper .popup-tip { + top: 28px; } button.btn.no-text { margin: 7px 0 0 5px; diff --git a/app/assets/stylesheets/mobile/input_tip.scss b/app/assets/stylesheets/mobile/input_tip.scss deleted file mode 100644 index a1eae29b6f8..00000000000 --- a/app/assets/stylesheets/mobile/input_tip.scss +++ /dev/null @@ -1,29 +0,0 @@ -@import "../common/foundation/variables"; -@import "../common/foundation/mixins"; - -.popup-tip { - position: absolute; - display: block; - padding: 5px 10px; - z-index: 101; - @include border-radius-all(2px); - border: solid 1px #955; - &.bad { - background-color: #b66; - color: white; - box-shadow: 1px 1px 5px #777, inset 0 0 9px #b55; - } - &.hide, &.good { - display: none; - } - a.close { - float: right; - color: $black; - opacity: 0.5; - font-size: 15px; - margin-left: 4px; - } - a.close:hover { - opacity: 1.0; - } -} \ No newline at end of file