Skip to content

Commit

Permalink
va-property2 - hidden languages (#186)
Browse files Browse the repository at this point in the history
* Done

* null checks for hidden languages

* markup fix
  • Loading branch information
Tilesto authored and tatarincev committed Dec 17, 2018
1 parent 5f3da7d commit 47bbb91
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
11 changes: 11 additions & 0 deletions VirtoCommerce.CatalogModule.Web/Scripts/directives/property2.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ angular.module('virtoCommerce.catalogModule')
templateUrl: 'Modules/$(VirtoCommerce.Catalog)/Scripts/directives/property2.tpl.html',
scope: {
languages: "=",
hiddenLanguages: "=",
defaultLanguage: "=",
getPropValues: "&",
pageSize: "@?"
Expand Down Expand Up @@ -130,6 +131,16 @@ angular.module('virtoCommerce.catalogModule')
}
};

scope.isLanguageVisible = function (language) {
if(scope.hiddenLanguages){
if (_.contains(scope.hiddenLanguages, language)) {
return false;
}
}

return true;
}

scope.loadDictionaryValues = function ($select) {
$select.page = 0;
scope.context.allDictionaryValues = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@


<script type="text/ng-template" id="ShortText-multilang.html">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap" ng-if="isLanguageVisible(language)">
<div class="form-input __langs">
<span ng-if="language.length>2" class="flag flag-{{language.substr(3).toLowerCase()}}"></span>
<span ng-if="language.length<=2" class="langCode">{{language.toUpperCase()}}</span>
Expand All @@ -197,7 +197,7 @@
</script>

<script type="text/ng-template" id="LongText-multilang.html">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap" ng-if="isLanguageVisible(language)">
<div class="form-input __langs">
<span ng-if="language.length>2" class="flag flag-{{language.substr(3).toLowerCase()}}"></span>
<span ng-if="language.length<=2" class="langCode">{{language.toUpperCase()}}</span>
Expand All @@ -213,7 +213,7 @@
</div>
</script>
<script type="text/ng-template" id="Number-multilang.html">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap" ng-if="isLanguageVisible(language)">
<div class="form-input __number">
<input ng-disabled="currentEntity.isReadOnly"
ng-required="currentEntity.required && !currentEntity.isReadOnly"
Expand All @@ -225,7 +225,7 @@
</div>
</script>
<script type="text/ng-template" id="DateTime-multilang.html">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap" ng-if="isLanguageVisible(language)">
<div class="form-input __langs __calendar">
<span ng-if="language.length>2" class="flag flag-{{language.substr(3).toLowerCase()}}"></span>
<span ng-if="language.length<=2" class="langCode">{{language.toUpperCase()}}</span>
Expand All @@ -243,7 +243,7 @@


<script type="text/ng-template" id="ShortText-multivalue-multilang.html">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap" ng-if="isLanguageVisible(language)">
<div class="form-input __langs">
<span ng-if="language.length>2" class="flag flag-{{language.substr(3).toLowerCase()}}"></span>
<span ng-if="language.length<=2" class="langCode">{{language.toUpperCase()}}</span>
Expand All @@ -265,7 +265,7 @@
</div>
</script>
<script type="text/ng-template" id="LongText-multivalue-multilang.html">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap" ng-if="isLanguageVisible(language)">
<div class="form-input __langs" ng-repeat="val in langValuesGroup.currentPropValues track by $index">
<span ng-if="language.length>2" class="flag flag-{{language.substr(3).toLowerCase()}}"></span>
<span ng-if="language.length<=2" class="langCode">{{language.toUpperCase()}}</span>
Expand All @@ -283,7 +283,7 @@
</div>
</script>
<script type="text/ng-template" id="Number-multivalue-multilang.html">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap">
<div class="form-group" ng-repeat="(language, langValuesGroup) in context.langValuesMap" ng-if="isLanguageVisible(language)">
<div class="form-input __langs">
<span ng-if="language.length>2" class="flag flag-{{language.substr(3).toLowerCase()}}"></span>
<span ng-if="language.length<=2" class="langCode">{{language.toUpperCase()}}</span>
Expand Down

0 comments on commit 47bbb91

Please sign in to comment.