WIP New user signup
This commit is contained in:
		
							parent
							
								
									19359c341d
								
							
						
					
					
						commit
						a8fdff6be0
					
				
					 11 changed files with 79 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -2,6 +2,7 @@ import DS from 'ember-data';
 | 
			
		|||
 | 
			
		||||
export default DS.Model.extend({
 | 
			
		||||
  email    : DS.attr('string'),
 | 
			
		||||
  password : DS.attr('string'),
 | 
			
		||||
  name     : DS.attr('string'),
 | 
			
		||||
  role     : DS.attr('string'),
 | 
			
		||||
  createdAt: DS.attr('date'),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,9 +29,9 @@
 | 
			
		|||
      </p>
 | 
			
		||||
    {{else}}
 | 
			
		||||
      <p class="foot">
 | 
			
		||||
        {{#link-to 'login' Login}}Login{{/link-to}}
 | 
			
		||||
        {{link-to 'Login' 'login'}}
 | 
			
		||||
        <br>
 | 
			
		||||
        Sign Up
 | 
			
		||||
        {{link-to 'Sign Up' 'users.new'}}
 | 
			
		||||
      </p>
 | 
			
		||||
    {{/if}}
 | 
			
		||||
  </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								app/pods/users/new/new-user-form/component.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								app/pods/users/new/new-user-form/component.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
 | 
			
		||||
export default Ember.Component.extend({
 | 
			
		||||
  classNames: ['grid-1'],
 | 
			
		||||
  passwordConfirm: null,
 | 
			
		||||
 | 
			
		||||
  actions: {
 | 
			
		||||
    save: function() {
 | 
			
		||||
      var user = this.get('user');
 | 
			
		||||
 | 
			
		||||
      if (user.get('isDirty')) {
 | 
			
		||||
        user.save();
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										30
									
								
								app/pods/users/new/new-user-form/template.hbs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								app/pods/users/new/new-user-form/template.hbs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
<div class="span-1">
 | 
			
		||||
  <fieldset>
 | 
			
		||||
    <legend>New User Signup</legend>
 | 
			
		||||
    <form>
 | 
			
		||||
      <ul>
 | 
			
		||||
        <li>
 | 
			
		||||
          <label>Name</label>
 | 
			
		||||
          {{input value=user.name}}
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
          <label>Email</label>
 | 
			
		||||
          {{input value=user.email}}
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
          <label>Password</label>
 | 
			
		||||
          {{input value=user.password}}
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
          <label>Password (confirm)</label>
 | 
			
		||||
          {{input value=passwordConfirm}}
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
          <a class="button-green smaller" {{action 'save'}}>
 | 
			
		||||
            Submit
 | 
			
		||||
          </a>
 | 
			
		||||
        </li>
 | 
			
		||||
      </ul>
 | 
			
		||||
    </form>
 | 
			
		||||
  </fieldset>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										14
									
								
								app/pods/users/new/route.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								app/pods/users/new/route.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
import UnauthenticatedRouteMixin from 'simple-auth/mixins/unauthenticated-route-mixin';
 | 
			
		||||
 | 
			
		||||
export default Ember.Route.extend(UnauthenticatedRouteMixin, {
 | 
			
		||||
  model: function() {
 | 
			
		||||
    return Ember.RSVP.hash({
 | 
			
		||||
      user: this.store.createRecord('user'),
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  setupController: function(controller, model) {
 | 
			
		||||
    controller.setProperties(model);
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										1
									
								
								app/pods/users/new/template.hbs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								app/pods/users/new/template.hbs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
{{users/new/new-user-form user=user}}
 | 
			
		||||
| 
						 | 
				
			
			@ -9,7 +9,6 @@ Router.map(function() {
 | 
			
		|||
  this.route('login');
 | 
			
		||||
  this.route('about');
 | 
			
		||||
  this.route('characteristics');
 | 
			
		||||
  this.route('users');
 | 
			
		||||
  this.route('measurements');
 | 
			
		||||
  this.route('compare');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -21,6 +20,9 @@ Router.map(function() {
 | 
			
		|||
    this.route('new');
 | 
			
		||||
    this.route('show', { path: ':strain_id' });
 | 
			
		||||
  });
 | 
			
		||||
  this.route('users', function() {
 | 
			
		||||
    this.route('new');
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export default Router;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue