Ruby on Rails - Railscasts PRO #213 Calendars (revised)
Why Stack Overflow recommends it
Stack Overflow users link it when answering or citing how they built a Rails calendar or jQuery UI datepicker, since it is the standard walkthrough for both.
Recommended by 2 people across 2 different months, 2015 to 2017.
What it is
A roughly nine-minute Railscasts PRO episode (revised) showing how to add calendars to a Rails app. It covers both a jQuery UI date picker for form fields and a full-page calendar for browsing records, built with a custom calendar helper.
What people said
Recommends snewcomer · 2015-05 · Stack Overflow · on “Rails 4 fullcalendar not showing up”
So it is hard to tell what is going wrong with your code because we don't see any of your code. Most of the time, you can tell what is going on from the console or the browser console. That is the best way to debug your code. Otherwise, the link below from RailsCasts for implementing a calendar is a great resource. RailsCast link [this video]
Recommends Yoklan · 2016-04 · Stack Overflow · on “Datetime form field collected with datepicker Jquery UI”
you don't need seperate attributes for date and time though, datetime can be used to store both and I believe jqueries datepicker requries your form field to be set to text_field Have a look at this [this video] and this [LINK]
Cites AnthonyGalli.com · 2015-09 · Stack Overflow · on “How to == Model Method Class in Helper for CSS?”
calendar_helper def day_classes(day) classes = [] classes.empty? ? nil : classes.join(" ") classes << "future" if day > Date.today # This make future days a white background, by default days are blue background # The Below Line Gives an Error (I want missed_dates date_missed to be red background): classes << "missed" if day == current_user.missed_dates.group_by {|i| i.date_missed.to_date} end NameError in Pages#home undefined local variable or method 'current_user' css .future { background-color: #FFF; } .missed { background-color: red; } I built the calendar off of a railscasts tutorial [this video] .
Cites AnthonyGalli.com · 2015-12 · Stack Overflow · on “Calendar: date_started until Date.current?”
How can we go from date_started until Date.current ? For example, this code only counts the date_started for a routine: routines = current_user.routines.group_by {|i| i.date_started.to_date} classes << "completed" if routines.include?(day) But I'd like to make "completed", which is the CSS class that makes the td background blue, work like I explain below: [LINK] schema create_table "routines", force: true do |t| t.datetime "date_started" t.string "action" t.integer "user_id" end I had followed this tutorial [this video] to build the calendar. FULL calendar_helper.rb module CalendarHelper def calendar(date = Date.current, &block) Calendar.new(self, date, block).table end class Calendar < Struct.n
Cites Thomas231 · 2016-09 · Stack Overflow · on “Jquery Datepicker with Ruby on Rails does not work”
I want to use the jquery datepicker for my Ruby on Rails Application. I have done everything like in this railscasts calendar tutorial [this video] , but it just does not work. My textfield is still a normal text_field and no calendar pops up. gemfiles: gem 'jquery-ui-rails', '~> 4.2.1' PS: I have even downgraded the version, but it is still not working application.js : //= require turbolinks //= require jquery //= require jquery_ujs //= require jquery.ui.datepicker //= require_tree application.css : *= require jquery.ui.datepicker *= require_tree . *= require_self bikes.js : jQuery -> $('#bike_available_from').datepicker(dateFormat: 'dd-mm-yy') bike#new view: <%= f.text_field :available_from %>
Cites dividedunit · 2017-03 · Stack Overflow · on “Rails Calendar Helper: New Calendar Instance For Each User”
I'm trying to build a staff rostering/scheduling app in Rails 5. The idea is for each staff member to have a user account where they can log in to enter the days they are available for work, then for the boss to book shifts based on availability. A good example of such a site is [LINK] . The main part of the site would be a calendar, with each user having their own instance of the calendar. Each user would have their own row in the calendar table, with each row displaying the days of the week. I've looked at a few plugins, including FullCalendar and dhtmlxScheduler, but decided to try doing it from scratch. I've managed to build a basic calendar based on this Railscast [this video] , which works