diff --git a/css/light-grey.css b/css/light-grey.css index c008dd40ad..5404a4ed63 100644 --- a/css/light-grey.css +++ b/css/light-grey.css @@ -854,14 +854,12 @@ input.dp-applied { transition: all 0.3s ease-in-out; } .search_form_handler .sf_criterion_area .search_form_criteria .sfc_title { - padding-right: 35px; - cursor: pointer; - /* TODO: Uncomment to try fixed width criteria tabs */ max-width: 240px; - padding-right: 25px; + padding-right: 30px; white-space: nowrap; overflow-x: hidden; text-overflow: ellipsis; + cursor: pointer; } .search_form_handler .sf_criterion_area .search_form_criteria .sfc_form_group { /* Form group (operators) is displayed only when the criteria is toggled to opened state */ diff --git a/css/light-grey.scss b/css/light-grey.scss index 64958cd620..ea48cd67f7 100644 --- a/css/light-grey.scss +++ b/css/light-grey.scss @@ -960,14 +960,12 @@ input.dp-applied { } .sfc_title{ - padding-right: 35px; - cursor: pointer; - /* TODO: Uncomment to try fixed width criteria tabs */ max-width: 240px; - padding-right: 25px; + padding-right: 30px; white-space: nowrap; overflow-x: hidden; text-overflow: ellipsis; + cursor: pointer; } .sfc_form_group{ /* Form group (operators) is displayed only when the criteria is toggled to opened state */ diff --git a/dictionaries/en.dictionary.itop.ui.php b/dictionaries/en.dictionary.itop.ui.php index 120d18357c..955cb8e898 100644 --- a/dictionaries/en.dictionary.itop.ui.php +++ b/dictionaries/en.dictionary.itop.ui.php @@ -1387,12 +1387,15 @@ When associated with a trigger, each action is given an "order" number, specifyi 'UI:Search:Toggle' => 'Minimize / Expand', 'UI:Search:Criterion:MoreMenu:AddCriteria' => 'Add new criteria', // - Criteria operators + // - Default widget 'UI:Search:Criteria:Operator:Default:Empty' => 'Is empty', 'UI:Search:Criteria:Operator:Default:NotEmpty' => 'Is not empty', 'UI:Search:Criteria:Operator:Default:Equals' => 'Equals:', + // - String widget 'UI:Search:Criteria:Operator:String:Contains' => 'Contains:', 'UI:Search:Criteria:Operator:String:StartsWith' => 'Starts with:', 'UI:Search:Criteria:Operator:String:EndsWith' => 'Ends with:', + // - Numeric widget 'UI:Search:Criteria:Operator:Numeric:Equals' => '=', 'UI:Search:Criteria:Operator:Numeric:GreaterThan' => '>', 'UI:Search:Criteria:Operator:Numeric:GreaterThanOrEquals' => '>=', @@ -1414,6 +1417,8 @@ When associated with a trigger, each action is given an "order" number, specifyi 'UI:Search:Criteria:Title:ExternalKey:Empty' => '%1$s is defined', 'UI:Search:Criteria:Title:ExternalKey:NotEmpty' => '%1$s is not defined', 'UI:Search:Criteria:Title:ExternalKey:Equals' => '%1$s %2$s', + 'UI:Search:Criteria:Title:ExternalKey:In' => '%1$s: %2$s', + 'UI:Search:Criteria:Title:ExternalKey:In:Many' => '%1$s: %2$s and %3$s others', // - Enum widget 'UI:Search:Criteria:Title:Enum:In' => '%1$s: %2$s', 'UI:Search:Criteria:Title:Enum:In:Many' => '%1$s: %2$s and %3$s others', diff --git a/js/search/search_form_criteria.js b/js/search/search_form_criteria.js index 9dcb63aee7..ca22d3ac9f 100644 --- a/js/search/search_form_criteria.js +++ b/js/search/search_form_criteria.js @@ -399,7 +399,7 @@ $(function() // DOM elements this.element.find('.sfc_fg_buttons') .append('') - .append('') + .append('') .append('') .append(''); diff --git a/js/search/search_form_criteria_external_key.js b/js/search/search_form_criteria_external_key.js index 60ddea2cef..572bf87d70 100644 --- a/js/search/search_form_criteria_external_key.js +++ b/js/search/search_form_criteria_external_key.js @@ -4,13 +4,13 @@ $(function() { // the widget definition, where 'itop' is the namespace, // 'search_form_criteria_external_key' the widget name - $.widget( 'itop.search_form_criteria_external_key', $.itop.search_form_criteria, + $.widget( 'itop.search_form_criteria_external_key', $.itop.search_form_criteria_enum, { // default options options: { // Overload default operator - 'operator': '=', + 'operator': 'IN', // Available operators 'available_operators': { }, @@ -53,100 +53,5 @@ $(function() // Inherited methods //------------------ - // Protected methods - // - Cinematic - // - Open / close criteria - _open: function() - { - this._super(); - - // Focus on right input - var oOpElemToFocus; - if(this.element.find('.sfc_form_group').hasClass('advanced')) - { - oOpElemToFocus = this.element.find('.sfc_fg_operator .sfc_op_radio:checked').closest('.sfc_fg_operator'); - } - else - { - oOpElemToFocus = this.element.find('.sfc_fg_operator:first'); - } - oOpElemToFocus.find('.sfc_op_content :input:first').trigger('click').trigger('focus'); - }, - - // DOM element helpers - // TODO: Remove this function after UX tests - _prepareOperators: function() - { - var me = this; - - this._super(); - - if(this.options.field.allowed_values.values !== undefined) - { - var sSelect = ''; - this.element.find('.sfc_fg_operator[data-operator-code="equals"] .sfc_op_content').html(sSelect); - } - else - { - this.element.find('.sfc_fg_operator[data-operator-code="equals"] .sfc_op_content').html('Not implemented yet.'); - } - - this.element.find('.sfc_fg_operator[data-operator-code="equals"] .sfc_op_content select').on('change', function(){ - me._apply(); - }); - }, - - // Operators helpers - // Reset operator's state - // TODO: Reset operator's state - // _resetEqualsOperator: function(oOpElem) - // { - // // Uncheck toggler - // oOpElem.find('sfc_opc_mc_toggler input').prop('checked', false); - // - // // Clear filter - // oOpElem.find('sfc_opc_mc_filter input').val(''); - // }, - // Get operator's values - _getEqualsOperatorValues: function(oOpElem) - { - var aValues = []; - - var sValue = oOpElem.find('.sfc_op_content select > option:selected').val(); - var sLabel = oOpElem.find('.sfc_op_content select > option:selected').text(); - if(sValue !== "") - { - aValues.push({value: sValue, label: sLabel}); - } - - return aValues; - }, - // Set operator's values - // TODO: Set operator's values - // _setInOperatorValues: function(oOpElem, aValues) - // { - // if(aValues.length === 0) - // { - // return false; - // } - // - // // Uncheck all allowed values - // oOpElem.find('.sfc_opc_mc_item input').prop('checked', false); - // - // // Re-check allowed values from param - // for(var iIdx in aValues) - // { - // oOpElem.find('.sfc_opc_mc_item[data-value-code="' + aValues[iIdx].value + '"] input').prop('checked', true); - // } - // - // return true; - // }, }); }); diff --git a/js/search/search_form_criteria_string.js b/js/search/search_form_criteria_string.js index 76f55026e2..7359ce2f0d 100644 --- a/js/search/search_form_criteria_string.js +++ b/js/search/search_form_criteria_string.js @@ -79,15 +79,18 @@ $(function() { // Remove starts/ends_with this.element.find('.sfc_fg_operator[data-operator-code*="with"]').remove(); + // Modify contains with a dropdown this.element.find('.sfc_fg_operator[data-operator-code="contains"] .sfc_op_name') .html('') .css('margin-right', '5px'); + // Remove click event on dropdown this.element.find('.sfc_fg_operator[data-operator-code="contains"] .sfc_op_name').on('click', function(oEvent){ oEvent.preventDefault(); oEvent.stopPropagation(); }); + this.element.find('.sfc_fg_operator[data-operator-code="contains"] .sfc_op_name select').on('change', function(){ $(this).closest('.sfc_fg_operator').find('.sfc_op_content input:first').trigger('focus'); });