javascript - Ruby on Rails: Full Calender Gem not displaying pop up form -
i've been following driftingruby's tutorial interactive calendar , have run issue.
the calendar displays fine when drag across date range input event nothing happens can offer insight?
https://www.driftingruby.com/episodes/fullcalendar-events-and-scheduling
the following javascript files think problem lies.
//daterangepicker.js
var date_range_picker; date_range_picker = function() { $('.date-range-picker').each(function(){ $(this).daterangepicker({ timepicker: true, timepickerincrement: 30, alwaysshowcalendars: true }, function(start, end, label) { $('.start_hidden').val(start.format('yyyy-mm-dd hh:mm')); $('.end_hidden').val(end.format('yyyy-mm-dd hh:mm')); }); }) }; $(document).on('turbolinks:load', date_range_picker);
//fullcalendar.js
var initialize_calendar; initialize_calendar = function() { $('.calendar').each(function(){ var calendar = $(this); calendar.fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaweek,agendaday' }, selectable: true, selecthelper: true, editable: true, entrylimit: true, entrys: '/entrys.json', select: function(start, end) { $.getscript('/entrys/new', function() { $('#entry_date_range').val(moment(start).format("mm/dd/yyyy hh:mm") + ' - ' + moment(end).format("mm/dd/yyyy hh:mm")) date_range_picker(); $('.start_hidden').val(moment(start).format('yyyy-mm-dd hh:mm')); $('.end_hidden').val(moment(end).format('yyyy-mm-dd hh:mm')); }); calendar.fullcalendar('unselect'); }, entrydrop: function(entry, delta, revertfunc) { entry_data = { entry: { id: entry.id, start: entry.start.format(), end: entry.end.format() } }; $.ajax({ url: entry.update_url, data: entry_data, type: 'patch' }); }, entryclick: function(entry, jsevent, view) { $.getscript(entry.edit_url, function() { $('#entry_date_range').val(moment(entry.start).format("mm/dd/yyyy hh:mm") + ' - ' + moment(entry.end).format("mm/dd/yyyy hh:mm")) date_range_picker(); $('.start_hidden').val(moment(entry.start).format('yyyy-mm-dd hh:mm')); $('.end_hidden').val(moment(entry.end).format('yyyy-mm-dd hh:mm')); }); } }); }) }; $(document).on('turbolinks:load', initialize_calendar);
//create.js.erb
$('.calendar').fullcalendar( 'renderentry', $.parsejson("<%=j render(@entry, format: :json).html_safe %>"), true ); $('.modal').modal('hide');
thanks in advance.
edit
log
started "/entries/new?_=1490713885661" ::1 @ 2017-03-28 17:06:42 +0100 processing entriescontroller#new js parameters: {"_"=>"1490713885661"} rendered entries/_form.html.erb (79.1ms) rendered entries/_new.html.erb (116.2ms) rendered entries/new.js.erb (152.2ms) completed 500 internal server error in 207ms (activerecord: 0.0ms) actionview::template::error (undefined method `entries_index_path' #<#<class:0xa441290>:0xb949cc0>): 1: <%= simple_form_for @entry, remote: true |f| %> 2: <div class="form-inputs"> 3: <%= f.input :title %> 4: <%= f.input :date_range, input_html: { class: "form-control input-sm date-range-picker" } %> app/views/entries/_form.html.erb:1:in `_app_views_entries__form_html_erb__139031211_82152084' app/views/entries/_new.html.erb:9:in `_app_views_entries__new_html_erb__484549457_82186272' app/views/entries/new.js.erb:1:in `_app_views_entries_new_js_erb___326163301_82413240' rendered c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb (0.0ms) rendered c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb (0.0ms) rendered c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb (184.7ms) started "/entries" ::1 @ 2017-03-28 17:09:32 +0100 processing entriescontroller#index html rendered entries/index.html within layouts/application (0.0ms) completed 200 ok in 11569ms (views: 11490.7ms | activerecord: 0.0ms) started "/assets/full_calendar.self-00580e852972f09c2aafa7b73a6879781e2d49850519270086ca7b642f5a1ddd.js?body=1" ::1 @ 2017-03-28 17:09:45 +0100 [1m[36mactiverecord::schemamigration load (0.0ms)[0m [1mselect "schema_migrations".* "schema_migrations"[0m [1m[35mactiverecord::schemamigration load (0.0ms)[0m select "schema_migrations".* "schema_migrations" started "/entries" ::1 @ 2017-03-28 17:15:41 +0100 [1m[36mactiverecord::schemamigration load (1.0ms)[0m [1mselect "schema_migrations".* "schema_migrations"[0m processing entriescontroller#index html rendered entries/index.html within layouts/application (60.1ms) completed 200 ok in 58260ms (views: 57678.1ms | activerecord: 0.0ms) started "/entries" ::1 @ 2017-03-28 17:33:55 +0100 [1m[36mactiverecord::schemamigration load (2.0ms)[0m [1mselect "schema_migrations".* "schema_migrations"[0m processing entriescontroller#index html rendered entries/index.html within layouts/application (97.1ms) completed 200 ok in 12627ms (views: 12437.6ms | activerecord: 0.0ms) started "/entries" ::1 @ 2017-03-28 17:36:52 +0100 processing entriescontroller#index html rendered entries/index.html within layouts/application (0.0ms) completed 200 ok in 2538ms (views: 2535.8ms | activerecord: 0.0ms)
it'd useful have @ rails console logs here, that'll tell if js firing off request @ all, , it's going.
this bit looks bit suspect:
$.getscript('/entrys/new', function()
you doing get /entrys/new
, have provided code create.js.erb
in question.
did mean post /entrys
instead?
Comments
Post a Comment