Skip to content

Instantly share code, notes, and snippets.

@wrburgess
Last active January 7, 2022 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wrburgess/08717e6aedc267233c97f0eced87aafa to your computer and use it in GitHub Desktop.
Save wrburgess/08717e6aedc267233c97f0eced87aafa to your computer and use it in GitHub Desktop.
Form Templates - erb ruby rails html form input select textarea text number checkbox bootstrap5
<label class="label">License Period Start Date</label><br/>
<div class="input-group mb-3">
<div>
<span class="input-group-text label-from">From</span>
<input placeholder="From" type="date" name="q[license_period_start_date_gteq_datetime]" id="license_period_start_date_gteq_datetime" value="<%= params.dig(:q, :license_period_start_date_gteq_datetime) %>">
</div>
<div>
<span class="input-group-text label-to">To</span>
<input placeholder="To" type="date" name="q[license_period_start_date_lteq_datetime]" id="license_period_start_date_lteq_datetime" value="<%= params.dig(:q, :license_period_start_date_lteq_datetime) %>">
</div>
</div>
<div class="form-check form-switch">
<label class="form-check-label" for="active">Active</label>
<%= check_box_tag(:active, true, @instance.active, class: "form-check-input") %>
</div>
<div class="form-floating">
<input type="date" class="form-control" id="theatrical_release_date" name="theatrical_release_date" value="<%= selector_date_format(@instance.theatrical_release_date) %>">
<label for="theatrical_release_date" class="form-label">Theatrical Release Date</label>
</div>
<div class="form-floating">
<input type="number" class="form-control" id="renewal_fee" name="renewal_fee" value="<%= @instance.redirects_to %>" readonly>
<label for="renewal_fee" class="form-label">Renewal Fee</label>
</div>
<div class="form-floating">
<input type="text" class="form-control" id="id" value="<%= @instance.id %>" readonly>
<label for="id" class="form-label">ID</label>
</div>
<div class="form-floating mb-3">
<%= select_tag("q[agreement_type_eq]", options_for_select(AgreementTypes.options_for_select, @instance.agreement_type), prompt: "Select a type", class: "form-select") %>
<label for="q[agreement_type_eq]" class="form-label">Agreement Type</label>
</div>
<div class="form-group">
<label for="organization_id" class="form-label">Organization</label>
<%= select_tag(:organization_id, options_for_select(Organizations.all_options_for_select, @instance.organization_id), { multiple: false, prompt: "Select an org...", autocomplete: "off", class: "tom-select" }) %>
</div>
<%= javascript_tag do %>
var selectSettings = {
plugins: ['remove_button', 'input_autogrow', 'clear_button']
};
new Packs.application.TomSelect('#organization_id', selectSettings);
<% end %>
<div class="form-floating">
<input type="text" class="form-control" id="name" name="name" value="<%= @instance.name %>">
<label for="name" class="form-label">Name</label>
</div>
<div class="form-floating">
<textarea class="form-control" id="note" name="note" rows="2"><%= @instance.notes %></textarea>
<label class="form-check-label" for="note">Notes</label>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment