Sebastian Stehle
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with
11 additions and
11 deletions
-
frontend/src/app/features/rules/shared/actions/formattable-input.component.ts
-
frontend/src/app/framework/angular/forms/control-errors.component.ts
-
frontend/src/app/framework/angular/forms/error-validator.ts
-
frontend/src/app/framework/angular/pipes/colors.pipes.ts
-
frontend/src/app/framework/angular/pipes/money.pipe.ts
-
frontend/src/app/framework/configurations.ts
-
frontend/src/app/framework/services/localizer.service.ts
-
frontend/src/app/framework/utils/error.spec.ts
-
frontend/src/app/framework/utils/math-helper.ts
|
|
|
@ -78,11 +78,11 @@ export class FormattableInputComponent implements ControlValueAccessor, AfterVie |
|
|
|
const lower = obj.toLowerCase(); |
|
|
|
|
|
|
|
if (lower.startsWith('liquid(')) { |
|
|
|
this.value = obj.substr(7, obj.length - 8); |
|
|
|
this.value = obj.substring(7, obj.length - 1); |
|
|
|
|
|
|
|
mode = 'Liquid'; |
|
|
|
} else if (lower.startsWith('script(')) { |
|
|
|
this.value = obj.substr(7, obj.length - 8); |
|
|
|
this.value = obj.substring(7, obj.length - 1); |
|
|
|
|
|
|
|
mode = 'Script'; |
|
|
|
} |
|
|
|
|
|
|
|
@ -56,7 +56,7 @@ export class ControlErrorsComponent extends StatefulComponent<State> implements |
|
|
|
let translation = this.localizer.get(`common.${this.for}`)!; |
|
|
|
|
|
|
|
if (!translation) { |
|
|
|
translation = this.for.substr(0, 1).toUpperCase() + this.for.substr(1); |
|
|
|
translation = this.for.substring(0, 1).toUpperCase() + this.for.substring(1); |
|
|
|
} |
|
|
|
|
|
|
|
this.controlDisplayName = translation; |
|
|
|
|
|
|
|
@ -39,7 +39,7 @@ export class ErrorValidator { |
|
|
|
for (const details of this.error.details) { |
|
|
|
for (const property of details.properties) { |
|
|
|
if (property.startsWith(path)) { |
|
|
|
const subProperty = property.substr(path.length); |
|
|
|
const subProperty = property.substring(path.length); |
|
|
|
|
|
|
|
const first = subProperty[0]; |
|
|
|
|
|
|
|
@ -50,7 +50,7 @@ export class ErrorValidator { |
|
|
|
errors.push(`${subProperty}: ${details.message}`); |
|
|
|
break; |
|
|
|
} else if (first === '.') { |
|
|
|
errors.push(`${subProperty.substr(1)}: ${details.message}`); |
|
|
|
errors.push(`${subProperty.substring(1)}: ${details.message}`); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -58,7 +58,7 @@ const ColorDefinitions: ReadonlyArray<ColorDefinition> = [ |
|
|
|
|
|
|
|
function parseColor(value: string) { |
|
|
|
if (value.charAt(0) === '#') { |
|
|
|
value = value.substr(1, 6); |
|
|
|
value = value.substring(1, 7); |
|
|
|
} |
|
|
|
|
|
|
|
value = value.replace(/ /g, '').toLowerCase(); |
|
|
|
|
|
|
|
@ -22,7 +22,7 @@ export class MoneyPipe implements PipeTransform { |
|
|
|
public transform(value: number): any { |
|
|
|
const money = value.toFixed(2).toString(); |
|
|
|
|
|
|
|
let result = `${money.substr(0, money.length - 3) + this.separator.value}<span class="decimal">${money.substr(money.length - 2, 2)}</span>`; |
|
|
|
let result = `${money.substring(0, money.length - 3) + this.separator.value}<span class="decimal">${money.substring(money.length - 2)}</span>`; |
|
|
|
|
|
|
|
if (this.currency.showAfter) { |
|
|
|
result = `${result} ${this.currency.symbol}`; |
|
|
|
|
|
|
|
@ -47,7 +47,7 @@ export class ApiUrlConfig { |
|
|
|
|
|
|
|
public buildUrl(path: string) { |
|
|
|
if (path.indexOf('/') === 0) { |
|
|
|
path = path.substr(1); |
|
|
|
path = path.substring(1); |
|
|
|
} |
|
|
|
|
|
|
|
return this.value + path; |
|
|
|
|
|
|
|
@ -56,7 +56,7 @@ export class LocalizerService { |
|
|
|
|
|
|
|
private replaceVariables(text: string, args: {}): string { |
|
|
|
text = text.replace(/{[^}]*}/g, (matched: string) => { |
|
|
|
const inner = matched.substr(1, matched.length - 2); |
|
|
|
const inner = matched.substring(1, matched.length - 1); |
|
|
|
|
|
|
|
let replaceValue: string; |
|
|
|
|
|
|
|
|
|
|
|
@ -17,7 +17,7 @@ describe('ErrorDto', () => { |
|
|
|
|
|
|
|
localizer = Mock.ofType<LocalizerService>(); |
|
|
|
localizer.setup(x => x.getOrKey(It.isAnyString())) |
|
|
|
.returns((key: string) => key.substr(5)); |
|
|
|
.returns((key: string) => key.substring(5)); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should create simple message with error code', () => { |
|
|
|
|
|
|
|
@ -146,7 +146,7 @@ export module MathHelper { |
|
|
|
} |
|
|
|
|
|
|
|
if (value.charAt(0) === '#') { |
|
|
|
value = value.substr(1, 6); |
|
|
|
value = value.substr(1, 7); |
|
|
|
} |
|
|
|
|
|
|
|
value = value.replace(/ /g, '').toLowerCase(); |
|
|
|
|