mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 22:46:38 +02:00
Move title into keepright error header
This commit is contained in:
@@ -6,24 +6,39 @@ import { t } from '../util/locale';
|
||||
|
||||
|
||||
export function uiKeepRightDetails(context) {
|
||||
var stringBase = 'QA.keepRight.errorTypes.';
|
||||
var _error;
|
||||
|
||||
function keepRightDetails(selection) {
|
||||
if (!_error) return;
|
||||
|
||||
var errorType = _error.error_type;
|
||||
function errorDetail(d) {
|
||||
var unknown = t('inspector.unknown');
|
||||
|
||||
if (!d) return unknown;
|
||||
var errorType = d.error_type;
|
||||
|
||||
var template = errorTypes[errorType];
|
||||
if (!template) return;
|
||||
if (!template) return unknown;
|
||||
|
||||
// if there is a parent, save its error type e.g.:
|
||||
// Error 191 = "highway-highway"
|
||||
// Error 190 = "intersections without junctions" (parent)
|
||||
var parentErrorType = (Math.floor(errorType / 10) * 10).toString();
|
||||
var parentTemplate = errorTypes[parentErrorType];
|
||||
if (!parentTemplate) return;
|
||||
if (!parentTemplate) return unknown;
|
||||
|
||||
var et = dataEn.QA.keepRight.errorTypes[errorType];
|
||||
var pt = dataEn.QA.keepRight.errorTypes[parentErrorType];
|
||||
|
||||
if (et && et.description) {
|
||||
return t('QA.keepRight.errorTypes.' + errorType + '.description', d.replacements);
|
||||
} else if (pt && pt.description) {
|
||||
return t('QA.keepRight.errorTypes.' + parentErrorType + '.description', d.replacements);
|
||||
} else {
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function keepRightDetails(selection) {
|
||||
var details = selection.selectAll('.kr_error-details')
|
||||
.data(
|
||||
(_error ? [_error] : []),
|
||||
@@ -37,29 +52,6 @@ export function uiKeepRightDetails(context) {
|
||||
.append('div')
|
||||
.attr('class', 'kr_error-details kr_error-details-container');
|
||||
|
||||
var titleEnter = detailsEnter
|
||||
.append('div')
|
||||
.attr('class', 'kr_error-details-title');
|
||||
|
||||
titleEnter
|
||||
.append('h4')
|
||||
.text(function() { return t('QA.keepRight.detail_title'); });
|
||||
|
||||
titleEnter
|
||||
.append('div')
|
||||
.text(function() {
|
||||
var et = dataEn.QA.keepRight.errorTypes[errorType];
|
||||
var pt = dataEn.QA.keepRight.errorTypes[parentErrorType];
|
||||
|
||||
if (et && et.title) {
|
||||
return t(stringBase + errorType + '.title');
|
||||
} else if (pt && pt.title) {
|
||||
return t(stringBase + parentErrorType + '.title');
|
||||
} else {
|
||||
return t('inspector.unknown');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// description
|
||||
var description = detailsEnter
|
||||
@@ -73,18 +65,7 @@ export function uiKeepRightDetails(context) {
|
||||
description
|
||||
.append('div')
|
||||
.attr('class', 'kr_error-details-description-text')
|
||||
.html(function(d) {
|
||||
var et = dataEn.QA.keepRight.errorTypes[errorType];
|
||||
var pt = dataEn.QA.keepRight.errorTypes[parentErrorType];
|
||||
|
||||
if (et && et.description) {
|
||||
return t(stringBase + errorType + '.description', d.replacements);
|
||||
} else if (pt && pt.description) {
|
||||
return t(stringBase + parentErrorType + '.description', d.replacements);
|
||||
} else {
|
||||
return t('inspector.unknown');
|
||||
}
|
||||
});
|
||||
.html(errorDetail);
|
||||
|
||||
description.selectAll('.kr_error_description-id')
|
||||
.on('click', function() { clickLink(context, this.text); });
|
||||
|
||||
@@ -1,21 +1,54 @@
|
||||
import { t } from '../util/locale';
|
||||
import { dataEn } from '../../data';
|
||||
import { errorTypes } from '../../data/keepRight.json';
|
||||
import { svgIcon } from '../svg';
|
||||
import { t } from '../util/locale';
|
||||
|
||||
|
||||
export function uiKeepRightHeader() {
|
||||
var _error;
|
||||
|
||||
|
||||
function errorTitle(d) {
|
||||
var unknown = t('inspector.unknown');
|
||||
|
||||
if (!d) return unknown;
|
||||
var errorType = d.error_type;
|
||||
|
||||
var template = errorTypes[errorType];
|
||||
if (!template) return unknown;
|
||||
|
||||
// if there is a parent, save its error type e.g.:
|
||||
// Error 191 = "highway-highway"
|
||||
// Error 190 = "intersections without junctions" (parent)
|
||||
var parentErrorType = (Math.floor(errorType / 10) * 10).toString();
|
||||
var parentTemplate = errorTypes[parentErrorType];
|
||||
if (!parentTemplate) return unknown;
|
||||
|
||||
var et = dataEn.QA.keepRight.errorTypes[errorType];
|
||||
var pt = dataEn.QA.keepRight.errorTypes[parentErrorType];
|
||||
|
||||
if (et && et.title) {
|
||||
return t('QA.keepRight.errorTypes.' + errorType + '.title');
|
||||
} else if (pt && pt.title) {
|
||||
return t('QA.keepRight.errorTypes.' + parentErrorType + '.title');
|
||||
} else {
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function keepRightHeader(selection) {
|
||||
var header = selection.selectAll('.kr_error-header')
|
||||
.data(
|
||||
(_error ? [_error] : []),
|
||||
function(d) { return d.id; }
|
||||
function(d) { return d.status + d.id; }
|
||||
);
|
||||
|
||||
header.exit()
|
||||
.remove();
|
||||
|
||||
|
||||
|
||||
var headerEnter = header.enter()
|
||||
.append('div')
|
||||
.attr('class', 'kr_error-header');
|
||||
@@ -35,7 +68,7 @@ export function uiKeepRightHeader() {
|
||||
headerEnter
|
||||
.append('div')
|
||||
.attr('class', 'kr_error-header-label')
|
||||
.text(function(d) { return t('QA.keepRight.entities.' + d.object_type, { id: d.object_id }); });
|
||||
.text(errorTitle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user