Skip to content

Commit

Permalink
Merge pull request #13 from saicheck2233/issue#59
Browse files Browse the repository at this point in the history
Issue#59: Remove colon from the title
  • Loading branch information
saicheck2233 authored Jul 11, 2023
2 parents 235f79d + 1ef0e5e commit c1d846e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
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 @@ -155,7 +155,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 @@ -187,6 +187,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

0 comments on commit c1d846e

Please sign in to comment.