From be63b3e0b380996c7f2fca6fa4c2d02972ea3ef8 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 8 Dec 2014 13:29:57 -0500 Subject: [PATCH] adding 'noLink' property for list generators adding noLink option which will override any other options to make a list column an href. This is useful when using the 'key' attribute, which sorts a list and includes links on the items. Now there is a way to override this feature. This is for portal mode and used in custom inv scripts as well. --- awx/ui/static/lib/ansible/generator-helpers.js | 5 ++++- awx/ui/static/lib/ansible/list-generator.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/ui/static/lib/ansible/generator-helpers.js b/awx/ui/static/lib/ansible/generator-helpers.js index 9036ff3911..979b662aa6 100644 --- a/awx/ui/static/lib/ansible/generator-helpers.js +++ b/awx/ui/static/lib/ansible/generator-helpers.js @@ -607,7 +607,10 @@ angular.module('GeneratorHelpers', []) // Start the Link if ((field.key || field.link || field.linkTo || field.ngClick || field.ngHref || field.awToolTip || field.awPopOver) && options.mode !== 'lookup' && options.mode !== 'select' && !field.noLink && !field.ngBindHtml) { - if (field.icons) { + if(field.noLink === true){ + // provide an override here in case we want key=true for sorting purposes but don't want links -- see: portal mode, + } + else if (field.icons) { field.icons.forEach(function(icon, idx) { var key, i = field.icons[idx]; for (key in i) { diff --git a/awx/ui/static/lib/ansible/list-generator.js b/awx/ui/static/lib/ansible/list-generator.js index 36b419f17b..5dafeec78e 100644 --- a/awx/ui/static/lib/ansible/list-generator.js +++ b/awx/ui/static/lib/ansible/list-generator.js @@ -59,6 +59,7 @@ * | columnClick | Adds an ng-click directive to the <td> element. | * | excludeModal | true or false. If false, the field will not be included in the generated HTML when the mode is 'lookup' | * | key | true or false. If set to true, helpers/search.js will use the field name as the default sort order when generating the API request. | + * | noLink | true or false. If set to true this will override any 'key', 'linkTo', 'ngClick', or other option that would cause the field to be a link. Used in portal mode and custom inv. script. | * | label | Text string used as the column header text. | * | linkTo | Wraps the field value with an <a> element. Set to the value of the href attribute. | * | ngClick | Wraps the field value with an <a> and adds the ng-click directive. Set to the JS expression that ng-click will evaluate. |