Created
February 7, 2013 04:08
-
-
Save leofrozenyogurt/4728398 to your computer and use it in GitHub Desktop.
event jquery
This file contains hidden or 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
javascript: | |
$(function() { | |
$('#event_from_date, #event_to_date, #repeat_days_ends').datepicker({ | |
dateFormat: "yy-mm-dd" | |
}); | |
$('#event_from_time, #event_to_time').timepicker(); | |
}); | |
#repeats-daily-modal class=['modal','hide','fade','in'] role='dialog' aria-labelledby='windowTitleLabel' | |
.modal-header | |
a.close href='#' data-dismiss='modal' x | |
h3 When does this event repeat? | |
.modal-body | |
.divDialogElements | |
p | |
b Repeat every: | |
= select_tag 'repeat_days', options_for_select(1..31), { style: 'width:65px' } | |
| days | |
p | |
b Ends after: | |
= text_field_tag 'repeat_days_ends', nil, { style: 'width:100px' } | |
.modal-footer | |
a class='btn' href='#' onclick="closeDialog();" Cancel | |
a class=['btn','btn-primary'] href='#' onclick="okClicked();" OK | |
#repeats-weekly-modal class=['modal','hide','fade','in'] role='dialog' aria-labelledby='windowTitleLabel' | |
.modal-header | |
a.close href='#' data-dismiss='modal' x | |
h3 How many times a week does this repeat? | |
.modal-body | |
.divDialogElements | |
p | |
b Repeat every: | |
= select_tag 'repeat_days', options_for_select(1..31), { style: 'width:65px' } | |
| days | |
p | |
b Ends after: | |
= text_field_tag 'repeat_days_ends', nil, { style: 'width:100px' } | |
.modal-footer | |
a class='btn' href='#' onclick="closeDialog();" Cancel | |
a class=['btn','btn-primary'] href='#' onclick="okClicked();" OK | |
#repeats-monthly-modal class=['modal','hide','fade','in'] role='dialog' aria-labelledby='windowTitleLabel' | |
.modal-header | |
a.close href='#' data-dismiss='modal' x | |
h3 How many times a week does this repeat? | |
.modal-body | |
.divDialogElements | |
p | |
b Repeat every: | |
= select_tag 'repeat_days', options_for_select(1..31), { style: 'width:65px' } | |
| days | |
p | |
b Ends after: | |
= text_field_tag 'repeat_days_ends', nil, { style: 'width:100px' } | |
.modal-footer | |
a class='btn' href='#' onclick="closeDialog();" Cancel | |
a class=['btn','btn-primary'] href='#' onclick="okClicked();" OK | |
a href='#repeats-daily-modal' data-toggle='modal' link | |
a href='#repeats-weekly-modal' data-toggle='modal' link | |
a href='#repeats-monthly-modal' data-toggle='modal' link | |
= simple_form_for [@user, @event], html: { class: 'form-horizontal' } do |f| | |
= f.error_notification | |
.form-inputs | |
= f.input :name, label: t('events.form.title') | |
= f.input :venue_name, label: t('events.form.venue_name') | |
= f.input :venue_address, label: t('events.form.venue_address') | |
div class=['control-group','string','optional'] | |
label class=['control-label','string','optional'] | |
= t('events.form.date_time') | |
| : | |
.controls | |
= f.text_field :from_date, { style: 'width:100px;' } | |
| | |
= f.text_field :from_time, { style: 'width:75px;' } | |
| - | |
= f.text_field :to_date, { style: 'width:100px;' } | |
| | |
= f.text_field :to_time, { style: 'width:75px;' } | |
/!= f.input :from, label: t('events.form.date_time'), as: :string, input_html: { style: "width:335px" } | |
/!= f.input :repeats, label: t('events.form.repeats'), collection: Event::REPEATS.values.map { |v| [v[:name], v[:code]] } | |
/!= f.input :to, label: t('events.form.end_date'), as: :string, input_html: { style: "width:335px" } | |
= f.input :currency, :collection => User::CURRENCIES, :include_blank => false, label: t('events.form.currency'), input_html: { style: 'width:100px' } | |
p this event repeats | |
= check_box_tag "This event repeats" | |
br | |
= select_tag "repeats_choices", options_for_select(["","daily","weekly","monthly"]) | |
= f.input :event_description, label: t('events.form.event_description'), input_html: { class: "tinymce", style: "width:600px;height:175px" } | |
h2 = t('events.form.sub_forms.ticket_types.title') | |
= f.simple_fields_for :ticket_types, html: { class: 'form-inline' } do |sub_f| | |
= render 'ticket_type_fields', :f => sub_f | |
.links | |
= link_to_add_association t('events.form.actions.add_row'), f, :ticket_types | |
.form-actions | |
div style='float:right;' | |
= link_to t('events.form.actions.cancel'), user_events_path(@user) | |
| | | |
= f.button :submit | |
javascript: | |
$('#repeats_choices').change(function(){ | |
if ($(this).val()==="daily"){ | |
$('#repeats-daily-modal').fadeIn(); | |
}; | |
}); | |
$('#repeats_choices').hide(); | |
$('#This_event_repeats').click(function(){ | |
$('#repeats_choices').toggle(); | |
}) | |
function closeDialog() { | |
$('#repeats-daily-modal').modal('hide'); | |
}; | |
function okClicked() { | |
closeDialog(); | |
}; | |
| | |
/ function determineEndDateRowVisibility() { | |
/ if ($('#event_repeats').val().length > 0) { | |
/ $('#event_to').parents('.control-group').fadeOut(); | |
/ $('#event_to').val(''); | |
/ } else { | |
/ $('#event_to').parents('.control-group').fadeIn(); | |
/ } | |
/ } | |
/ $('#event_to').parents('.control-group').hide(); | |
/ determineEndDateRowVisibility(); | |
/ | |
/ $('#event_repeats').change(function() { | |
/ determineEndDateRowVisibility(); | |
/ }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment