%form{:action=>"/cms/#{record.new_record? ? 'create' : 'update' }", :method=>'post', :enctype=>'multypart/form-date'} #edit_bg - model = record.class - if !record.new_record? %input{:type=>'hidden', :name=> "[#{model}][id]", :value=> record.id} - model.fields.each do |key, info| .item - name = "[#{model}][#{key}]" - if !["_type", "_id", "created_at", "updated_at", "version", "deleted_at"].include? key %label{key: key} %a= key %p{:style => 'color: red;'} - case info.options[:input] - when 'input' %input{:type=> 'text', :name=> name, :value=> record[key], :class=>"textfield", :type=> "text"} - when 'textarea' %textarea{:id => key, :name=> name}= record[key] - when 'date' %select{:name=>"[#{model}][#{key}(3i)]"} = select_options day_choices, record[key].day %select{:name=>"[#{model}][#{key}(2i)]"} = select_options month_choices, record[key].month %select{:name=>"[#{model}][#{key}(1i)]"} = select_options year_choices(0, 6), record[key].year - when 'dropdown' - when 'image' %p.image_select Selecteer image %input{:type => 'hidden', :id => 'file_select', :name=> name, :value => record[key]} - when 'images' - else %label Comming soon - if record.new_record? - record.connections.each do |connection| %input{:type=> 'hidden', :name=> "[#{record.class}][connections][][id]", :value => connection.id} %input{:type=> 'hidden', :name=> "[#{record.class}][connections][][parent_id]", :value => connection.parent_id} %input{:type=> 'hidden', :name=> "[#{record.class}][connections][][section]", :value => connection.section} - if connection.files == nil %input{:type=> 'hidden', :name=> "[#{record.class}][connections][][file]", :value => connection.section} - elsif connection.files.count == 1 %input{:type=> 'hidden', :name=> "[#{record.class}][connections][][file]", :value => connection.files.first} - elsif connection.files.count > 1 %select{:name => "[#{record.class}][connections][][file]"} - connection.files.each do |file| %option{:value => file}= file