<% content_for :title, "Send Invitation" %>
<%= link_to "← Back to Invitations", admin_invitations_path, class: "text-sm font-medium text-blue-600 hover:text-blue-500" %>

Send Invitation

Invite a new user to join Sanasto Wiki

<%= form_with model: @invitation, url: admin_invitations_path, class: "space-y-6" do |f| %> <% if @invitation.errors.any? %>

<%= pluralize(@invitation.errors.count, "error") %> prohibited this invitation from being sent:

    <% @invitation.errors.full_messages.each do |message| %>
  • <%= message %>
  • <% end %>
<% end %>
<%= f.label :email, class: "block text-sm font-medium text-gray-700" %> <%= f.email_field :email, required: true, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm", placeholder: "user@example.com" %>

The user will receive an invitation email with a link to register.

<%= f.label :name, "Name (optional)", class: "block text-sm font-medium text-gray-700" %> <%= f.text_field :name, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm", placeholder: "John Doe" %>
<%= f.label :role, class: "block text-sm font-medium text-gray-700" %> <%= f.select :role, User.roles.keys.map { |r| [r.humanize, r] }, {}, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" %>

Contributor: Can create/edit entries and comments.
Reviewer: Can review suggestions and verify entries.
Admin: Full access to all features.

<%= f.label :primary_language, "Primary Language (optional)", class: "block text-sm font-medium text-gray-700" %> <%= f.select :primary_language, SupportedLanguage.pluck(:code, :native_name), { include_blank: "Select language" }, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" %>

Note: The invitation link will expire in 14 days. The user will need to accept the invitation before the expiration date.

<%= link_to "Cancel", admin_invitations_path, class: "px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" %> <%= f.submit "Send Invitation", class: "inline-flex justify-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" %>
<% end %>