-if model - my_event = eventbrite_events.select{|e| e.id == model.eventbrite_id.to_i }.first || nil - packet.add_js('events.js', :module => '_events_') %form{:action => "#{packet.route_to(model_name, model[:id], 'save')}", :method => 'post'} - for prop in props.reject{|v| v[:name].to_s =~ /location_/ || v[:name].to_s =~ /eventbrite/} %p= view_attribute(prop, model_name, :label => true, :value => model.attribute_get(prop[:name])) %fieldset %legend Venue %p %select{:id => "#{model_name}-venue", :name => "#{model_name}[orange_venue_id]"} %option(disabled) Choose a venue - for venue in eventbrite_venues %option{:value => venue.id, :selected => ((my_event && (venue.id == my_event.venue.id)) || venue.name == model.location_name)}= venue.name %option{:value => "new"} New... %a.show-venue-details{:href=>"#"} (Details) .new-venue :javascript var venues = #{venues_json}; - for prop in props.select{|v| v[:name].to_s =~ /location_/} %p= view_attribute(prop, model_name, :label => true, :value => model.attribute_get(prop[:name])) %fieldset %legend EventBrite %p %label Link to EventBrite? %input(type="hidden" value="0" name="events[link_to_eventbrite]") %input{:type=>"checkbox", :value=>"1", :name=>"events[link_to_eventbrite]", :checked=>(model.link_to_eventbrite ? true : false)} %p.eventbrite-link{:style => (model.link_to_eventbrite ? "" : "display:none;")} :javascript var events = #{events_json}; %label Which EventBrite Event? %br %select{:id => "#{model_name}-eventbrite-id", :name => "#{model_name}[eventbrite_id]"} %optgroup(label="Create a new event") %option{:value => "new"} New... %optgroup(label="Existing event") - for event in eventbrite_events %option{:value => event.id, :selected => (my_event && (my_event.id == event.id))}= event.title %p %label{:for => "#{model_name}-calendar"} Calendar %br %select{:id => "#{model_name}-calendar", :name => "#{model_name}[orange_calendar_id]"} - for calendar in calendars %option{:value => calendar.id, :selected => (model.calendar.id == calendar.id)}= calendar.name %p %label{:for => "#{model_name}-starts"} Starts %br %input{:type => 'text', :id => "#{model_name}-starts", :class => 'date', :name => "#{model_name}[starts_date]", :size => 10, :value => model.starts_date } at %input{:type => 'text', :name => "#{model_name}[starts_time]", :size => 8, :value => model.starts_time } %p %label{:for => "#{model_name}-ends"} Ends %br %input{:type => 'text', :id => "#{model_name}-ends", :size => 10, :class => 'date', :name => "#{model_name}[ends_date]", :value => model.ends_date } at %input{:type => 'text', :name => "#{model_name}[ends_time]", :size => 8, :value => model.ends_time } %input{:type => 'submit', :value => 'Save Event'} = form_link('Synchronize Eventbrite Attendees to Mailchimp', route_to(model_name, model.id, 'synchronize_attendees')) - else %p Couldn't find the event.