<%= simple_form_for @report, html: @report.persisted? ? ajax_form_hash( '#report_info_container' ) : {} do |f| %>
<%= f.input :name, minlength: false %>
<%= f.input :resource_type,
collection: ClarkKent.resource_options,
label: 'A row for every:',
prompt: 'Please Choose' %>
sharing
<%= f.input :sharing_scope_type, collection: ClarkKent::SharingScopeKind.select_options_for_user(clark_kent_user),
input_html: revealer("sharing_options", highlander: true),
label: false, include_blank: false %>
>
<%= f.input :sharing_scope_id, as: :hidden, input_html: {value: clark_kent_user.id, data: {foo: ClarkKent.user_class_name}}, wrapper_html: revealer_option("sharing_options", trigger: ClarkKent.user_class_name).merge(id: "sharing_options_#{ClarkKent.user_class_name}") %>
<% ClarkKent::SharingScopeKind.custom_for_user(clark_kent_user).each do |sharing_scope_kind| %>
<% if sharing_scope_kind.associated_containers_for(clark_kent_user).respond_to? :each %>
<%= f.input :sharing_scope_id, collection: sharing_scope_kind.associated_containers_for(clark_kent_user), label: false, include_blank: false,
wrapper_html: revealer_option("sharing_options", trigger: sharing_scope_kind.class_name).merge(id: "sharing_options_#{sharing_scope_kind.class_name}") %>
<% else %>
<%= f.input :sharing_scope_id, as: :hidden, input_html: {value: sharing_scope_kind.associated_containers_for(clark_kent_user).id}, wrapper_html: revealer_option("sharing_options", trigger: sharing_scope_kind.associated_containers_for(clark_kent_user).class.name).merge(id: "sharing_options_#{sharing_scope_kind.associated_containers_for(clark_kent_user).class.name}") %>
<% end %>
<% end %>
<%= f.input :sharing_scope_id, as: :hidden, input_html: {value: ''},
wrapper_html: revealer_option("sharing_options", trigger: "").merge(id: "sharing_options_") %>
<%= f.button :submit %>
<% unless @report.new_record? %>
<%= ajax_link 'cancel', report_url(@report), {class: 'right'}, "#report_info_container" %>
or
<%= link_to "Delete Report", @report, class: 'right', :method=>:delete, :data => { delete_link: true, :confirm => "Are you sure you want to delete this report?" } %>
<% end %>
<% end %>