xw19 / fullcalendarpractice Goto Github PK
View Code? Open in Web Editor NEWFull Calendar Demo App
Full Calendar Demo App
_form.html.erb
<%= f.input_field :start, as: :hidden, value: '', class: 'form-control input-sm start_hidden' %>
<%= f.input_field :end, as: :hidden, value: '', class: 'form-control input-sm end_hidden' %>
if the user does not click on the date range popup and click click "Create Event", the params returned does not include start
or end
, only date_range
is filled:
Started POST "/events" for ::1 at 2018-01-24 10:17:02 +0800
Processing by EventsController#create as JS
Parameters: {"utf8"=>"✓", "event"=>{"title"=>"102", "date_range"=>"01/09/2018 - 01/10/2018", "resource_id"=>"1", "start"=>"", "end"=>"", "color"=>""}, "commit"=>"Create Event"}
(0.1ms) begin transaction
Resource Load (0.2ms) SELECT "resources".* FROM "resources" WHERE "resources"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
SQL (0.3ms) INSERT INTO "events" ("title", "color", "created_at", "updated_at", "resource_id") VALUES (?, ?, ?, ?, ?) [["title", "102"], ["color", ""], ["created_at", "2018-01-24 02:17:02.137664"], ["updated_at", "2018-01-24 02:17:02.137664"], ["resource_id", 1]]
(1.0ms) commit transaction
Rendering events/create.js.erb
Rendered events/_event.json.jbuilder (19.4ms)
Rendered events/create.js.erb (35.4ms)
Completed 500 Internal Server Error in 106ms (ActiveRecord: 1.6ms)
ActionView::Template::Error (undefined method `midnight' for nil:NilClass):
1: date_format = event.all_day_event? ? '%Y-%m-%d' : '%Y-%m-%dT%H:%M:%S'
2:
3: json.id event.id
4: json.title event.title
app/models/event.rb:9:in `all_day_event?'
app/views/events/_event.json.jbuilder:1:in `_app_views_events__event_json_jbuilder___573982304246640252_70171120473660'
app/views/events/create.js.erb:3:in `_app_views_events_create_js_erb__4533092265648181547_70171167837060'
In the Readme, f.input_field :start, as: :hidden, value: Date.today
which :start
and :end
is inited to Date.today
. The new problem is:
Started POST "/events" for ::1 at 2018-01-24 10:53:40 +0800
Processing by EventsController#create as JS
Parameters: {"utf8"=>"✓", "event"=>{"title"=>"103", "date_range"=>"01/01/2018 - 01/02/2018", "resource_id"=>"1", "start"=>"2018-01-24", "end"=>"2018-01-24", "color"=>"green"}, "commit"=>"Create Event"}
date_range
value is correct. start
and end
is today.... and new events are all saved as today's event...
It seems the problem can be fixed by replacing full_calendar.coffee
by driftingruby/042-fullcalendar
's full_calendar.js
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.