Skip to content

Instantly share code, notes, and snippets.

@leemcalilly
Created August 1, 2018 16:40
Show Gist options
  • Save leemcalilly/87f9893af662a54c16abb5bb725ef52f to your computer and use it in GitHub Desktop.
Save leemcalilly/87f9893af662a54c16abb5bb725ef52f to your computer and use it in GitHub Desktop.
<%= form_for(@quote) do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<div class='row'>
<div class='col'>
<div class='form-group'>
<%= f.label :speaker, 'Who said it?' %>
<%= f.collection_select :speaker_id, Artist.order(:name), :id, :name,
{prompt: 'Select an artist'}, {class: 'form-control select-artist'} %>
</div>
</div><!-- /.col -->
</div><!-- /.row -->
<div class='row'>
<div class='col'>
<div class='form-group'>
<%= f.label :topic, 'About whom?' %>
<%= f.collection_select :topic_id, Artist.order(:name), :id, :name,
{prompt: 'Select an artist'}, {class: 'form-control select-artist'} %>
</div>
</div><!-- /.col -->
</div><!-- /.row -->
<div class='row'>
<div class='col'>
<div class='form-group'>
<%= f.label :genre, 'Genre' %>
<%= f.grouped_collection_select :genre_id, Medium.order(:name), :genres,
:name, :id, :name, {prompt: 'Select a genre'}, {class: 'form-control selectize'} %>
</div>
</div><!-- /.col -->
</div><!-- /.row -->
<div class='form-group'>
<%= f.label :source, 'Cite your source' %>
<%= f.url_field :source, class: 'form-control',
placeholder: 'http://' %>
<small class="form-text text-muted">
Must be a valid url.
</small>
</div>
<div class='form-group'>
<%= f.label :text, 'Share the quote...' %>
<%= f.text_area :text, class: 'form-control', rows: 8 %>
<small class="form-text text-muted">
We'll add the "double quotes" for you.
</small>
</div>
<% if @quote.new_record? %>
<%= f.submit 'Add Quote', class: 'btn btn-primary btn-block' %>
<% else %>
<%= f.submit 'Update Quote', class: 'btn btn-primary btn-block' %>
<% end %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment