Created
October 23, 2013 13:14
-
-
Save dopa/7118502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= simple_form_for([@meeting,@event], :html => {:class => 'form-horizontal' }) do |f| %> | |
<%= f.error_notification %> | |
<div class="form-inputs"> | |
<ul class="tabs"> | |
<li> | |
<input type="radio" checked name="tabs" id="tab1"> | |
<label class="tab-label" for="tab1">Basics</label> | |
<div id="tab-c1" class="tab-c animated fadeIn"> | |
<%= f.input :session_name, :autofocus => true %> | |
<%= f.input :description, input_html: { class: "small" } %> | |
<%= f.association :event_type, collection: EventType.order('name'), label: "Type" %> | |
<%= f.input :start_date_time, :as => "string", input_html: { value: @sdt.strftime("%Y-%m-%d %H:%M %p"), "data-format" => "yyyy/MM/dd H:M:S t" } %> | |
<% if f.object.end_date_time? %> | |
<%= f.input :end_date_time, :as => "string", input_html: { value: f.object.end_date_time.in_time_zone.strftime("%Y-%m-%d %H:%M %p"), "data-format" => "yyyy/MM/dd H:M:S t" } %> | |
<% else %> | |
<%= f.input :end_date_time, :as => "string", input_html: { value: "", "data-format" => "yyyy/MM/dd H:M:S t" } %> | |
<% end %> | |
<%= f.input :location_simple, label: "Room / Location", hint: "Main Stage, Room B, etc." %> | |
</div> | |
</li> | |
<li> | |
<input type="radio" name="tabs" id="tab4"> | |
<label class="tab-label" for="tab4">Speakers</label> | |
<div id="tab-c4" class="tab-c animated fadeIn"> | |
<div id="speakers" class="form-inputs"> | |
<%= f.simple_fields_for :speaker_slots, :wrapper => 'bootstrap' do |speaker_slot| %> | |
<%= render 'speaker_slot_fields', :f => speaker_slot %> | |
<% end %> | |
</div> | |
<div class="links controls"> | |
<%= link_to_add_association f, :speaker_slots, class: 'btn btn-mini btn-primary', :render_options => {:wrapper => 'bootstrap' } do %>Speaker <span class="fui-plus" style="margin:0 0 0 6px; line-height: 1.1"></span><% end %> (Click to add a speaker. Don't forget to Save the Session!) | |
</div> | |
</div> | |
</li> | |
<li> | |
<input type="radio" name="tabs" id="tab2"> | |
<label class="tab-label" for="tab2">Embeds</label> | |
<div id="tab-c2" class="tab-c animated fadeIn"> | |
<%= f.input :embed_html, label: "Embed HTML", hint: "Live Stream, etc. (optional)" %> | |
<%= f.input :slide_deck_embed_html, label: "Slide Deck Embed HTML", hint: "SlideShare, etc. (optional)" %> | |
</div> | |
</li> | |
<li> | |
<input type="radio" name="tabs" id="tab3"> | |
<label class="tab-label" for="tab3">Options</label> | |
<div id="tab-c3" class="tab-c animated fadeIn"> | |
<% if [email protected]?("private") %> | |
<%= f.input :private_messages_by_default, hint: "(Normally, leave unchecked)" %> | |
<% end %> | |
</div> | |
</li> | |
</ul> | |
</div> | |
<div class="form-actions cB"> | |
<%= f.button :submit, "Save Session", class: "btn btn-primary btn-large" %> | |
<%= link_to 'Cancel', meeting_events_path(@meeting), class: "btn btn-default btn-large" %> | |
</div> | |
<% end %> | |
<% content_for :page_javascript do %> | |
<%= javascript_include_tag "plugs/jquery.datetimeentry.js" %> | |
<script type="text/javascript"> | |
$(function(){ | |
var dtf = 'Y-O-D H:M a'; | |
function copyStartToEnd(){ | |
if( $('#event_end_date_time').val() === "" ) { | |
$('#event_end_date_time').val( $('#event_start_date_time').val() ); | |
} | |
} | |
$('#event_start_date_time') | |
.datetimeEntry({ | |
datetimeFormat: dtf, | |
spinnerImage: '' //, | |
//setDatetime: start_date_time | |
}) | |
.on('blur', copyStartToEnd); | |
$('#event_end_date_time') | |
.datetimeEntry({datetimeFormat: dtf, spinnerImage: ''}) | |
.on('focus', copyStartToEnd); | |
// if there's an error, focus its tab | |
var $firstError = $('.control-group.error:first'); | |
if( $firstError.length ) { | |
$firstError.closest('.tab-c').prev('label').click(); | |
} else if( window.location.hash.indexOf("tab") !== -1 ) { | |
var tab = window.location.hash.split('#').join(''); | |
$('label[for="'+ tab +'"]').click(); | |
} | |
}); | |
</script> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment