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

Issue#59: Remove colon from the title #13

Merged
merged 2 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@
<script src="src/js/brutusin-json-forms-bootstrap.js"></script>
<script lang="javascript">
var BrutusinForms = brutusin["json-forms"];
BrutusinForms.bootstrap.addFormatDecorator("inputstream", "file", "glyphicon-search", function (element) {
BrutusinForms.bootstrap.addFormatDecorator("inputstream", "file", "glyphicon-search", null, function (element) {
alert("user callback on element " + element)
});
BrutusinForms.bootstrap.addFormatDecorator("color", "color");
BrutusinForms.bootstrap.addFormatDecorator("date", "date");
//Title decorator
BrutusinForms.bootstrap.addFormatDecorator(null, null, null, ":");
var codeMirrors = new Object();
var input = new Object();
var inputString = new Object();
Expand Down
9 changes: 8 additions & 1 deletion src/js/brutusin-json-forms-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ if (("undefined" === typeof $ || "undefined" === typeof $.fn || "undefined" ===
});
BrutusinForms.bootstrap = new Object();
// helper button for string (with format) fields
BrutusinForms.bootstrap.addFormatDecorator = function (format, inputType, glyphicon, cb) {
BrutusinForms.bootstrap.addFormatDecorator = function (format, inputType, glyphicon, titleDecorator, cb) {
BrutusinForms.addDecorator(function (element, schema) {
if (element.tagName) {
var tagName = element.tagName.toLowerCase();
Expand Down Expand Up @@ -156,6 +156,13 @@ if (("undefined" === typeof $ || "undefined" === typeof $.fn || "undefined" ===
}
}
}

if (element instanceof Text) {
var tagName = element.parentElement.tagName.toLowerCase();
if (tagName === "label" && titleDecorator) {
element.textContent = element.textContent + titleDecorator;
}
}
});
};
BrutusinForms.bootstrap.showLoading = function (element) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/brutusin-json-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ if (typeof brutusin === "undefined") {
if (schema.type !== "any" && schema.type !== "object" && schema.type !== "array") {
titleLabel.htmlFor = getInputId();
}
var titleNode = document.createTextNode(title + ":");
var titleNode = document.createTextNode(title);
appendChild(titleLabel, titleNode, schema);
if (schema.description) {
titleLabel.title = schema.description;
Expand Down