<div class='container'>
  <div class='row'>
    <div class='col-md-8 col-md-offset-2'>
      <div class='well'>

        <h2>Sign up</h2>

        <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: 'form-horizontal' }) do |f| %>
          <%= devise_error_messages! %>
          <% if ENV['ON_HEROKU'] && User.count.zero? %>
          <div class="heroku-instructions">
            <% app_name = request.host[/\A[^.]+/] %>
            <p>If you are the owner of this application, take the following steps to complete the setup:</p>

            <ul>
              <li>Read <a href="https://github.com/cantino/huginn/wiki/Run-Huginn-for-free-on-Heroku" target="_target">this document</a> carefully if you are going to try out Huginn for free on <a href="https://id.heroku.com/" target="_target">Heroku</a>.</li>

              <li>Install the <a href="https://toolbelt.heroku.com/" target="_target">Heroku Toolbelt</a> and run <kbd>heroku login</kbd>, if you haven't already.</li>

              <li>Run the following commands:<br />
                <%= content_tag :pre do -%>
heroku git:clone --app <%= content_tag :var, app_name %>
cd <%= content_tag :var, app_name %>
bundle
cp .env.example .env
bin/setup_heroku
<%- end %>

              <li>This command will create an admin account for you.</li>
            </ul>
          </div>
          <% end %>

          <% if User.using_invitation_code? %>
            <div class="form-group">
              <%= f.label :invitation_code, class: 'col-md-4 control-label' %>
              <div class="col-md-6">
                <%= f.text_field :invitation_code, class: 'form-control' %>
                <span class="help-inline">We are not yet open to the public.  If you have an invitation code, please enter it here.</span>
              </div>
            </div>
          <% end %>

          <div class="form-group">
            <%= f.label :email, class: 'col-md-4 control-label' %>
            <div class="col-md-6">
              <%= f.email_field :email, autofocus: true, class: 'form-control' %>
            </div>
          </div>

          <div class="form-group">
            <%= f.label :username, class: 'col-md-4 control-label' %>
            <div class="col-md-6">
              <%= f.text_field :username, class: 'form-control' %>
            </div>
          </div>

          <div class="form-group">
            <%= f.label :password, class: 'col-md-4 control-label' %>
            <div class="col-md-6">
              <%= f.password_field :password, autocomplete: "off", class: 'form-control' %>
              <% if @validatable %><span class="help-inline"><%= @minimum_password_length %> characters minimum.</span><% end %>
            </div>
          </div>

          <div class="form-group">
            <%= f.label :password_confirmation, class: 'col-md-4 control-label' %>
            <div class="col-md-6">
              <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' %>
            </div>
          </div>

          <div class="form-group">
            <div class="col-md-offset-4 col-md-10">
              <%= f.submit "Sign up", class: "btn btn-primary" %>
            </div>
          </div>

        <% end %>

        <%= render "devise/shared/links" %>
      </div>
    </div>
  </div>
</div>
