From 6713db71338f70142d36fd05909bc090d7b0d752 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 7 Oct 2013 16:11:37 -0400 Subject: [PATCH] Close notifications dropdown on mobile after you click something --- app/assets/javascripts/discourse/routes/discourse_route.js | 5 ++++- app/assets/javascripts/discourse/routes/topic_route.js | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/routes/discourse_route.js b/app/assets/javascripts/discourse/routes/discourse_route.js index efcb970de..18dd83bd7 100644 --- a/app/assets/javascripts/discourse/routes/discourse_route.js +++ b/app/assets/javascripts/discourse/routes/discourse_route.js @@ -9,7 +9,10 @@ Discourse.Route = Em.Route.extend({ /** - Called every time we enter a route on Discourse. + NOT called every time we enter a route on Discourse. + Only called the FIRST time we enter a route. + So, when going from one topic to another, activate will only be called on the + TopicRoute for the first topic. @method activate **/ diff --git a/app/assets/javascripts/discourse/routes/topic_route.js b/app/assets/javascripts/discourse/routes/topic_route.js index 0a2f1af95..2e1568718 100644 --- a/app/assets/javascripts/discourse/routes/topic_route.js +++ b/app/assets/javascripts/discourse/routes/topic_route.js @@ -113,6 +113,13 @@ Discourse.TopicRoute = Discourse.Route.extend({ }, setupController: function(controller, model) { + if (Discourse.Mobile.mobileView) { + // close the dropdowns on mobile + $('.d-dropdown').hide(); + $('header ul.icons li').removeClass('active'); + $('[data-toggle="dropdown"]').parent().removeClass('open'); + } + controller.setProperties({ model: model, editingTopic: false