app/views/push_notifications/new.html.erb
<% data_providers_for_select = @data_providers.map { |dp| [dp.name, dp.id] }
.sort_by { |dp| dp[0].downcase } %>
<div class="text-center">
<h1 class="h3 mb-0 font-weight-bold">Push-Notification erstellen</h1>
</div>
<div class="row justify-content-center">
<div class="col-lg-8">
<%= form_with(url: push_notifications_path, method: :post, local: true) do %>
<%= fields_for :push_notification, @push_notification do |f| %>
<div class="row">
<div class="col">
<div class="form-group">
<%= f.label :title, "Titel *" %>
<%= f.text_field :title, class: "form-control", required: true %>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<%= f.label :body, "Nachricht" %>
<%= f.text_field :body, class: "form-control" %>
</div>
</div>
</div>
<%= f.fields_for :data do |fd| %>
<div class="row">
<div class="col">
<div class="form-group">
<%= fd.label :data_provider_id, "Data-Provider-ID" %>
<%= fd.select :data_provider_id,
options_for_select(data_providers_for_select),
{ include_blank: true },
class: "form-control" %>
</div>
</div>
</div>
<% end %>
<hr />
<div class="row justify-content-center pb-4">
<%= f.submit "Senden", class: "btn btn-primary btn--big" %>
</div>
<% end %>
<% end %>
</div>
</div>