From 79eb0b53feee677adfb2039d6238ba8d4c35329f Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Mon, 27 Oct 2014 22:42:23 +0800 Subject: [PATCH] Prefer dynamic virtual profile icons. --- omega-pac/src/profiles.coffee | 5 --- omega-target/src/options.coffee | 9 ++--- omega-web/src/coffee/omega_decoration.coffee | 34 ++++++++++++++----- omega-web/src/less/options.less | 3 +- omega-web/src/omega/controllers/master.coffee | 8 +++-- .../src/omega/controllers/profile.coffee | 24 ++++++------- .../omega/controllers/switch_profile.coffee | 13 ++++--- omega-web/src/options.jade | 4 +-- .../src/partials/cannot_delete_profile.jade | 4 +-- omega-web/src/partials/delete_attached.jade | 2 +- omega-web/src/partials/delete_profile.jade | 4 +-- .../src/partials/omega_profile_select.jade | 4 +-- omega-web/src/partials/profile.jade | 5 ++- omega-web/src/partials/profile_rule_list.jade | 4 +-- omega-web/src/partials/profile_switch.jade | 7 ++-- omega-web/src/partials/profile_virtual.jade | 2 +- omega-web/src/partials/replace_profile.jade | 4 +-- .../src/partials/rule_remove_confirm.jade | 4 +-- .../src/partials/rule_reset_confirm.jade | 4 +-- omega-web/src/partials/ui.jade | 10 ++---- omega-web/src/popup.jade | 28 +++++---------- 21 files changed, 88 insertions(+), 94 deletions(-) diff --git a/omega-pac/src/profiles.coffee b/omega-pac/src/profiles.coffee index 7eddc59..d2c2804 100644 --- a/omega-pac/src/profiles.coffee +++ b/omega-pac/src/profiles.coffee @@ -299,11 +299,6 @@ module.exports = exports = create: (profile) -> profile.defaultProfileName ?= 'direct' profile.rules ?= [] - if profile.profileType == 'VirtualProfile' and not profile.virtualType? - target = exports.byName(profile.defaultProfileName, {}) - if target - profile.virtualType = target.profileType - profile.color = target.color directReferenceSet: (profile) -> refs = {} refs[exports.nameAsKey(profile.defaultProfileName)] = diff --git a/omega-target/src/options.coffee b/omega-target/src/options.coffee index 9cc9530..b083f97 100644 --- a/omega-target/src/options.coffee +++ b/omega-target/src/options.coffee @@ -289,8 +289,7 @@ class Options profileType: p.profileType color: p.color builtin: if p.builtin then true - if p.virtualType - profiles[key].virtualType = p.virtualType + if p.profileType == 'VirtualProfile' profiles[key].defaultProfileName = p.defaultProfileName if not allReferenceSet? allReferenceSet = OmegaPac.Profiles.allReferenceSet profile, @_options @@ -330,7 +329,8 @@ class Options @_state.set({ 'currentProfileName': @_currentProfileName 'isSystemProfile': @_isSystem - 'currentProfileCanAddRule': profile.rules? and not profile.virtualType + 'currentProfileCanAddRule': + profile.rules? and profile.profileType != 'VirtualProfile' }) @_setAvailableProfiles() @@ -656,9 +656,6 @@ class Options return Promise.reject new ProfileNotExistError(defaultProfileName) profile.defaultProfileName = defaultProfileName - if profile.virtualType - profile.color = target.color - profile.virtualType = target.profileType OmegaPac.Profiles.updateRevision(profile) changes = {} changes[OmegaPac.Profiles.nameAsKey(profile)] = profile diff --git a/omega-web/src/coffee/omega_decoration.coffee b/omega-web/src/coffee/omega_decoration.coffee index 5948b3f..32b0232 100644 --- a/omega-web/src/coffee/omega_decoration.coffee +++ b/omega-web/src/coffee/omega_decoration.coffee @@ -23,40 +23,55 @@ angular.module('omegaDecoration', []).value('profileIcons', { -1 else 1 -).directive('omegaProfileIcon', (profileIcons) -> +).constant('getVirtualTarget', (profile, options) -> + if profile?.profileType == 'VirtualProfile' + options?['+' + profile.defaultProfileName] +).directive('omegaProfileIcon', (profileIcons, getVirtualTarget) -> restrict: 'A' template: ''' - + ''' scope: 'profile': '=?omegaProfileIcon' 'icon': '=?icon' 'color': '=?color' + 'options': '=options' link: (scope, element, attrs, ngModel) -> scope.profileIcons = profileIcons + scope.isVirtual = (profile) -> + profile?.profileType == 'VirtualProfile' scope.getIcon = (profile) -> - (scope.icon || scope.profileIcons[profile.virtualType] || - profileIcons[profile.profileType]) + type = profile?.profileType + type = getVirtualTarget(profile, scope.options)?.profileType ? type + profileIcons[type] + scope.getColor = (profile) -> + color = undefined + while profile + color = profile.color + profile = getVirtualTarget(profile, scope.options) + color ).directive('omegaProfileInline', -> restrict: 'A' template: ''' - + {{dispName ? dispName(profile) : profile.name}} ''' scope: 'profile': '=omegaProfileInline' 'dispName': '=?dispName' + 'options': '=options' ).directive('omegaHtml', ($compile) -> restrict: 'A' link: (scope, element, attrs, ngModel) -> locals = - $profile: (profile = 'profile', dispName = 'dispNameFilter') -> + $profile: (profile = 'profile', dispName = 'dispNameFilter', + options = 'options') -> """ + disp-name="#{dispName}" options="#{options}"> """ getHtml = -> scope.$eval(attrs.omegaHtml, locals) scope.$watch getHtml, (html) -> @@ -70,6 +85,7 @@ angular.module('omegaDecoration', []).value('profileIcons', { 'profiles': '&omegaProfileSelect' 'defaultText': '@?defaultText' 'dispName': '=?dispName' + 'options': '=options' link: (scope, element, attrs, ngModel) -> scope.profileIcons = profileIcons scope.currentProfiles = [] diff --git a/omega-web/src/less/options.less b/omega-web/src/less/options.less index 4010923..d096c60 100644 --- a/omega-web/src/less/options.less +++ b/omega-web/src/less/options.less @@ -222,10 +222,11 @@ main { border: none; } - .sp-preview { + .sp-preview, .profile-color-editor-fake { margin-right: 0; height: 30px; width: 30px; + border: solid 1px #222; } .sp-dd { diff --git a/omega-web/src/omega/controllers/master.coffee b/omega-web/src/omega/controllers/master.coffee index edc1ba0..0bfa80b 100644 --- a/omega-web/src/omega/controllers/master.coffee +++ b/omega-web/src/omega/controllers/master.coffee @@ -103,6 +103,8 @@ angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window, conflict: '!$value || !profileByName($value)' reserved: '!$value || !isProfileNameReserved($value)' scope.profileIcons = profileIcons + scope.dispNameFilter = dispNameFilter + scope.options = $scope.options $modal.open( templateUrl: 'partials/new_profile.html' scope: scope @@ -122,10 +124,11 @@ angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window, scope.toName = toName scope.profileByName = $rootScope.profileByName scope.dispNameFilter = dispNameFilter + scope.options = $scope.options scope.profileSelect = (model) -> """
""" @@ -157,7 +160,8 @@ angular.module('omega').controller 'MasterCtrl', ($scope, $rootScope, $window, scope.validateProfileName = conflict: '!$value || $value == fromName || !profileByName($value)' reserved: '!$value || !isProfileNameReserved($value)' - scope.profileIcons = profileIcons + scope.dispNameFilter = $scope.dispNameFilter + scope.options = $scope.options $modal.open( templateUrl: 'partials/rename_profile.html' scope: scope diff --git a/omega-web/src/omega/controllers/profile.coffee b/omega-web/src/omega/controllers/profile.coffee index 346fdf9..9a71f04 100644 --- a/omega-web/src/omega/controllers/profile.coffee +++ b/omega-web/src/omega/controllers/profile.coffee @@ -1,6 +1,6 @@ angular.module('omega').controller 'ProfileCtrl', ($scope, $stateParams, $location, $rootScope, $timeout, $state, $modal, profileColorPalette, - getAttachedName, getParentName) -> + getAttachedName, getParentName, getVirtualTarget) -> name = $stateParams.name profileTemplates = 'FixedProfile': 'profile_fixed.html' @@ -18,13 +18,22 @@ angular.module('omega').controller 'ProfileCtrl', ($scope, $stateParams, showPalette: true showSelectionPalette: true + $scope.getProfileColor = -> + color = undefined + profile = $scope.profile + while profile + color = profile.color + profile = getVirtualTarget(profile, $scope.options) + color + $scope.deleteProfile = -> profileName = $scope.profile.name refs = OmegaPac.Profiles.referencedBySet(profileName, $rootScope.options) scope = $rootScope.$new('isolate') scope.profile = $scope.profile - scope.profileIcons = $scope.profileIcons + scope.dispNameFilter = $scope.dispNameFilter + scope.options = $scope.options if Object.keys(refs).length > 0 refSet = {} @@ -94,15 +103,4 @@ angular.module('omega').controller 'ProfileCtrl', ($scope, $stateParams, revisionChanged = true $scope.$watch expression, onChange, true - onProfileChange = (profile, oldProfile) -> - return if profile == oldProfile - if profile.virtualType - target = $scope.profileByName(profile.defaultProfileName) - profile.color = target.color - profile.virtualType = target.profileType - OmegaPac.Profiles.each $scope.options, (key, p) -> - if p.virtualType and p.defaultProfileName == profile.name - onProfileChange(p, null) - $scope.watchAndUpdateRevision 'profile' - $scope.$watch 'profile', onProfileChange, true diff --git a/omega-web/src/omega/controllers/switch_profile.coffee b/omega-web/src/omega/controllers/switch_profile.coffee index e4f2b54..9a55d0e 100644 --- a/omega-web/src/omega/controllers/switch_profile.coffee +++ b/omega-web/src/omega/controllers/switch_profile.coffee @@ -118,7 +118,8 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $location, scope = $scope.$new('isolate') scope.rule = $scope.profile.rules[index] scope.ruleProfile = $scope.profileByName(scope.rule.profileName) - scope.profileIcons = $scope.profileIcons + scope.dispNameFilter = $scope.dispNameFilter + scope.options = $scope.options $modal.open( templateUrl: 'partials/rule_remove_confirm.html' scope: scope @@ -128,14 +129,15 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $location, $scope.resetRules = -> scope = $scope.$new('isolate') - scope.ruleProfile = $scope.profileByName($scope.profile.defaultProfileName) - scope.profileIcons = $scope.profileIcons + scope.ruleProfile = $scope.profileByName($scope.defaultProfileName) + scope.dispNameFilter = $scope.dispNameFilter + scope.options = $scope.options $modal.open( templateUrl: 'partials/rule_reset_confirm.html' scope: scope ).result.then -> for rule in $scope.profile.rules - rule.profileName = $scope.profile.defaultProfileName + rule.profileName = $scope.defaultProfileName $scope.sortableOptions = handle: '.sort-bar' @@ -202,7 +204,8 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $location, return unless $scope.attached scope = $scope.$new('isolate') scope.attached = $scope.attached - scope.profileIcons = profileIcons + scope.dispNameFilter = $scope.dispNameFilter + scope.options = $scope.options $modal.open( templateUrl: 'partials/delete_attached.html' scope: scope diff --git a/omega-web/src/options.jade b/omega-web/src/options.jade index f512383..f7d1556 100644 --- a/omega-web/src/options.jade +++ b/omega-web/src/options.jade @@ -30,9 +30,7 @@ html(lang='en' ng-controller='MasterCtrl' ng-csp) li.nav-header {{'options_navHeader_profiles' | tr}} li(ng-repeat='profile in options | profiles:"sorted"' ui-sref-active='active') a(ui-sref='profile({name: profile.name})') - span(omega-profile-icon='profile') - = ' ' - | {{profile.name}} + span(omega-profile-inline='profile' options='options') li a(role='button' ng-click='newProfile()') span.glyphicon.glyphicon-plus diff --git a/omega-web/src/partials/cannot_delete_profile.jade b/omega-web/src/partials/cannot_delete_profile.jade index 6b0f5a3..f45b720 100644 --- a/omega-web/src/partials/cannot_delete_profile.jade +++ b/omega-web/src/partials/cannot_delete_profile.jade @@ -8,9 +8,7 @@ .well ul.list-style-none li(ng-repeat='p in refs') - span(omega-profile-icon='p') - = ' ' - | {{p.name | dispName}} + span(omega-profile-inline='p' options='options' disp-name='dispNameFilter') p {{'options_modifyReferringProfiles' | tr}} .modal-footer button.btn.btn-default(ng-click='$dismiss()') {{'dialog_cancel' | tr}} diff --git a/omega-web/src/partials/delete_attached.jade b/omega-web/src/partials/delete_attached.jade index 78da597..32ef773 100644 --- a/omega-web/src/partials/delete_attached.jade +++ b/omega-web/src/partials/delete_attached.jade @@ -6,7 +6,7 @@ .modal-body p {{'options_deleteAttachedConfirm' | tr}} .well - span(omega-profile-icon='attached') + span(omega-profile-icon='attached' options='options') = ' ' | {{attached.sourceUrl || ('options_ruleListLineCount' | tr:[attached.ruleList.split('\n').length])}} .modal-footer diff --git a/omega-web/src/partials/delete_profile.jade b/omega-web/src/partials/delete_profile.jade index b0cbc3e..a4610d0 100644 --- a/omega-web/src/partials/delete_profile.jade +++ b/omega-web/src/partials/delete_profile.jade @@ -6,9 +6,7 @@ .modal-body p {{'options_deleteProfileConfirm' | tr}} .well - span(omega-profile-icon='profile') - = ' ' - | {{profile.name}} + span(omega-profile-inline='profile' options='options' disp-name='dispNameFilter') .modal-footer button.btn.btn-default(ng-click='$dismiss()') {{'dialog_cancel' | tr}} button.btn.btn-danger(type='button' ng-click='$close("ok")') {{'options_deleteProfile' | tr}} diff --git a/omega-web/src/partials/omega_profile_select.jade b/omega-web/src/partials/omega_profile_select.jade index 124642f..0b26354 100644 --- a/omega-web/src/partials/omega_profile_select.jade +++ b/omega-web/src/partials/omega_profile_select.jade @@ -1,7 +1,7 @@ .btn-group.omega-profile-select(dropdown on-toggle="toggled(open)") button.btn.btn-default.dropdown-toggle(type='button' aria-expanded='false' role='listbox' aria-haspopup='true') - span(omega-profile-icon='selectedProfile' icon='selectedProfile ? undefined : "glyphicon-time"') + span(omega-profile-icon='selectedProfile' options='options' icon='selectedProfile ? undefined : "glyphicon-time"') = ' ' span(ng-show='!!profileName') {{getName(selectedProfile)}} span(ng-show='!profileName') {{defaultText}} @@ -14,5 +14,5 @@ = ' {{defaultText}}' li(role='option' ng-repeat='profile in dispProfiles' ng-class='{active: profileName == profile.name}') a(ng-click='setProfileName(profile.name)') - span(omega-profile-icon='profile') + span(omega-profile-icon='profile' options='options') = ' {{getName(profile)}}' diff --git a/omega-web/src/partials/profile.jade b/omega-web/src/partials/profile.jade index 67e0e78..4331a6e 100644 --- a/omega-web/src/partials/profile.jade +++ b/omega-web/src/partials/profile.jade @@ -15,6 +15,9 @@ = ' ' | {{'options_deleteProfile' | tr}} span.profile-color-editor - x-spectrum-colorpicker(ng-model='profile.color' options='spectrumOptions') + .profile-color-editor-fake(ng-if='profile.profileType == "VirtualProfile"' + ng-style="{'background-color': getProfileColor()}") + x-spectrum-colorpicker(ng-model='profile.color' options='spectrumOptions' + ng-if='profile.profileType != "VirtualProfile"') h2.profile-name {{'options_profileTabPrefix' | tr}}{{profile.name}} div(ng-include='profileTemplate') diff --git a/omega-web/src/partials/profile_rule_list.jade b/omega-web/src/partials/profile_rule_list.jade index a375a26..f42063f 100644 --- a/omega-web/src/partials/profile_rule_list.jade +++ b/omega-web/src/partials/profile_rule_list.jade @@ -5,12 +5,12 @@ div(ng-controller='RuleListProfileCtrl') label {{'options_ruleListMatchProfile' | tr}} = ' ' div(omega-profile-select='options | profiles:profile' ng-model='profile.matchProfileName' - disp-name='dispNameFilter' style='display: inline-block;') + disp-name='dispNameFilter' options='options' style='display: inline-block;') .form-group label {{'options_ruleListDefaultProfile' | tr}} = ' ' div(omega-profile-select='options | profiles:profile' ng-model='profile.defaultProfileName' - disp-name='dispNameFilter' style='display: inline-block;') + disp-name='dispNameFilter' options='options' style='display: inline-block;') form.form-group label {{'options_ruleListFormat' | tr}} .radio.inline-form-control.no-min-width(ng-repeat='format in ruleListFormats') diff --git a/omega-web/src/partials/profile_switch.jade b/omega-web/src/partials/profile_switch.jade index 086c2b7..48c64e7 100644 --- a/omega-web/src/partials/profile_switch.jade +++ b/omega-web/src/partials/profile_switch.jade @@ -52,7 +52,8 @@ div(ng-controller='SwitchProfileCtrl') ui-validate='{pattern: "validateCondition(rule.condition, $value)"}') td div(omega-profile-select='options | profiles:profile' ng-model='rule.profileName' - disp-name='dispNameFilter' ng-class='{disabled: rule.condition.conditionType == "NeverCondition"}') + disp-name='dispNameFilter' options='options' + ng-class='{disabled: rule.condition.conditionType == "NeverCondition"}') td button.btn.btn-danger.btn-sm(title="{{'options_deleteRule' | tr}}" ng-click='removeRule($index)') span.glyphicon.glyphicon-trash @@ -80,7 +81,7 @@ div(ng-controller='SwitchProfileCtrl') | {{'options_switchAttachedProfileInConditionDisabled' | tr}} td div(omega-profile-select='options | profiles:profile' ng-model='attached.matchProfileName' - disp-name='dispNameFilter' ng-class='{disabled: !attachedOptions.enabled}') + disp-name='dispNameFilter' options='options' ng-class='{disabled: !attachedOptions.enabled}') td button.btn.btn-danger.btn-sm(title="{{'options_deleteAttached' | tr}}" ng-click='removeAttached()') span.glyphicon.glyphicon-trash @@ -90,7 +91,7 @@ div(ng-controller='SwitchProfileCtrl') td(colspan='2') {{'options_switchDefaultProfile' | tr}} td div(omega-profile-select='options | profiles:profile' ng-model='defaultProfileName' - disp-name='dispNameFilter') + disp-name='dispNameFilter' options='options') td button.btn.btn-info.btn-sm(title="{{'options_resetRules_help' | tr}}" ng-click='resetRules()') span.glyphicon.glyphicon-chevron-up diff --git a/omega-web/src/partials/profile_virtual.jade b/omega-web/src/partials/profile_virtual.jade index d8dbd09..b634fa1 100644 --- a/omega-web/src/partials/profile_virtual.jade +++ b/omega-web/src/partials/profile_virtual.jade @@ -7,7 +7,7 @@ div label {{'options_virtualProfileTarget' | tr}} = ' ' div(omega-profile-select='options | profiles:profile' ng-model='profile.defaultProfileName' - disp-name='dispNameFilter' style='display: inline-block;') + disp-name='dispNameFilter' style='display: inline-block;' options='options') section.settings-group h3 {{'options_group_virtualProfileReplace' | tr}} p.help-block(omega-html='"options_virtualProfileReplaceHelp" | tr:[$profile("profileByName(profile.defaultProfileName)")]') diff --git a/omega-web/src/partials/replace_profile.jade b/omega-web/src/partials/replace_profile.jade index ac6d09c..3ea308b 100644 --- a/omega-web/src/partials/replace_profile.jade +++ b/omega-web/src/partials/replace_profile.jade @@ -6,11 +6,11 @@ .modal-body p(omega-html='"options_replaceProfileConfirm" | tr:[profileSelect("fromName"), profileSelect("toName")]') .well - span(omega-profile-inline='profileByName(fromName)') + span(omega-profile-inline='profileByName(fromName)' options='options' disp-name='dispNameFilter') = ' ' span.glyphicon.glyphicon-chevron-right = ' ' - span(omega-profile-inline='profileByName(toName)') + span(omega-profile-inline='profileByName(toName)' options='options' disp-name='dispNameFilter') .help-block(omega-html="'options_replaceProfileHelp' | tr:[$profile('profileByName(fromName)'), $profile('profileByName(toName)')]") .modal-footer button.btn.btn-default(ng-click='$dismiss()') {{'dialog_cancel' | tr}} diff --git a/omega-web/src/partials/rule_remove_confirm.jade b/omega-web/src/partials/rule_remove_confirm.jade index 6242b5a..a76ea42 100644 --- a/omega-web/src/partials/rule_remove_confirm.jade +++ b/omega-web/src/partials/rule_remove_confirm.jade @@ -10,9 +10,7 @@ = ' ' | {{rule.condition.pattern}} span.pull-right - span(omega-profile-icon='ruleProfile') - = ' ' - | {{ruleProfile.name | dispName}} + span(omega-profile-inline='ruleProfile' disp-name='dispNameFilter' options='options') .modal-footer button.btn.btn-default(ng-click='$dismiss()') {{'dialog_cancel' | tr}} button.btn.btn-danger(type='button' ng-click='$close("ok")') {{'options_deleteRule' | tr}} diff --git a/omega-web/src/partials/rule_reset_confirm.jade b/omega-web/src/partials/rule_reset_confirm.jade index bb11c43..4894932 100644 --- a/omega-web/src/partials/rule_reset_confirm.jade +++ b/omega-web/src/partials/rule_reset_confirm.jade @@ -6,9 +6,7 @@ .modal-body p {{'options_resetRulesConfirm' | tr}} .well - span(omega-profile-icon='ruleProfile') - = ' ' - | {{ruleProfile.name | dispName}} + span(omega-profile-inline='ruleProfile' disp-name='dispNameFilter' options='options') .modal-footer button.btn.btn-default(ng-click='$dismiss()') {{'dialog_cancel' | tr}} button.btn.btn-warning(type='button' ng-click='$close("ok")') {{'options_resetRules' | tr}} diff --git a/omega-web/src/partials/ui.jade b/omega-web/src/partials/ui.jade index 5bd5fbe..5ea392f 100644 --- a/omega-web/src/partials/ui.jade +++ b/omega-web/src/partials/ui.jade @@ -17,7 +17,7 @@ section.settings-group = ' ' div(omega-profile-select='options | profiles:"all"' ng-model='options["-startupProfileName"]' default-text="{{'options_startupProfile_none' | tr}}" disp-name='dispNameFilter' - style='display: inline-block;') + style='display: inline-block;' options='options') div.checkbox label input(type='checkbox' ng-model='options["-showConditionTypes"]' ng-true-value='1' ng-false-value='0' omega-int2str) @@ -36,12 +36,8 @@ section.settings-group ul.cycle-profile-container.cycle-enabled(ui-sortable="sortableOptions" ng-model='options["-quickSwitchProfiles"]') li(ng-repeat='name in options["-quickSwitchProfiles"]') - span(omega-profile-icon='profileByName(name)') - = ' ' - | {{name | dispName}} + span(omega-profile-inline='profileByName(name)' options='options' disp-name='dispNameFilter') h4 {{'options_notCycledProfiles' | tr}} ul.cycle-profile-container(ui-sortable="sortableOptions" ng-model='notCycledProfiles') li.bg-success(ng-repeat='name in notCycledProfiles') - span(omega-profile-icon='profileByName(name)') - = ' ' - | {{name | dispName}} + span(omega-profile-inline='profileByName(name)' options='options' disp-name='dispNameFilter') diff --git a/omega-web/src/popup.jade b/omega-web/src/popup.jade index aab14dd..165fb3e 100644 --- a/omega-web/src/popup.jade +++ b/omega-web/src/popup.jade @@ -27,13 +27,11 @@ html(lang='en' ng-app='omegaPopup' ng-controller='PopupCtrl' ng-csp) ul.nav.nav-pills.nav-stacked(ng-hide='showConditionForm || proxyNotControllable') li.profile(ng-repeat='profile in builtinProfiles' ng-class='{active: isActive(profile.name), "bg-info": isEffective(profile.name)}') a(ng-click='applyProfile(profile)') - span(omega-profile-icon='profile' icon='getIcon(profile)') - = ' ' - | {{profile.name | dispName}} + span(omega-profile-inline='profile' icon='getIcon(profile)' options='availableProfiles' disp-name='dispNameFilter') li.profile.external-profile(ng-show='!!externalProfile' ng-class='{active: isActive(""), "bg-info": isEffective("")}') a(ng-click='nameExternal.open = true') form(name='nameExternalForm' ng-submit='nameExternalForm.$valid && saveExternal()') - span(omega-profile-icon='externalProfile' icon='getIcon(externalProfile, "normal")') + span(omega-profile-icon='externalProfile' icon='getIcon(externalProfile, "normal")' options='availableProfiles' disp-name='dispNameFilter') = ' ' span(ng-show='!nameExternal.open') {{'popup_externalProfile' | tr}} input.form-control(ng-show='!!nameExternal.open' ng-model='externalProfile.name' ng-blur='nameExternalForm.submit()' @@ -42,21 +40,17 @@ html(lang='en' ng-app='omegaPopup' ng-controller='PopupCtrl' ng-csp) li.profile(ng-repeat='profile in customProfiles' ng-class='{active: isActive(profile.name), "bg-info": isEffective(profile.name)}' dropdown) a(ng-click='applyProfile(profile)' ng-if='!profile.validResultProfiles') - span(omega-profile-icon='profile' icon='getIcon(profile)') - = ' ' - | {{profile.name | dispName}} + span(omega-profile-inline='profile' icon='getIcon(profile)' options='availableProfiles' disp-name='dispNameFilter') a.profile-with-default-edit(ng-click='applyProfile(profile)' ng-if='!!profile.validResultProfiles') - span(omega-profile-icon='profile' icon='getIcon(profile)') - = ' {{profile.name | dispName}} ' + span(omega-profile-inline='profile' icon='getIcon(profile)' options='availableProfiles' disp-name='dispNameFilter') + = ' ' | [{{profile.defaultProfileName}}] button.dropdown-toggle.btn.btn-default(ng-click='$event.stopPropagation()') span.glyphicon.glyphicon-chevron-down ul.dropdown-menu(ng-if='!!profile.validResultProfiles') li(ng-repeat='p in profile.validResultProfiles' ng-class='{active: p.name == profile.defaultProfileName}') a(ng-click='setDefaultProfile(profile.name, p.name)') - span(omega-profile-icon='p') - = ' ' - | {{p.name | dispName}} + span(omega-profile-inline='p' options='availableProfiles' disp-name='dispNameFilter') li.divider(ng-show='!!currentDomain && validResultProfiles.length') li(ng-show='!!currentProfileCanAddRule') a(ng-click='showConditionForm = true') @@ -73,9 +67,7 @@ html(lang='en' ng-app='omegaPopup' ng-controller='PopupCtrl' ng-csp) li(ng-repeat='profile in validResultProfiles' ng-class='{active: profile.name == currentTempRuleProfile}' ng-show='!!currentTempRuleProfile || validResultProfiles.length == 1 || profile.name != currentProfileName') a(ng-click='addTempRule(currentDomain, profile.name)') - span(omega-profile-icon='profile') - = ' ' - | {{profile.name | dispName}} + span(omega-profile-inline='profile' options='availableProfiles' disp-name='dispNameFilter') li.divider li a(ng-click='openOptions()') @@ -100,9 +92,7 @@ html(lang='en' ng-app='omegaPopup' ng-controller='PopupCtrl' ng-csp) | {{'popup_addConditionTo' | tr}} = ' ' span.profile-inline - span(omega-profile-icon='currentProfile') - = ' ' - | {{currentProfileName | dispName}} + span(omega-profile-inline='currentProfile' options='availableProfiles' disp-name='dispNameFilter') div.form-group label | {{'options_conditionType' | tr}} @@ -123,7 +113,7 @@ html(lang='en' ng-app='omegaPopup' ng-controller='PopupCtrl' ng-csp) div.form-group label {{'options_resultProfile' | tr}} div(omega-profile-select='validResultProfiles' ng-model='rule.profileName' - disp-name='dispNameFilter') + disp-name='dispNameFilter' options='availableProfiles') div.condition-controls button.btn.btn-default(type='button' ng-click='showConditionForm = false') | {{'dialog_cancel' | tr}}