Advertisement
Guest User

Untitled

a guest
Jul 10th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import m from 'mithril';
  2.  
  3. import Form from './form';
  4.  
  5. const Profile = {
  6. controller(props) {
  7. const profile = {
  8. username: m.prop('bob'),
  9. password: m.prop(''),
  10. displayEmail: m.prop(false),
  11. age: m.prop(21.5),
  12. bio: m.prop(''),
  13. };
  14.  
  15. return {
  16. profile
  17. }
  18. },
  19.  
  20. view (ctrl, props) {
  21. const { profile } = ctrl;
  22.  
  23. return m('.profile', [
  24. m(Form, {data: profile, action: '/profile' }, [
  25. m('input', {name: 'username', placeholder: 'username', value: profile.username()}),
  26. m('input', {type: 'password', name: 'password', placeholder: 'password', value: profile.password()}),
  27. m('input', {name: 'age', placeholder: 'age', value: profile.age(), format: 'float:2'}),
  28. m('textarea', {name: 'bio'}, profile.bio()),
  29. m('span', 'Display Email?'),
  30. m('input', {name: 'displayEmail', type: 'checkbox'}),
  31. m('button', 'Submit')
  32. ])
  33. ]);
  34. }
  35. }
  36.  
  37. export default Profile;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement