Skip to content

Instantly share code, notes, and snippets.

@ian
Created November 24, 2009 23:40
Show Gist options
  • Save ian/242339 to your computer and use it in GitHub Desktop.
Save ian/242339 to your computer and use it in GitHub Desktop.
<script type="text/javascript" charset="utf-8">
function submitNextAction() {
$.cocobox.spinner('Saving your event details. Please wait a moment.');
var form = $('#submit_next').get(0).form;
$(form).submit(); // go through jQuery so that Labelify clears the fields
}
</script>
<div style='width:100%'>
<% form_for :product, @product, :url => product_handler_next_route(@product,:control=>''), :html => {:id => 'control-form'} do |f| -%>
<<<<<<< HEAD:app/views/products/events/details.html.erb
<%= render :partial => '/products/events/details', :locals => {:f=>f} %>
=======
<%- content_for :head do -%>
<%= javascript_include_merged :product_details, :event_details %>
<%= stylesheet_link_merged :product_details %>
<%= google_maps_include_tags %>
<script type="text/javascript" charset="utf-8">
<%- if @product.map? -%>
var lat_lng = new GLatLng(<%= @product.geoloc.lat %>,<%= @product.geoloc.lng %>);
map_set = true;
<%- else -%>
var lat_lng = null;
<%- end -%>
// Steal the 'Today' button and make it 'Clear' instead
$.extend(DP_jQuery.datepicker,{
_gotoToday:function(field){
DP_jQuery.datepicker._hideDatepicker();
$(field).val('');
$('#scheduling-options').hide();
$('#product_reminder_number_of_days_before_event').val('None')
}
});
$(document).ready(function(){
$("#product_location").labelify({ labeledClass: "labelHighlight" });
$("#product_message").labelify({ labeledClass: "labelHighlight" });
$("#product_address").labelify({ labeledClass: "labelHighlight" });
//$("#product_phone").mask("(999) 999-9999",{placeholder:" "});
$.fn.colorbox.init();
$(".preview-button").click(function(e){
stop(e);
url = $(this).attr('href');
$.cocobox.spinner("preparing preview");
$.get('<%= product_save_path %>',$('#control-form').serialize(), function() {
$.fn.cocobox({width:"1100px", height:"90%", iframe:true, open:true, href:url,theme:'big-button'});
});
});
// dateFormat: 'yy-mm-dd'
$.datepicker.setDefaults( { showButtonPanel: true,
minDate: 0,
dateFormat: 'MM d, yy',
showOn: 'both',
selectOtherMonths: true,
showOtherMonths: true,
buttonImage: '/images/calendar_date_select/calendar.gif',
buttonImageOnly: true,
constrainInput: true,
currentText: 'Clear',
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
} );
$("#product_occurs_at").width(172).datepicker()// .bind(
// 'onSelect',
// function(e)
// {
// alert($(this).getDate())
// }
// );
$("#product_rsvp_by").width(172).datepicker();
$("#product_send_at").width(172).datepicker();
// Steal the 'Today' button and make it 'Clear' instead
$("#product_occurs_at").extend(DP_jQuery.datepicker,{
_gotoToday:function(field){
DP_jQuery.datepicker._hideDatepicker();
$(field).val('');
if (field == '#product_occurs_at') {
$('#scheduling-options').hide();
$('#product_send_rsvp_reminder_at').val(null)
$('#product_send_reminder_at').val(null)
}
}
});
});
</script>
<%- end -%>
<% geo_loc = @product.geoloc || Geokit::GeoLoc.new %>
<% if (logged_in? && current_user.email.empty?) && @product.notify_host_when_guests_reply == "none" -%>
<script type="text/javascript" charset="utf-8">
$(function(){
$('#product_notify_host_when_guests_reply_email_each').bind("change click keyup keydown",function(){
if ($('#product_notify_host_when_guests_reply_email_each').attr("checked")) {
$.cocobox.alert("You'll need to add an e-mail address to your <a href='/account/profile' target='_blank'>profile</a> to get notifications.");
$('#product_notify_host_when_guests_reply_email_each').unbind();
}
});
});
</script>
<% end -%>
<div class='hidden'>
<div id='address-did-you-mean' onsubmit='return false;'>
<div id="address-did-you-mean-more-info">
<p>Map Address <span class='error'></span></p>
<%- f.fields_for geo_loc do |fg| -%>
<%= fg.text_area :full_address, :id => "alternate-addresses-input" %>
<%- end -%>
<p>
<%= check_box_tag "override_address", '', true %>
<%= label_tag "override_address", "Use this address to update the event details" %>
</p>
</div>
<div id="address-did-you-mean-map">
<% widget_box :class => "box box-without-border-with-header", :style => "width: 250px;" do %>
<div id="map_canvas">Loading Location Map...</div>
<% end %>
<h3>This Info Will Also Populate Weather</h3>
</div>
<h2>Did you mean?</h2>
<div id='alternate-addresses'></div>
<%= button "Use this Map", :id => "address-did-you-mean-submit-yes" %>
<%= button "Don't show Map or Weather", :id => "address-did-you-mean-submit-no" %>
</div>
</div>
<%= hidden_field_tag :control %>
<div id="preview-panel">
<%= link_to image_tag(@product.envelope_or_creative_or_template_public_filename(:checkout)), product_preview_webpage_path, :class => 'preview-button' %>
<% creative_nav_link ||= nil %>
<% if creative_nav_link %>
<style type="text/css" media="screen">
#edit-creative { width:100%;position:relative;text-align:center;margin-top:8px;margin-bottom:32px; }
#edit-creative > p { margin-bottom:8px; }
#edit-creative-button { margin:0 auto; margin-left: 30px; }
</style>
<div id='edit-creative'>
<p>Do you need to edit details on your invitation?</p>
<div id='edit-creative-button'><%= creative_nav_link %></div>
<div class='clear'></div>
</div>
<% end %>
<% box_with_filled_header "Preview Guest Experience", :id => 'preview-box', :class => 'preview-controls' do %>
<ul>
<li id='email-preview'><div class='icon'><%= link_to image_tag('preview/email.png'), product_preview_email_path, :class => 'preview-button' %></div>Email</li>
<li id='landing-preview'><div class='icon'><%= link_to image_tag('preview/landing.png'), product_preview_webpage_path, :class => 'preview-button' %></div>Event Page</li>
<li id='print-preview' class='disabled'><div class='icon'><%= image_tag('preview/print.png') %></div>Print</li>
<li id='sms-preview' class='disabled'><div class='icon'><%= image_tag('preview/sms.png') %></div>SMS</li>
</ul>
<% end %>
</div>
<div id='event-settings-boxes' class='settings-boxes'>
<% box_with_filled_header 'Event Details', :class => 'details-box' do %>
<%= f.field_set_with_required_label_and_text_field 'Event Name:', :title %>
<%= f.field_set_with_required_label_and_text_field 'Host:', :host %>
<%= f.field_set_with_label_and_custom_proc 'Address:<br /><span style="font-size:10px;line-height:8px;text-transform:uppercase;color:#FFF;font-style:italic;display:block;margin-bottom:4px"><span style="color:#FFF;font-style:italic;display:block;margin-bottom:4px;font-size:10px;">Include</span>city &amp; zip</span>' do
f.text_area :address, :style => 'width:190px;height:50px;font-size:13px', :title => "i.e. 12405 Lexington Ave\rNew York, NY 10174"
end %>
<%= f.field_set_with_label_and_custom_proc '&nbsp;' do
f.check_box(:use_map) + " USE MAP " + link_to_function('( EDIT MAP )', "checkForMultipleAddressHits(true)", :id => "edit_map_link")
end %>
<%- f.fields_for geo_loc do |fg| -%>
<%= fg.hidden_field :lat %>
<%= fg.hidden_field :lng %>
<%= fg.hidden_field :zip %>
<%- end -%>
<%= f.field_set_with_label_and_text_field 'Location Name:', :location, {:title => "i.e. Central Park"} %>
<% using_time_zone time_zone_from_params_or_user_or_default(@product.time_zone) do %>
<%= f.field_set_with_label_and_text_field 'Date:',
:occurs_at,
:value => (@product.occurs_at ? @product.occurs_at.strftime("%B %d, %Y") : ''),
:onchange => '$("#scheduling-options").show();' %>
<%= f.field_set_with_label_and_text_field 'Rsvp By:',
:rsvp_by,
:value => (@product.rsvp_by ? @product.rsvp_by.strftime("%B %d, %Y") : '') %>
<div class='clear' style='padding-top:4px'></div>
<%= f.field_set_with_label_and_custom_proc 'Time:' do
f.time_select(:start_time, {:minute_interval => 30, :simple_time_select => true, :time_separator => ''}, :id => "product_start_time", :name => "product[start_time]" ) + " UNTIL " + f.time_select(:end_time, {:prompt => 'None',:minute_interval => 30, :simple_time_select => true, :time_separator => ''}, :id => "product_end_time", :name => "product[end_time]" )
end -%>
<% end %>
<script type="text/javascript" charset="utf-8">
$(function(){
$('#product_time_zone').val('<%= time_zone_for_user %>')
});
</script>
<%= f.field_set_with_label_and_custom_proc 'Time Zone:', :style => 'margin-bottom:2px' do
f.select :time_zone, ActiveSupport::TimeZone.us_zones.map(&:name)
end -%>
<%= f.field_set_with_label_and_text_field 'Phone:', :phone -%>
<div class='clear'></div>
<!-- <div class='separator'></div> -->
<% if should_allow_delayed_sending_for(@product) %>
<% using_time_zone time_zone_from_params_or_user_or_default(@product.time_zone) do %>
<div style='width:210px;float:right;text-align:left'>
<span><%= f.check_box :should_delay_sending %> Schedule delayed sending</span>
<script type="text/javascript" charset="utf-8">
$(function(){
$("#product_should_delay_sending").change(function() {
if ($(this).attr('checked')) { $('#delayed_sending_options').show(); }
else { $('#delayed_sending_options').hide(); }
});
});
</script>
<% unless @product.should_delay_sending? %>
<style type="text/css" media="screen">
#delayed_sending_options { display:none }
</style>
<% end %>
<div class='clear'></div>
<div id='delayed_sending_options'>
<%= f.text_field :send_at, :value => @product.send_at.strftime("%B %d, %Y") rescue '' %>
<div class='clear' style='padding-top:4px'></div>
<span>at</span>
<%= f.time_select :send_time, {:minute_interval => 30, :simple_time_select => true, :time_separator => ''}, :id => "product_send_time", :name => "product[send_time]" %>
</div>
</div>
<% end %>
<% end %>
<% end %>
<script type="text/javascript" charset="utf-8">
<%- if @product.map? -%>
var lat_lng = new GLatLng(<%= @product.geoloc.lat %>,<%= @product.geoloc.lng %>);
mapSet(true);
<%- else -%>
var lat_lng = null;
mapSet(false);
<%- end -%>
</script>
<% box_with_filled_header 'Customize RSVP + Reminders', :class => 'rsvp-box' do %>
<span>when guests reply or comment</span>
<div class='clear'></div>
<div class="indented">
<%= f.radio_button :notify_host_when_guests_reply, 'email_each' %><span>send me an email for each</span>
<div class='clear'></div>
<%= f.radio_button :notify_host_when_guests_reply, 'none' %><span>don't notify me</span>
</div>
<div class='clear'></div>
<div class='separator'></div>
<span>guests can see</span>
<div class='clear'></div>
<div class="indented">
<%= f.radio_button :visibility_of_responses, Product::VISIBILITY_OF_RESPONSES_ALL %><span>all rsvps and comments</span>
<div class='clear'></div>
<%= f.radio_button :visibility_of_responses, Product::VISIBILITY_OF_RESPONSES_RSVPS %><span>only rsvps</span>
<div class='clear'></div>
<%= f.radio_button :visibility_of_responses, Product::VISIBILITY_OF_RESPONSES_NONE %><span>hide guest rsvps and comments</span>
<div class='clear'></div>
<%= f.radio_button :visibility_of_responses, Product::VISIBILITY_OF_RESPONSES_NO_LIST %><span>hide guest rsvps, comments, &amp; guest list</span>
</div>
<div class='clear'></div>
<div class='separator'></div>
<!-- <span style='margin-right:4px'>guests may bring</span><%= f.select :maximum_guests_allowed, [['Unlimited',-1]]+(0..20).to_a %> <span>friends</span>
<div class='clear'></div> -->
<!-- <span style='margin-right:4px'>guests</span><%= f.select :allow_guests_to_invite, [['may',true],['may not',false]] %> <span>invite others</span>
<div class='clear'></div> -->
<!-- <span style='margin-right:4px'>maximum capacity for event is </span><%= f.select :maximum_capacity, [['Unlimited',-1]]+(1..9).to_a+(10..190).to_a.reject{|n|n%10 != 0}+(200..950).to_a.reject{|n|n%50 != 0}+(1000..2000).to_a.reject{|n|n%100 != 0} %>
<div class='clear'></div> -->
<%= f.check_box :adults_only %> <span>Just adults please</span>
<div class='separator'></div>
<div id='scheduling-options' class='<%= !!@product.occurs_at ? "" : "hidden" %>'>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$("#product_send_rsvp_reminder_at").width(120).datepicker();
$("#product_send_reminder_at").width(120).datepicker();
$('#product_should_send_rsvp_reminder').change(updateRsvpReminderOption)
$('#product_should_send_reminder').change(updateReminderOption)
updateReminderOption()
updateRsvpReminderOption()
});
function updateRsvpReminderOption() {
if (!$('#product_should_send_rsvp_reminder').get(0).checked) {
$('#product_send_rsvp_reminder_at').val(null)
}
}
function updateReminderOption() {
if (!$('#product_should_send_reminder').get(0).checked) {
$('#product_send_reminder_at').val(null)
}
}
</script>
<% using_time_zone time_zone_from_params_or_user_or_default(@product.time_zone) do %>
<div id='rsvp_reminder_options'>
<div class='right'>
<%= f.text_field :send_rsvp_reminder_at,
:value => (@product.send_rsvp_reminder_at ? @product.send_rsvp_reminder_at.strftime("%B %d, %Y") : '') %>
</div>
<span><%= f.check_box :should_send_rsvp_reminder %> Resend invitation on</span>
<div class='clear'></div>
<span style='margin-left:18px;font-size:9px;font-style:italic;'>(For guests who have not responded)</span>
</div>
<div class='clear'></div>
<div id='reminder_options'>
<div class='right'>
<%= f.text_field :send_reminder_at,
:value => (@product.send_reminder_at ? @product.send_reminder_at.strftime("%B %d, %Y") : '') %>
</div>
<span><%= f.check_box :should_send_reminder %> Send a reminder on</span>
<div class='clear'></div>
<span style='margin-left:18px;font-size:9px;font-style:italic;'>(For guests who replied yes, maybe &amp; have not responded)</span>
</div>
<% end %>
</div>
<% end %>
</div>
<div class='clear'></div>
<% box_with_filled_header 'Additional Message / Instructions', :id => 'message-box', :style => 'width:720px;margin-top:8px;height:80px;float:right' do %>
<%= f.text_area :message, :style => 'width:619px;height:60px;background:#000;border:0;font-size:13px', :title => default_message_text_for(@product) %>
<% end %>
>>>>>>> 1f53495bfdcf31157aa1823e5ede48f18949acaf:app/views/products/events/details.html.erb
<div style='width:720px;float:right' class='controls'>
<%= action_link 'BACK TO DESIGN', :form => 'control-form', :form_hook => "jQuery('#control').val('prev');", :style => 'float:left', :analytics => {:label => '/invitations/details'} %>
<%= button 'Next', :id => "submit_next", :style => 'float:right;width:65px', :onclick => "jQuery('#control').val('next');", :analytics => {:label => '/invitations/details'} %>
</div>
<% end %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment