From d263caba29ac47382e099192f39e151eef9c70f0 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Tue, 22 Oct 2019 11:36:50 +0200 Subject: [PATCH] allow templates as functions and string for unContent directive --- .../brothers.uNesting/uNesting.css | 12 ++++----- .../brothers.uNesting/uNesting.directives.js | 26 ++++++++++++------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/UmbracoPackages/App_Plugins/brothers.uNesting/uNesting.css b/UmbracoPackages/App_Plugins/brothers.uNesting/uNesting.css index aaf4cb4..3b6f7f5 100644 --- a/UmbracoPackages/App_Plugins/brothers.uNesting/uNesting.css +++ b/UmbracoPackages/App_Plugins/brothers.uNesting/uNesting.css @@ -594,16 +594,14 @@ un-config .unesting-picker input.search-query { - font-weight: 400; - font-size: 14px; - border-color: transparent; - border-radius: 18px; - height: 40px; - padding-top: 6px; - box-shadow: 0 1px 1px 0 rgba(0,0,0,.10); background: #faf8f8; } +.unesting-picker input.search-query:focus +{ + border-color: transparent; +} + .unesting-picker .form-search .icon-search { top: 10px; diff --git a/UmbracoPackages/App_Plugins/brothers.uNesting/uNesting.directives.js b/UmbracoPackages/App_Plugins/brothers.uNesting/uNesting.directives.js index b88883d..e7b87e6 100644 --- a/UmbracoPackages/App_Plugins/brothers.uNesting/uNesting.directives.js +++ b/UmbracoPackages/App_Plugins/brothers.uNesting/uNesting.directives.js @@ -5,9 +5,10 @@ angular.module('umbraco.directives').directive('unContent', function ($compile) return { restrict: 'E', scope: { - item: '=', - node: '=', - config: '=' + item: '<', + node: '<', + config: '<', + template: '<' }, link: function (scope, element) { @@ -15,6 +16,18 @@ angular.module('umbraco.directives').directive('unContent', function ($compile) // get template var template = scope.config && scope.config.nameTemplate ? scope.config.nameTemplate : null; + if (scope.template) + { + if (typeof scope.template === 'function') + { + template = scope.template(); + } + else if (typeof scope.template === 'string') + { + template = scope.template; + } + } + // compile & render template function render() { @@ -34,13 +47,6 @@ angular.module('umbraco.directives').directive('unContent', function ($compile) $compile(element.contents())(scope); } - //var unsubscribe = scope.$on("ncSyncVal", function (ev, args) - //{ - // if (args.key === scope.node.key) - // { - // render(); - // } - //}); var unsubscribe = scope.$watch('item', function (value) { render();