mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
added link for object in header
This commit is contained in:
committed by
Bryan Housel
parent
cbcdfc075c
commit
805dd394c9
+2
-1
@@ -337,13 +337,14 @@
|
||||
color: #b07f7e;
|
||||
}
|
||||
|
||||
.kr_error-details-description {
|
||||
.kr_error-details-title {
|
||||
text-align: left;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.kr_error-details-description {
|
||||
text-align: left;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.QA-buttons {
|
||||
|
||||
+6
-2
@@ -665,6 +665,10 @@ en:
|
||||
node: node
|
||||
way: way
|
||||
relation: relation
|
||||
highway: highway
|
||||
cycleway: cycleway
|
||||
waterway: waterway
|
||||
riverbank: riverbank
|
||||
errorTypes:
|
||||
errors:
|
||||
_30:
|
||||
@@ -689,10 +693,10 @@ en:
|
||||
description: 'missing tags'
|
||||
tooltip: 'This {var1} has an empty tag: {var2}'
|
||||
_71:
|
||||
description: ''
|
||||
description: 'way without tags'
|
||||
tooltip: 'This way has no tags'
|
||||
_72:
|
||||
description: ''
|
||||
description: 'node without tags'
|
||||
tooltip: 'This node is not member of any way and doesn''t have any tags'
|
||||
_90:
|
||||
description: 'motorways without ref'
|
||||
|
||||
Vendored
+7
-3
@@ -803,7 +803,11 @@
|
||||
"entities": {
|
||||
"node": "node",
|
||||
"way": "way",
|
||||
"relation": "relation"
|
||||
"relation": "relation",
|
||||
"highway": "highway",
|
||||
"cycleway": "cycleway",
|
||||
"waterway": "waterway",
|
||||
"riverbank": "riverbank"
|
||||
},
|
||||
"errorTypes": {
|
||||
"errors": {
|
||||
@@ -836,11 +840,11 @@
|
||||
"tooltip": "This {var1} has an empty tag: {var2}"
|
||||
},
|
||||
"_71": {
|
||||
"description": "",
|
||||
"description": "way without tags",
|
||||
"tooltip": "This way has no tags"
|
||||
},
|
||||
"_72": {
|
||||
"description": "",
|
||||
"description": "node without tags",
|
||||
"tooltip": "This node is not member of any way and doesn't have any tags"
|
||||
},
|
||||
"_90": {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { t } from '../util/locale';
|
||||
import { parseErrorDescriptions, errorTypes } from '../util';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
|
||||
export function uiKeepRightDetails() {
|
||||
export function uiKeepRightDetails(context) {
|
||||
var _error;
|
||||
var _template;
|
||||
var _templateErrorType;
|
||||
@@ -11,6 +12,8 @@ export function uiKeepRightDetails() {
|
||||
var _parent_error_type = '';
|
||||
var _titleBase;
|
||||
|
||||
var _links;
|
||||
|
||||
|
||||
function initDetails() {
|
||||
if (errorTypes.errors['_' + _error.error_type]) {
|
||||
@@ -18,7 +21,7 @@ export function uiKeepRightDetails() {
|
||||
_template = errorTypes.errors[_templateErrorType];
|
||||
_category = 'errors';
|
||||
} else if (errorTypes.warnings[_templateErrorType]) {
|
||||
_template = errorTypes.errors[_templateErrorType];
|
||||
_template = errorTypes.warnings[_templateErrorType];
|
||||
_category = 'warnings';
|
||||
} else { return; }
|
||||
|
||||
@@ -54,6 +57,7 @@ export function uiKeepRightDetails() {
|
||||
.append('div')
|
||||
.attr('class', 'kr_error-details kr_error-details-container');
|
||||
|
||||
|
||||
// title
|
||||
var title = detailsEnter
|
||||
.append('div')
|
||||
@@ -68,7 +72,7 @@ export function uiKeepRightDetails() {
|
||||
|
||||
// if this is a subtype, append it's parent title
|
||||
if (_parent_error_type) {
|
||||
title = t(_titleBase + _parent_error_type + '.description' + ':\n');
|
||||
title = t(_titleBase + _parent_error_type + '.description') + ':\n';
|
||||
}
|
||||
|
||||
// append title
|
||||
@@ -79,6 +83,7 @@ export function uiKeepRightDetails() {
|
||||
return title;
|
||||
});
|
||||
|
||||
|
||||
// description
|
||||
var description = detailsEnter
|
||||
.append('div')
|
||||
@@ -90,9 +95,18 @@ export function uiKeepRightDetails() {
|
||||
|
||||
description
|
||||
.append('div')
|
||||
.attr('class', 'kr_error-details-description-text')
|
||||
.text(function(d) {
|
||||
return t(_titleBase + _templateErrorType + '.tooltip', parseErrorDescriptions(d));
|
||||
});
|
||||
|
||||
// TODO: add links to ids in description
|
||||
// d3_select('.kr_error-details-description-text').enter()
|
||||
// .append('span')
|
||||
// .append('a')
|
||||
// .text(function(d) { return d.object_id; })
|
||||
// .on('click', function() { console.log('hi'); });
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
export function uiKeepRightEditor(context) {
|
||||
var dispatch = d3_dispatch('change');
|
||||
var keepRightComment = uiKeepRightComment();
|
||||
var keepRightDetails = uiKeepRightDetails();
|
||||
var keepRightDetails = uiKeepRightDetails(context);
|
||||
var keepRightHeader = uiKeepRightHeader(context);
|
||||
|
||||
var _error;
|
||||
|
||||
@@ -1,14 +1,44 @@
|
||||
import { t } from '../util/locale';
|
||||
import { svgIcon } from '../svg';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
import { geoChooseEdge } from '../geo';
|
||||
import { modeSelect } from '../modes';
|
||||
|
||||
|
||||
export function uiKeepRightHeader(context) {
|
||||
var _error;
|
||||
|
||||
|
||||
function getEntityLink() {
|
||||
function clickLink() {
|
||||
var d = {};
|
||||
|
||||
var url = context.connection().entityURL(context.entity(_error.object_id));
|
||||
var entityType =
|
||||
_error.object_type === 'node' ? 'n' :
|
||||
_error.object_type === 'way' ? 'w' :
|
||||
_error.object_type === 'relation' ? 'r' : null;
|
||||
|
||||
// if an entity has been loaded in the graph, select the entity
|
||||
if (context.hasEntity(entityType + _error.object_id)) {
|
||||
d = context.hasEntity(entityType + _error.object_id);
|
||||
}
|
||||
|
||||
d3_event.preventDefault();
|
||||
if (d.location) {
|
||||
context.map().centerZoom([d.location[1], d.location[0]], 19);
|
||||
}
|
||||
else if (d.entity) {
|
||||
if (d.entity.type === 'node') {
|
||||
context.map().center(d.entity.loc);
|
||||
} else if (d.entity.type === 'way') {
|
||||
var center = context.projection(context.map().center());
|
||||
var edge = geoChooseEdge(context.childNodes(d.entity), center, context.projection);
|
||||
context.map().center(edge.loc);
|
||||
}
|
||||
context.enter(modeSelect(context, [d.entity.id]));
|
||||
} else {
|
||||
// TODO: turn on osm layer
|
||||
context.zoomToEntity(d.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,12 +72,11 @@ export function uiKeepRightHeader(context) {
|
||||
headerEnter
|
||||
.append('div')
|
||||
.attr('class', 'kr_error-header-label')
|
||||
.text(function(d) {
|
||||
return t('keepRight.entities.' + d.object_type + ' ');
|
||||
})
|
||||
.text(function(d) { return t('keepRight.entities.' + d.object_type) + ' '; })
|
||||
.append('span')
|
||||
// .attr('href', getEntityLink()) // TODO: add / remove link if entity is/isn't in the graph
|
||||
.text(function(d) { return d.object_id; });
|
||||
.append('a')
|
||||
.text(function(d) { return d.object_id; })
|
||||
.on('click', clickLink);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -722,7 +722,7 @@ export function uiMapData(context) {
|
||||
|
||||
// context.errors()
|
||||
// .on('change.map_data-update', update); // TODO: add errors list to context?
|
||||
|
||||
''
|
||||
update();
|
||||
setFill(_fillSelected);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ export function parseErrorDescriptions(entity) {
|
||||
var parsedDescriptions = [];
|
||||
var re = new RegExp(/{\$[0-9]}/);
|
||||
|
||||
var commonEntities = ['node', 'way', 'relation']; // TODO: expand this list, or implement a different translation function
|
||||
var commonEntities = ['node', 'way', 'relation', 'highway', 'cycleway', 'waterway', 'riverbank']; // TODO: expand this list, or implement a different translation function
|
||||
|
||||
templateDescriptions.forEach(function(word, index) {
|
||||
if (!re.test(word)) return;
|
||||
|
||||
Reference in New Issue
Block a user