<%= javascript_pack_tag "colorPicker", defer: true %>

<h3>Join An Organization</h3>
<h5>Do you have the secret code?</h5>

<%= form_tag "/users/join_org" do %>
  <div class="field">
    <%= label_tag :org_secret, "Secret" %>
    <%= text_field_tag :org_secret, nil, placeholder: "Provided to you by an org admin" %>
  </div>
  <div class="field">
    <%= submit_tag "Join Organization" %>
  </div>
<% end %>
<br /><br />
<hr class="settings-hr" />
<h3><em>Or</em> Create An Organization</h3>
<sub><em>Starred fields are required</em></sub>

<%= form_for @organization do |f| %>
  <div class="field">
    <%= f.label :name, "Name *" %>
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <%= f.label :slug, "Username *" %>
    <%= f.text_field :slug %>
    <sub><em>Your organization URL will be dev.to/{username}</em></sub>
  </div>
  <div class="field">
    <%= f.label :profile_image, "Profile Image *" %>
    <%= f.file_field :profile_image %>
  </div>
  <div class="field">
    <%= f.label :twitter_username, "Twitter Username" %>
    <%= f.text_field :twitter_username %>
  </div>
  <div class="field">
    <%= f.label :github_username, "Github Username" %>
    <%= f.text_field :github_username %>
  </div>
  <div class="field">
    <%= f.label :text_color_hex, "Text color (hex)" %>
    <%= text_field_tag "organization[text_color_hex]", "#000000", placeholder: "Click for color picker", class: "color-picker" %>
    <div class="color-palette"></div>
  </div>
  <div class="field">
    <%= f.label :bg_color_hex, "Background color (hex)" %>
    <%= text_field_tag "organization[bg_color_hex]", "#FFFFFF", placeholder: "Click for color picker", class: "color-picker" %>
    <div class="color-palette"></div>
  </div>
  <div class="field">
    <%= f.label :url, "Website url *" %>
    <%= f.url_field :url, placeholder: "https://yoursite.com" %>
  </div>

  <div class="field">
    <%= f.label :summary, "Summary *" %>
    <%= f.text_area :summary %>
  </div>
  <div class="field">
    <%= f.label :proof, "Proof *" %>
    <%= f.text_area :proof, placeholder: "This is just a quick blurb indicating or link that shows that you clearly are associated with this organization." %>
    <div style="width:560px;max-width:90%;">
      You must have your organization's permission to submit this form. Dishonesty may result in a permanent ban.
    </div>
  </div>
  <div class="field">
    <label></label>
    <%= f.submit "SUBMIT", class: "cta" %>
  </div>
<% end %>
