Basic add-contrib form

This commit is contained in:
2017-02-04 20:12:12 +08:00
parent dcb544c94f
commit 9120d67ad1
11 changed files with 143 additions and 5 deletions
@@ -0,0 +1,35 @@
import Ember from 'ember';
export default Ember.Component.extend({
id: null,
realName: null,
address: null,
classId: function() {
let value = this.get('id');
return (Ember.isEmpty(value)) ? null : 'valid';
}.property('id'),
classRealName: function() {
let value = this.get('realName');
return (Ember.isEmpty(value)) ? null : 'valid';
}.property('realName'),
classAddress: function() {
let value = this.get('address');
return (Ember.isEmpty(value)) ? null : 'valid';
}.property('address'),
actions: {
save() {
console.log('id', this.get('id'));
console.log('realName', this.get('realName'));
console.log('address', this.get('address'));
}
}
});
@@ -0,0 +1,26 @@
<form {{action "save" on="submit"}}>
<p>
{{input name="id"
type="text"
placeholder="GitHub UID (123)"
value=id
class=classId}}
</p>
<p>
{{input name="realname"
type="text"
placeholder="Carl Sagan"
value=realName
class=classRealName}}
</p>
<p>
{{input name="address"
type="text"
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
value=address
class=classAddress}}
</p>
<p>
<input type="submit" value="Save">
</p>
</form>