Skip to content

Commit

Permalink
Merge pull request #3794 from camptocamp/f_3520
Browse files Browse the repository at this point in the history
Fix rules operator translation
  • Loading branch information
fredj authored Apr 23, 2018
2 parents bafa6f8 + 95682a5 commit 2da3f1a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/directives/partials/rule.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
<span>{{ ruleCtrl.timeToDate(ruleCtrl.rule.upperBoundary) }}</span>
</div>
<div ng-switch-default>
<span>{{ ruleCtrl.rule.operator }}</span>
<span>{{ ruleCtrl.operatorsShortFormat[ruleCtrl.rule.operator] }}</span>
<span>{{ ruleCtrl.timeToDate(ruleCtrl.rule.getExpression()) }}</span>
</div>
</div>
Expand Down Expand Up @@ -291,7 +291,7 @@
<span>{{ ruleCtrl.rule.upperBoundary }}</span>
</div>
<div ng-switch-default>
<span>{{ ruleCtrl.rule.operator }}</span>
<span>{{ ruleCtrl.operatorsShortFormat[ruleCtrl.rule.operator] }}</span>
<span>{{ ruleCtrl.rule.getExpression() }}</span>
</div>
</div>
Expand Down
17 changes: 17 additions & 0 deletions src/directives/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,23 @@ ngeo.RuleController = class {
[tot.EQUALS]: gettextCatalog.getString('Is equal to')
};

/**
* @type {Object.<string, string>}
* @export
*/
this.operatorsShortFormat = {
[ot.EQUAL_TO]: '=',
[ot.GREATER_THAN]: '>',
[ot.GREATER_THAN_OR_EQUAL_TO]: '>=',
[ot.LESSER_THAN]: '<',
[ot.LESSER_THAN_OR_EQUAL_TO]: '<=',
[ot.NOT_EQUAL_TO]: '!=',
[ot.LIKE]: '~',
[tot.BEGINS]: '>=',
[tot.ENDS]: '<=',
[tot.EQUALS]: '='
};

/**
* Time property used when the rule is of type 'date|datetime' and uses
* a range of date.
Expand Down
8 changes: 4 additions & 4 deletions src/rule/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ ngeo.rule.Rule.SpatialOperatorType = {
* @enum {string}
*/
ngeo.rule.Rule.TemporalOperatorType = {
BEGINS: '>=',
DURING: '..',
ENDS: '<=',
EQUALS: '='
BEGINS: 'time_start',
DURING: 'time_during',
ENDS: 'time_end',
EQUALS: 'time_equal'
};

0 comments on commit 2da3f1a

Please sign in to comment.