-
Notifications
You must be signed in to change notification settings - Fork 0
Form Partial Tricks
In order to have Active Admin-style submit & cancel buttons, a hacky approach is unfortunately necessary because the usual f.actions
is a special function defined in Active Admin, and is not accessible from your partial.
However there is hope! If you want to have a consistent look on your forms, you can easily trick the browser into using Active Admin's styling rules:
<%= a.actions do %>
<%= a.action :submit %>
<li class="cancel"><%= link_to "Cancel", post %></li>
<% end %>
Note - you can change the 'cancel' link to go anywhere you want. In the above, it redirects to the Post index page. Be sure to change post
to the name of your model!
##Datepicker If, for some reason or another, you had to use a form partial, and you want to add a datepicker, you have to go about it a little differently, as :as => :datepicker won't work. Instead, do this (HAML style):
= semantic_form_for [:admin, @user] do |f|
= f.inputs "General" do
= f.input :birth_date, :as => :string, :input_html => {:class => "datepicker"}