From cf4c09f41fce0141d84bd75e76ab17f33897e8cd Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 23 Mar 2016 14:12:57 +0100 Subject: [PATCH] When click on item in variation quick switcher - change context in header --- .../editor/umbeditorheader.directive.js | 23 ++++++++++++++++++- .../components/editor/umb-editor-header.html | 16 ++++++------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js index 74e80569b8..04dc25ab3b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js @@ -36,9 +36,30 @@ scope.showVariationsQuickSwitch = false; }; - scope.toggleSubItems = function(item) { + scope.toggleSubItems = function(item, $event) { item.showSubItems = !item.showSubItems; + $event.preventDefault(); + $event.stopPropagation(); + }; + + scope.selectItem = function(language, variation) { + + if(language) { + scope.language = language.language; + } else { + scope.language = ""; + } + + if(variation) { + scope.variation = variation.name; + } else { + scope.variation = ""; + } + + scope.showVariationsQuickSwitch = false; + }; + } var directive = { diff --git a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-header.html b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-header.html index 18d80b1f44..3f888a5285 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-header.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-header.html @@ -32,16 +32,16 @@ umb-auto-focus required /> -
+
-
+
-
English (United States)
+
{{ language }}
-
+
-
Mobile
+
{{ variation }}
@@ -59,16 +59,16 @@
  • - + {{variation.language}} - variations ▾ + variations ▾