Skip to content

Commit

Permalink
added input fields for adding new metadata (issue #39)
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Aug 21, 2016
1 parent 2c0199a commit c57190a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flat/style/flat.metadata.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@
#metadata table input {
width: 95%;
}
#metadata .buttons {
margin-top: 20px;
margin-bottom: 20px;
text-align: center;
margin-left: auto;
margin-right: auto;
}
15 changes: 15 additions & 0 deletions flat/style/flat.metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ function metadata_oninit() {
s = s + "<tr><td class=\"key\"><input id=\"metakey" + i + "\" value=\"" + key + "\" /></td><td class=\"value\"><input id=\"metavalue" + i + "\" value=\"" + metadata[key] + "\" /></td></tr>\n";
i++;
});
newfields = 0;
s = s + "<tr id=\"metadataplaceholder\"></tr>";
s = s + "</table>";
s = s + "<div class=\"buttons\"><button id=\"metadatasubmit\" onclick=\"metadata_submit\">Save changes</button> <button onclick=\"metadata_addinput()\">+</button></div>";
$('#metadata').html(s);
metadata_addinput();
}

function metadata_addinput() {
var i = metadata.length + newfields;
newfields++;
var s = "<tr><td class=\"key\"><input id=\"metakey" + i + "\" value=\"\" /></td><td class=\"value\"><input id=\"metavalue" + i + "\" value=\"\" /></td></tr>\n";
s = s + "<tr id=\"metadataplaceholder\"></tr>";
$('#metadataplaceholder')[0].outerHTML = s;
}

function metadata_submit() {
}

0 comments on commit c57190a

Please sign in to comment.