Add slim-rails gem for templates
Add minitest-spec-rails and factory_girl

Future tests will use these

Some existing controller test classes had to be renamed
Create Member model scoped on website
Add responders gem for smarter respond_with
Add /admin/members ui for managing members

Add let! test helper too
Disallow blank username, set to nil

validates :username, uniqueness: { scope: :website_id }, allow_nil: true

Only one user could have had "" as username
Many can have nil
Add HasSecurePasswordWhenApproved validations
Add liquid MemberDrop and ErrorDrop
Add MemberMailer#approved
Add UpdateMember service

It gives members a password on approval
It triggers MemberMailer on approval
It sends password to mailer when setting password so user receives it
Only skip json wrapping in MembershipsController

We dont want root:false as default because it creates a weird situation
where data cannot be sideloaded beside the model json
However WebsiteMembershipsController still needs unwrapped json because
the angular app that uses it requires unwrapped json as of now
Use UpdateMember in Admin::MembersController
Add MemberSession service and current_member

MemberSession.get is used to resume session
MemberSession.update is used to assign session[:member_id]
MemberSession.destroy is used to unset session[:member_id]

current_member is accessible in controllers and liquid templates

    {% if current_member %}
    Signed in as {{current_member.full_name}}
    {% else %}
    <a href="/members/signin">Logga in</a>
    {% %}
Add Members::SessionsController

Also some helpful test helpers
Also add render_slug method which makes it easier to use
render_the_template
Add Members::SignupsController
Make form_authenticity_token available to liquid

Very handy when making signup/signin forms

Example:

    <form accept-charset="UTF-8" action="/members/signup" method="post">
      <div style="margin:0;padding:0;display:inline">
        <input name="utf8" type="hidden" value="✓">
        <input name="authenticity_token" type="hidden"
    value="{{form_authenticity_token}}">
      </div>

      <p>
        <label for="member_email">E-postadress</label><br>
        <input id="member_email" name="member[email]" type="text"
          value="{{member.email}}" {% if member.errors contains 'email' %}
          class="error"{% endif %}>
        {% for error in member.errors.email %}
        <small>{{error}}</small>
        {% endfor %}
      </p>

      <input class="submit" name="commit" type="submit" value="OK">
    </form>
Enforce Member#email format, presence and downcase
Fix buggy Member#full_adress, never show only ','
Merge pull request #37 from standout/members

Members feature