Sha256: c90b333db1e05f418302f86e51c332e4e0dc535e9e128ca5a27e705dbdc8f0ab
Contents?: true
Size: 1.71 KB
Versions: 22
Compression:
Stored size: 1.71 KB
Contents
.carnival-select-options - if opt_obj.field.nested_form_modes?(:associate) - scope_html_id = opt_obj.scope_html_id .carnival-select-tag = select_tag opt_obj.select_tag_id, options_for_select(opt_obj.select_options), {:onchange => 'addOption("'+opt_obj.select_tag_id+'")', class: 'carnival-select'} - if scope_html_id.present? :javascript $('##{opt_obj.scope_html_id}').change(function(){#{opt_obj.scopeJSFunction}}); $(document).ready(function(){ updateNestedFormSelectHtml($('##{opt_obj.select_tag_id}'), #{opt_obj.has_new_action?}); }); - else = link_to t("nested_form.new"), "#", onclick: "createNewForm('.nested-form-list.#{opt_obj.field_name}', '#{opt_obj.field_name}'); return false;" /- if many_to_many_relation? opt_obj.model, opt_obj.field_name :javascript function addOption(selectId){ var option = $('#'+selectId).val(); if(option == -1) return; $('#'+option+'_options').show(); $('#'+option).prop('checked', true); $('#'+option+'_select_option').prop('disabled', true); $('#'+selectId).val(-1); //$('#'+selectId).trigger("chosen:updated"); } .carnival-form-options - checkbox_id = opt_obj.option_id OpenStruct.new(id: '') = check_box_tag opt_obj.option_name, '',true, id: checkbox_id, style: "display: none;" - opt_obj.available_options.each do |item| - checkbox_id = opt_obj.option_id item .carnival-form-options{id: "#{checkbox_id}_options", class: opt_obj.option_css_class(item) } %span = check_box_tag opt_obj.option_name, item.id, opt_obj.model_has_this_item?(item.id), id: checkbox_id, onclick: 'removeRelationOption("'+checkbox_id+'", "'+opt_obj.select_tag_id+'")' = item.to_label
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
carnival-0.1.1 | app/views/carnival/shared/form/_nested_form_options.html.haml |
carnival-0.1.0 | app/views/carnival/shared/form/_nested_form_options.html.haml |