Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DROTH-3884 render bearing value in read only form #2923

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions UI/src/view/point_asset/trafficSignForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@
};

var renderBearingElement = function (asset) {
var assetIsOutsideRoadNetwork = asset.validityDirection === validitydirections.outsideRoadNetwork;
var bearingElement = $('' +
' <div class="form-group editable form-point-asset">' +
' <label class="control-label">Suuntima</label>' +
' <input type="number" min=0, max=360 class="form-control" id=bearing required>' +
' <p class="form-control-static">' + (assetIsOutsideRoadNetwork ? asset.bearing : '') + '</p>' +
' </div>');
bearingElement.find('input').prop("disabled", asset.validityDirection != validitydirections.outsideRoadNetwork);
bearingElement.find('input').prop("valueAsNumber", asset.validityDirection != validitydirections.outsideRoadNetwork ? NaN : asset.bearing);
bearingElement.find('input').prop("disabled", !assetIsOutsideRoadNetwork);
bearingElement.find('input').prop("valueAsNumber", assetIsOutsideRoadNetwork ? asset.bearing : NaN);
return bearingElement;
};

Expand Down