Giter VIP home page Giter VIP logo

fullcalendarpractice's People

Contributors

xw19 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fullcalendarpractice's Issues

Initialise start and end

_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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.