Skip to content

Commit

Permalink
allow the json schema to have a 'label' value to customise the label …
Browse files Browse the repository at this point in the history
…text used on forms #383
  • Loading branch information
jstrachan committed Jul 8, 2013
1 parent 20e6d0a commit d2c0557
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/forms/js/baseDirectives.ts
Expand Up @@ -80,7 +80,7 @@ module Forms {
// TODO always use 2 way binding?
modelName = config.getEntity() + "." + id;
}
group.append(Forms.getLabel(config, config, attrs["title"] || id));
group.append(Forms.getLabel(config, config, attrs["title"] || humanizeValue(id)));
var controlDiv = Forms.getControlDiv(config);
controlDiv.append(this.getInput(config, config, id, modelName));
controlDiv.append(Forms.getHelpSpan(config, config, id));
Expand Down
4 changes: 2 additions & 2 deletions hawtio-web/src/main/webapp/app/forms/js/helpers.ts
Expand Up @@ -155,8 +155,8 @@ module Forms {
return rc;
}

export function getLabel(config, arg, id) {
return $('<label class="' + config.labelclass + '">' + humanizeValue(id) + ': </label>');
export function getLabel(config, arg, label) {
return $('<label class="' + config.labelclass + '">' + label + ': </label>');
}

export function getControlDiv(config) {
Expand Down
Expand Up @@ -233,6 +233,12 @@ module Forms {
input.attr('data', configScopeName);
}

// TODO add a title if there is one in the schema
var label = property.label;
if (label) {
input.attr('title', label);
}

if (tabs.use) {
var tabkey = tabs.locations[id];
if (!tabkey) {
Expand Down
5 changes: 5 additions & 0 deletions hawtio-web/src/main/webapp/app/wiki/js/dozerMappings.ts
Expand Up @@ -22,6 +22,11 @@ module Wiki {
'To Class': ['class-b\\..*'],
'Class Configuration': ['*']
};
Core.pathSet(io_hawt_dozer_schema_Field, ["properties", "a", "properties", "value", "label"], "From Field");
Core.pathSet(io_hawt_dozer_schema_Field, ["properties", "b", "properties", "value", "label"], "To Field");

Core.pathSet(io_hawt_dozer_schema_Mapping, ["properties", "class-a", "properties", "value", "label"], "From Class");
Core.pathSet(io_hawt_dozer_schema_Mapping, ["properties", "class-b", "properties", "value", "label"], "To Class");

$scope.gridOptions = {
selectedItems: $scope.selectedItems,
Expand Down

0 comments on commit d2c0557

Please sign in to comment.