Note that there are some explanatory texts on larger screens.

plurals
  1. POActiveAdmin guidance for working on custom form (custom action?)
    text
    copied!<p>I'm looking for some guidance to make a custom form with ActiveAdmin. This is not a regular form, but I actually need some JavaScript on it. However, I'm not familiar with ActiveAdmin right now.</p> <p>I have a form that will collect a Product list. Every time I add a Product to the list, I need to recalculate the sub-total for the order (based on quantity and unique price).</p> <p>For adding the products I'm using regular Formtastic, like this:</p> <pre><code>f.inputs "Product List" do f.has_many :product_lists do |detail| detail.input :good_id, :as =&gt; :select, :collection =&gt; Good.accessible_by(current_ability, :read), :input_html =&gt; { class: 'chosen-select' }, :include_blank =&gt; true detail.input :quantity, :input_html =&gt; { :value =&gt; 1 } end end </code></pre> <p>However, I came across to multiple questions:</p> <ul> <li>How should I recalculate the sub-totals every time I add a new product on the list? Should I use a <a href="http://www.activeadmin.info/docs/8-custom-actions.html" rel="nofollow">custom collection action</a>? I was even considering a Backbone App inside of it, for handling the whole process.</li> <li>Is there a better way, instead of using a Custom Action?</li> <li>Is there a good way to use a custom action ONLY for the new form? I was able to make a new one, but I was not able to have control over the form.</li> <li>How can I have better control of the form panel? I was not able to add panels inside the form block :(.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload