Created
August 21, 2014 21:08
-
-
Save davidrhyswhite/40a9c37787a21328f494 to your computer and use it in GitHub Desktop.
datum-entry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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