Sha256: 3b8788ba7a29e880551e4b7e094b840c5dc94f0d6d9eaabff53b626922efa163
Contents?: true
Size: 1.2 KB
Versions: 5
Compression:
Stored size: 1.2 KB
Contents
= simple_form_for([:admin, @plan]) do |f| - if @plan.errors.any? #error_explanation %h2= "#{pluralize(@plan.errors.count, "error")} prohibited this plan from being saved:" %ul -@plan.errors.full_messages.each do |msg| %li= msg = f.input :name = f.input :price = f.input :billing_period, :collection => Plan::BILLING_PERIODS, :include_blank => false %fieldset %h4 Plan Attributes = f.label "Add new attribute" = text_field_tag "attribute_name" = link_to "Add attribute", "#", :id => "add_attribute" #optional_attributes -begin - @plan.dynamic_attributes.each do |da| = f.label da[0].gsub("field_", "") = text_field_tag "plan[#{da[0]}]", da[1] %br - rescue .actions = f.submit = link_to 'Cancel', :back :javascript $(document).ready(function(){ $('#add_attribute').click(function(event) { event.preventDefault(); if ($('#attribute_name').val() == '') { alert("You must give your attribute a name."); } else { $('#optional_attributes').append("<br><label>" + $('#attribute_name').val() +"</label><input name='plan[field_" + $('#attribute_name').val() +"]' id='field_" + $('#attribute_name').val() +"'>"); } }) })
Version data entries
5 entries across 5 versions & 1 rubygems