Skip to content

Instantly share code, notes, and snippets.

@davidrhyswhite
Created August 21, 2014 21:08
Show Gist options
  • Save davidrhyswhite/40a9c37787a21328f494 to your computer and use it in GitHub Desktop.
Save davidrhyswhite/40a9c37787a21328f494 to your computer and use it in GitHub Desktop.
datum-entry
<link rel="import" href="../paper-input/paper-input.html">
<polymer-element name="datum-entity" attributes="fields">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
box-sizing: border-box;
}
#paper_input {
left: 20px;
top: 20px;
position: absolute;
}
</style>
<button on-tap="{{addField}}">Add field</button>
<section id="attributes"></section>
</template>
<script>
Polymer('datum-entity', {
fields: 0,
addField: function () {
var field = document.createElement("paper-input");
field.id="paper_input_" + this.fields;
field.label="Attribute name";
this.$.attributes.appendChild(field);
this.increment();
},
increment: function() {
this.fields++;
}
});
</script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment