Giter Site home page Giter Site logo

excid3 / simple_calendar Goto Github PK

View Code? Open in Web Editor NEW
1.5K 43.0 265.0 437 KB

A wonderfully simple calendar gem for Rails

Home Page: http://excid3.github.io/simple_calendar

License: MIT License

Ruby 72.56% Shell 0.11% HTML 24.31% SCSS 2.91% CSS 0.05% JavaScript 0.06%
calendar ruby week-calendar custom-calendar meeting month

simple_calendar's Introduction

Simple Calendar

๐Ÿ“† A calendar for your Ruby on Rails app.

Build Status Gem Version

Simple Calendar is designed to do one thing really really well: render a calendar.

It lets you render a calendar of any size. Maybe you want a day view, a 4 day agenda, a week view, a month view, or a 6 week calendar. You can do all of that with the new gem, just give it a range of dates to render.

It doesn't depend on any ORM so you're free to use it with ActiveRecord, Mongoid, any other ORM, or pure Ruby objects.

Thanks to all contributors for your wonderful help!

calendar

Installation

Just add this into your Gemfile followed by a bundle install:

gem "simple_calendar"

If you're using Bootstrap, the calendar should already have a border and nice spacing for days.

Optionally, you can include the default stylesheet for the calendar in your app/assets/stylesheets/application.css file:

*= require simple_calendar

or in your SCSS app/assets/stylesheets/application.scss file:

@import "simple_calendar";

Usage

Generating calendars is extremely simple with simple_calendar.

The first parameter is a symbol that looks up the current date in params. If no date is found, it will use the current date.

In these examples, we're using :start_date which is the default.

Month Calendar

You can generate a calendar for the month with the month_calendar method.

<%= month_calendar do |date| %>
  <%= date %>
<% end %>

To show the day of the month instead of the date, use <%= date.day %>

Week Calendar

You can generate a week calendar with the week_calendar method.

<%= week_calendar(number_of_weeks: 2) do |date| %>
  <%= date %>
<% end %>

Setting number_of_weeks is optional and defaults to 1.

Custom Length Calendar

You can generate calendars of any length by passing in the number of days you want to render.

<%= calendar(number_of_days: 4) do |date| %>
  <%= date %>
<% end %>

Setting number_of_days is optional and defaults to 4.

Custom Parameter Name

You can pass in start_date_param to change the name of the parameter in the URL for the current calendar view.

<%= calendar(start_date_param: :my_date) do |date| %>
  <%= date %>
<% end %>

Custom Partial

You can set a different partial name for calendars by passing the partial path.

<%= calendar(partial: 'products/calendar') do |date| %>
  <%= date %>
<% end %>

Internationalization (I18n)

The default views are prepared to do translation lookups for month names and weekdays.

To profit from that, you can take advantage of the rails-i18n gem which comes with translations for many languages already.

In a Rails 6 app, the configuration could look like the following:

  • Add gem 'rails-i18n' to your Gemfile and run bundle.
  • Define the available and default locale e.g. in config/application.rb:
# config/application.rb
config.i18n.available_locales = [:en, :de, :fr]
config.i18n.default_locale = :en
  • Define the following translation keys:
# e.g. config/locales/de.yml
de:
  simple_calendar:
    previous: "<<"
    next: ">>"
    week: Woche

See the Rails I18n Guide for further information.

Rendering Events

What's a calendar without events in it? There are two simple steps for creating calendars with events.

The first step is to add the following to your model. We'll be using a model called Meeting, but you can add this to any model or Ruby object.

Here's an example model:

# single day events
$ rails g scaffold Meeting name start_time:datetime

# multi-day events
$ rails g scaffold Meeting name start_time:datetime end_time:datetime

By default it uses start_time as the attribute name. If you'd like to use another attribute other than start_time, just pass it in as the attribute

<%= month_calendar(attribute: :starts_at) do |date| %>
  <%= date %>
<% end %>

Optionally the end_time attribute can be used which enables multi-day event rendering.

Just pass in the attribute and end_attribute options respectively

<%= month_calendar(attribute: :start_date, end_attribute: :end_date) do |date| %>
  <%= date %>
<% end %>

If you already have a model with a start time attribute called something other than start_time or accesses it through a relationship, you can alias the attribute by defining a start_time method in the my_model.rb file and not have to specify it separately as in the above example

class MyModel
    ## Other code related to your model lives here

    def start_time
        self.my_related_model.start ##Where 'start' is a attribute of type 'Date' accessible through MyModel's relationship
    end
end

In your controller, query for these meetings and store them in an instance variable. Normally you'll want to search for the ones that only show up inside the calendar view (for example, you may only want to grab the events for the current month).

We'll just load up all the meetings for this example.

def index
  # Scope your query to the dates being shown:
  start_date = params.fetch(:start_date, Date.today).to_date
  @meetings = Meeting.where(starts_at: start_date.beginning_of_month.beginning_of_week..start_date.end_of_month.end_of_week)
end

Then in your view, you can pass in the events option to render. The meetings will automatically be filtered out by day for you.

<%= month_calendar(events: @meetings) do |date, meetings| %>
  <%= date %>

  <% meetings.each do |meeting| %>
    <div>
      <%= meeting.name %>
    </div>
  <% end %>
<% end %>

If you pass in objects that don't respond to the attribute method (like starts_at), then all the meetings will be yielded each day. This lets you do custom filtering however you want.

Customizing The Calendar

There are a handful of configuration options that you can use in simple_calendar.

Customizing Views

You can customize the layouts for each of the calendars by running the generators for simple_calendar:

$ rails g simple_calendar:views

This will generate a folder in app/views called simple_calendar that you edit to your heart's desire.

Time Zones

Setting Time.zone will make sure the calendar start days are correctly computed in the right timezone. You can set this globally in your application.rb file or if you have a User model with a time_zone attribute, you can set it on every request by using a before_action like the following example.

This code example uses Devise's current_user and user_signed_in? methods to retrieve the user's timezone and set it for the duration of the request. Make sure to change the :user_signed_in? and current_user methods if you are using some other method of authentication.

class ApplicationController < ActionController::Base
  before_action :set_time_zone, if: :user_signed_in?

  private

    def set_time_zone
      Time.zone = current_user.time_zone
    end
end

If you want to set the time zone globally, you can set the following in config/application.rb:

config.time_zone = 'Central Time (US & Canada)'

Beginning Of Week

You can also change the beginning day of the week by setting Date.beginning_of_week in a before_action just like in the previous example. If you want to set this globally, you can put this line in config/application.rb:

config.beginning_of_week = :sunday

Custom CSS Classes

Setting classes on the table and elements are pretty easy.

simple_calendar comes with a handful of useful classes for each day in the calendar that you can use:

.simple-calendar {
  .day {}

  .wday-0 {}
  .wday-1 {}
  .wday-2 {}
  .wday-3 {}
  .wday-4 {}
  .wday-5 {}
  .wday-6 {}

  .today {}
  .past {}
  .future {}

  .start-date {}

  .prev-month {}
  .next-month { }
  .current-month {}

  .has-events {}
}

Just paste this into a CSS file and add your styles and they will be applied to the calendar. All of these classes are inside of the simple-calendar class so you can scope your own classes with similar names.

Custom Header Title And Links

Header and title links are easily adjusted by generating views and modifying them inside your application.

For example, if you'd like to use abbreviated month names, you can modify the views from this:

<%= t('date.month_names')[start_date.month] %> <%= start_date.year %>

To

<%= t('date.abbr_month_names')[start_date.month] %> <%= start_date.year %>

Your calendar will now display "Sep 2015" instead of "September 2015" at the top! :)

AJAX Calendars

Rendering calendars that update with AJAX is pretty simple. You'll need to follow these steps.

  • Run rails g simple_calendar:views to generate the views.
  • Add an ID to the calendar view's outer div. <div id="calendar" class="simple-calendar">
  • Add remote: true option to the next & preview links like this.
  • Create js.erb file to respond to JS requests, render the new calendar, and replace the calendar on the page by ID like this.

The response can simply replace the HTML of the div with the newly rendered calendar.

Take a look at excid3/simple_calendar-ajax-example to see how it is done.

If you are using Hotwire, just wrap in a Turbo Frame. Like this:

<%= turbo_frame_tag 'calendar' do %>
  <%= month_calendar do |date| %>
    <%= date.day %>
  <% end %>
<% end %>

Custom Calendars

The three main calendars available should take care of most of your needs, but simple_calendar makes it easy to create completely custom calendars (like maybe you only want business weeks).

If you'd like to make a completely custom calendar, you can create a new class that inherits from SimpleCalendar::Calendar. The name you give it will correspond to the name of the template it will try to render.

The main method you'll need to implement is the date_range so that your calendar can have a custom length.

class SimpleCalendar::BusinessWeekCalendar < SimpleCalendar::Calendar
  private

    def date_range
      beginning = start_date.beginning_of_week + 1.day
      ending    = start_date.end_of_week - 1.day
      (beginning..ending).to_a
    end
end

To render this in the view, you can do:

<%= render SimpleCalendar::BusinessWeekCalendar.new(self, events: meetings) do |date| %>
  <%= date %>
<% end %>

And this will render the app/views/simple_calendar/_business_week_calendar.html.erb partial.

You can copy one of the existing templates to use for the partial for your new calendar.

View Specs and Tests

If you're running view specs against views with calendars, you may run into route generation errors like the following:

Failure/Error: render
ActionView::Template::Error:
  No route matches {:action=>"show", :controller=>"controller_name", :start_date=>Sun, 29 Mar 2015}

If so, you can stub out the appropriate method like so (rspec 3 and up):

expect_any_instance_of(SimpleCalendar::Calendar).to receive(:link_to).at_least(:once).and_return("")

With modifications as appropriate.

Author

Chris Oliver [email protected]

https://gorails.com

@excid3

License

Simple Calendar is licensed under the MIT License.

simple_calendar's People

Contributors

0957758592 avatar brucehsu avatar cat2koban avatar dependabot[bot] avatar elhalvers avatar excid3 avatar francescognarra avatar fwolfst avatar gomayonqui avatar jamescgibson avatar joseramonc avatar kenzo-tanaka avatar lctrt avatar lukerollans avatar mkrisher avatar mlitwiniuk avatar olimart avatar olleicua avatar paultyng avatar pchen13 avatar pienkowb avatar rodrigoargumedo avatar rogerio-augusto avatar rylanb avatar samgranieri avatar seanslerner avatar serodriguez68 avatar vinbarnes avatar wgailey avatar yensaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simple_calendar's Issues

Empty_date manipulation

Thanks @excid3 for the gem. I had a question on using empty_date to display something other than date object or strings.

<%= calendar @timecards, :start_day => :monday, empty_date: lambda{ |date| "#{date}" }, :prev_text=>"< ", :next_text=>" >" do |timecard| %>
    <%= timecard.fullname %>: <%= timecard.hours %> hrs
<% end %>

If the timecard exists, I am showing fullname and hours worked. If it is empty, I want to show who is available to work. Any suggestions would help.

Kaminari + Simple Calendar

Hi,

I'm trying to have infinite scroll on my Calendar. I'm looking to use Kaminari's "link_to_next_page" and "link_to_previous_page" but it is continuing to render the same Calendar Month every time it scrolls. I believe I need to extract the Header link code (->(param, date_range) { link_to raw("ยซ"), {param => date_range.first - 1.day}, remote: :true}). The header left and right by using start_date param but how can I use this with Kaminari?

Can you point me in the right direction?

Thanks.

NoMethodError on 'delegate?' for nil:NilClass with RSpec

I was just setting up simple_calendar gem with RSpec and wanted to make sure that everything is working in irb.

I fire the console up.
typed require 'simple_calendar'

then this error happened:

NoMethodError: undefined method `delegate' for SimpleCalendar::Calendar:Class
    from /usr/local/rvm/gems/ruby-2.2.1/gems/simple_calendar-1.1.10/lib/simple_calendar/calendar.rb:3:in `<class:Calendar>'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/simple_calendar-1.1.10/lib/simple_calendar/calendar.rb:2:in `<module:SimpleCalendar>'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/simple_calendar-1.1.10/lib/simple_calendar/calendar.rb:1:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/simple_calendar-1.1.10/lib/simple_calendar.rb:1:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from (irb):4
    from /usr/local/rvm/rubies/ruby-2.2.1/bin/irb:11:in `<main>'

@excid3, can you confirm this bug report? it's not working at all.

Passing empty meeting object generates error

Hey,
i have a problem with the "month_calendar". If i pass a nil object it generates an error. Is there a way to fix that?

               <%= month_calendar day_names: "date.day_names",
                                  header: {class: "calendar-header"},
                                  table: {class: "table table-bordered"},
                                  tr: {class: "calendar-row"},
                                  th: {class: "date-title"},

                                  events: @events do |date, meetings| %>

               @events = Event.find_by_room(@room)

SystemStackError (stack level too deep)

I'm getting a systemstack/recursion error whenever I try to render the calendar, and I have no clue what's causing it

View

<%= calendar number_of_days: 4 do |date| %> <!-- line that throws error (#4) -->
  <%= date %>
<% end %>

or

<%= month_calendar do |date| %>
  <%= date %>
<% end %>

Controller

  def calendar
    @device = Device.find(params[:id])
    begin
      render 'calendar' # offending line (#22)
    rescue SystemStackError
      puts $!
      puts caller[0..1000]
    end
  end

Stacktrace

Started GET "/devices/as28" for 127.0.0.1 at 2015-05-27 12:33:17 +0100
Processing by DevicesController#calendar as HTML
  Parameters: {"id"=>"as28"}
  Device Load (0.4ms)  SELECT  "devices".* FROM "devices" WHERE "devices"."aid" = $1 LIMIT 1  [["aid", "as28"]]
  Rendered devices/calendar.html.erb within layouts/application (4.2ms)
stack level too deep
/Users/john/Code/shoestring/shoestring/app/controllers/devices_controller.rb:22:in `calendar'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:198:in `process_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:10:in `process_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_controller/metal/rescue.rb:29:in `process_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:137:in `process'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:30:in `process'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:196:in `dispatch'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:237:in `block in action'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:74:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:43:in `serve'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:43:in `block in serve'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `each'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `serve'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:819:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/etag.rb:24:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/conditionalget.rb:25:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/head.rb:13:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/flash.rb:260:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/session/abstract/id.rb:225:in `context'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/session/abstract/id.rb:220:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/cookies.rb:560:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/query_cache.rb:36:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:378:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/reloader.rb:73:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/web-console-2.1.2/lib/web_console/middleware.rb:37:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `block in call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `tagged'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/methodoverride.rb:22:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/runtime.rb:18:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/lock.rb:17:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/static.rb:113:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/sendfile.rb:113:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:518:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:164:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/lock.rb:17:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/content_length.rb:15:in `call'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.1/lib/rack/handler/webrick.rb:89:in `service'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/john/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
  Rendered devices/calendar.html.erb within layouts/application (2.2ms)
Completed 500 Internal Server Error in 18ms (ActiveRecord: 0.4ms)

SystemStackError (stack level too deep):
  app/views/devices/calendar.html.erb:4:in `_app_views_devices_calendar_html_erb___2422635003708194303_70179066701680'

Gemfile

source 'https://rubygems.org'

gem 'rails', '4.2.1'
gem 'pg'
gem 'turbograft'
gem 'simple_calendar', "~> 1.1.0"
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem 'spring'
end

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.1)
      actionpack (= 4.2.1)
      actionview (= 4.2.1)
      activejob (= 4.2.1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.1)
      actionview (= 4.2.1)
      activesupport (= 4.2.1)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    actionview (4.2.1)
      activesupport (= 4.2.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    activejob (4.2.1)
      activesupport (= 4.2.1)
      globalid (>= 0.3.0)
    activemodel (4.2.1)
      activesupport (= 4.2.1)
      builder (~> 3.1)
    activerecord (4.2.1)
      activemodel (= 4.2.1)
      activesupport (= 4.2.1)
      arel (~> 6.0)
    activesupport (4.2.1)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arel (6.0.0)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    builder (3.2.2)
    byebug (5.0.0)
      columnize (= 0.9.0)
    coffee-rails (4.1.0)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.9.1.1)
    columnize (0.9.0)
    debug_inspector (0.0.2)
    erubis (2.7.0)
    execjs (2.5.2)
    globalid (0.3.5)
      activesupport (>= 4.1.0)
    i18n (0.7.0)
    jbuilder (2.2.16)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (4.0.3)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (1.8.2)
    loofah (2.0.2)
      nokogiri (>= 1.5.9)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    mime-types (2.6.1)
    mini_portile (0.6.2)
    minitest (5.6.1)
    multi_json (1.11.0)
    nokogiri (1.6.6.2)
      mini_portile (~> 0.6.0)
    pg (0.18.2)
    rack (1.6.1)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.1)
      actionmailer (= 4.2.1)
      actionpack (= 4.2.1)
      actionview (= 4.2.1)
      activejob (= 4.2.1)
      activemodel (= 4.2.1)
      activerecord (= 4.2.1)
      activesupport (= 4.2.1)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.1)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.6)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.2)
      loofah (~> 2.0)
    railties (4.2.1)
      actionpack (= 4.2.1)
      activesupport (= 4.2.1)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.4.2)
    rdoc (4.2.0)
    sass (3.4.14)
    sass-rails (5.0.3)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (~> 1.1)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    simple_calendar (1.1.10)
      rails (>= 3.0)
    spring (1.3.6)
    sprockets (3.1.0)
      rack (~> 1.0)
    sprockets-rails (2.3.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (>= 2.8, < 4.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (1.4.1)
    turbograft (0.1.18)
      coffee-rails
    turbolinks (2.5.3)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.7.1)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    web-console (2.1.2)
      activemodel (>= 4.0)
      binding_of_caller (>= 0.7.2)
      railties (>= 4.0)
      sprockets-rails (>= 2.0, < 4.0)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  coffee-rails (~> 4.1.0)
  jbuilder (~> 2.0)
  jquery-rails
  pg
  rails (= 4.2.1)
  sass-rails (~> 5.0)
  sdoc (~> 0.4.0)
  simple_calendar (~> 1.1.0)
  spring
  turbograft
  turbolinks
  uglifier (>= 1.3.0)
  web-console (~> 2.0)

Troubles with routing next/prev month links

This may have to do more with the fact that I am pretty new to rails, but I am having trouble with routing the calendar's next/previous month links.

In my app I am using the calendar with a User model and pulling in events from various event-like models that belong to the user. Also, the calendar is being rendered on the User#show view (which might be part of the problem). Anyways, It works perfectly for the current month. I am able to view the calendar with events from 3 different models. However, when I try and view the next month, I have to have the calendar use its own action/view user#calendar because the next/prev links go to calendar?month=4&year=2012 (for example). I tried using a partial with the user#calendar action, but that also only works for the current month.

Is there a way to either customize how the routes work in simple_calendar or override them in routes.rb?

Events that span multiple days

Is it possible to have events that span multiple days? I don't think it is because although the docs say about start_time they don't mention a field for end time.

If not, Is this a possible future feature?

styling options for header

Hi there!
First off THANK YOU for this gem - it's awesome, super easy to set up and uncomplicated to work with. Just what I needed! ๐Ÿ‘

I've been trying to style the heading a little (month name as well as previous/next) by applying styling to my h2 in the stylesheet, however the optimal thing would be to have previous/next buttons instead of links. Is there an easy way to do that? Maybe there's an obvious solution, but I haven't really been able to figure it out. I would be grateful for any hints or help.

thanks in advance and ๐Ÿ‘ again!

Day View status

Any luck with the day view? Anything one can do to help push this along. Truly enjoy your gem and having a wonderful time working with it!

Display at most max # of events per day

Say a user got a calendar with 20 events on a Monday and 2 events on other days of that week, then to display all 20 events on Monday does not only look bad but also is likely undesired (the user will likely want to display only 2 events on Monday, and expect a "click here to view 18 more events" on the Monday td/li). It will be very useful if we can have a option in simple_calendar that enables that. Thanks!

Create Week View

Would like to have a week view that can be rendered easily as well.

Image example in readme

Was trying to brag about this project, and i couldn't find a good demo of how it looked, etc.

โค๏ธ

add license file

@excid3 we have spiked out a pull request in our app to use your calendar widget and really like it. But we also try our best to understand each and every one of our dependency's license. I couldn't find one in this repo. Would you be opposed to adding one? I see that you use MIT in one of your other projects https://github.com/excid3/receipts . Would an MIT license make sense here?

Thanks for considering this.

Display Year

Is there a way to display the year next to the month on the calendar?

at the moment i have the following -

<%= calendar @project_cals, {:prev_text=>"prev", :next_text=>"next"} do |calendar| %>

Months Are Not Translated

Day names are using I18n, but the month names are using a simple strftime to output them. This needs to be switched to using I18n.

I think it should be as simple as something like I18n.t("date.month_names")[8]

screenshot?

Any time to get a screenshot up? I'm not using twitter bootstrap right now, but I'm curious if it looks much different with it.

Adding custom CSS class

I am relatively new to this gem. I want to ask how to add custom CSS class. Is it integrated inside the gem? Thanks

Ajaxify Previous and Next Links

I have been trying to set the previous and next links to remote: true but to no avail. Have you gotten this to work? The server log shows that the link responded and loaded the new data with the proper params but the calendar just won't update.

generate model Events

I love your calendar code. I prefer the way you've done it. It is the best. I may raise more "feature" requests under issues, and I'll also be glad to fork and contribute as well.

In your README you give Events as a potential candidate for extending SimpleCalendar and say "but you can add this to any model or Ruby object". But in your file calendar.rb you explicitly have a method calling events events_for_date(current_date) and I don't see events initialized anywhere else in the code. Can you provide a line in the readme with the rails generate command for events as it is part of your calendar code. Or maybe build a rails generator, which would include the events model, that could be invoked with rails g simple_calendar:install?

Custom td with today class

I have customized the td for a week calendar as specified in the readme and demonstrated below:

def week_calendar_td_options
  ->(start_date, current_calendar_date) {
    {class: "cal-day", data: {day: current_calendar_date}}
  }
end

And here's what initializing my calendar looks like:

<%= week_calendar number_of_weeks: 5, header: {class: "cal-header"}, title: week_calendar_title_options, table: {class: "cal-table table table-bordered"}, tr: {class: "cal-row"}, td: week_calendar_td_options, previous_link: week_calendar_prev_link, next_link: week_calendar_next_link, events: @activities do |date, activities| %>

Everything works splendidly except that I can't seem to style .cal-day.today in my css to get the background and whatnot the color that I want. It worked fine before I customized the td class (.day.today styling looked great). Any ideas?

One Day Per Page

Is there a way to render the Calendar (when on Mobile/Tablet) so that one table cell (TD) is show per row? I see that if each TD sits in a Calendar Row it will work but this would require changing the HTML, not CSS, based on viewport/screen-size.

Thanks!!

There is no easy way to have custom td classes while keeping the default ones

I just wanted a custom class on the td corresponding to the start_date for a month_calendar but I also wanted to keep the existing default classes. My solution was the following:

module ApplicationHelper
  def mini_calendar(date, options = {})
    classes = (options[:class] || []) + ['calendar-box']
    content_tag(:div, class: classes) do
      month_calendar(start_date: date,
                     td: mini_calendar_td_classes,
                     title: ->(start_date) { start_date.strftime '%B' },
                     day_names: [],
                     next_link: nil,
                     previous_link: nil) do |d|
        concat d.day if d.month == date.month
      end
    end
  end

  def mini_calendar_td_classes
    ->(start_date, current_calendar_date) {
      today = Time.zone.now.to_date
      td_class = ['day']

      td_class << 'today'  if today == current_calendar_date
      td_class << 'past'   if today > current_calendar_date
      td_class << 'future' if today < current_calendar_date
      td_class << 'start-date' if current_calendar_date.to_date == start_date.to_date
      td_class << 'prev-month' if start_date.month != current_calendar_date.month && current_calendar_date < start_date
      td_class << 'next-month' if start_date.month != current_calendar_date.month && current_calendar_date > start_date
      td_class << 'current-month' if start_date.month == current_calendar_date.month
      td_class << "wday-#{current_calendar_date.wday.to_s}"

      { class: td_class.join(' ') }
    }
  end
end

The problem with this is that because I have duplicated the default code I won't get any updates if the default lambda gets added to in a future release. I feel like there should be an easy way to do this but the closest I could come up with was the following which seems really awkward:

  def mini_calendar_td_classes
    ->(start_date, current_calendar_date) {
      if current_calendar_date.to_date == start_date.to_date
        classes = 'start-date '
      else
        classes = ' '
      end
      classes << SimpleCalendar::Calendar.new({}).default_td_classes.call(start_date, current_calendar_date)
      { class: classes }
    }
  end
end

I'm not sure what the best solution is but in the mean time I'm going to make a pull request to add start-time to defaults because it seems pretty obvious.

Custom blocks to events links, title, etc.

Would be wonderful if we can add som blocks to customize the event link, calendar title and everything else.

For example, I need to show when a event on the calendar (I'm using a milestone model) are 100% completed, so I need to add a class to strike or change the color of it.

I'll try send a PR as soon as possible.

Feature request - Create a config for settings

I would like to see a config file for setting things like the text used in the next and previous links for the months so if you wanted to set it as ยป vs >, also I'm not sure how to go about added a config file so if someone does add one I will be able to build in more features as I come up with them on my own :)

cant get this to work

I just installed simple_calendar, and added has_calendar to my Evento class

class Evento
  include Mongoid::Document
  include Mongoid::Timestamps

  has_calendar :start_time => :data_evento

  field :data_evento, type: Date

  field :titulo, type: String
  field :descricao, type: String

  validates :titulo, :descricao, presence: true
end

but when I access /eventos, I get this

undefined method `has_calendar' for Evento:Class

am I missing something?
Thanks

edit

I'm using mongoid

Bug: september 2012 only goes up to sept 29th

To reproduce:

1.9.3-p125 :006 > include SimpleCalendar::ViewHelpers
=> Object

1.9.3-p125 :010 > selected_month = Date.new(2012, 9, 1)
=> Sat, 01 Sep 2012

1.9.3-p125 :011 > r = build_range(selected_month)
=> [Sun, 26 Aug 2012, Mon, 27 Aug 2012, Tue, 28 Aug 2012, Wed, 29 Aug 2012, Thu, 30 Aug 2012, Fri, 31 Aug 2012, Sat, 01 Sep 2012, Sun, 02 Sep 2012, Mon, 03 Sep 2012, Tue, 04 Sep 2012, Wed, 05 Sep 2012, Thu, 06 Sep 2012, Fri, 07 Sep 2012, Sat, 08 Sep 2012, Sun, 09 Sep 2012, Mon, 10 Sep 2012, Tue, 11 Sep 2012, Wed, 12 Sep 2012, Thu, 13 Sep 2012, Fri, 14 Sep 2012, Sat, 15 Sep 2012, Sun, 16 Sep 2012, Mon, 17 Sep 2012, Tue, 18 Sep 2012, Wed, 19 Sep 2012, Thu, 20 Sep 2012, Fri, 21 Sep 2012, Sat, 22 Sep 2012, Sun, 23 Sep 2012, Mon, 24 Sep 2012, Tue, 25 Sep 2012, Wed, 26 Sep 2012, Thu, 27 Sep 2012, Fri, 28 Sep 2012, Sat, 29 Sep 2012, Sun, 30 Sep 2012]

1.9.3-p125 :008 > m = build_month(r)
=> [[Sun, 26 Aug 2012, Mon, 27 Aug 2012, Tue, 28 Aug 2012, Wed, 29 Aug 2012, Thu, 30 Aug 2012, Fri, 31 Aug 2012, Sat, 01 Sep 2012], [Sun, 02 Sep 2012, Mon, 03 Sep 2012, Tue, 04 Sep 2012, Wed, 05 Sep 2012, Thu, 06 Sep 2012, Fri, 07 Sep 2012, Sat, 08 Sep 2012], [Sun, 09 Sep 2012, Mon, 10 Sep 2012, Tue, 11 Sep 2012, Wed, 12 Sep 2012, Thu, 13 Sep 2012, Fri, 14 Sep 2012, Sat, 15 Sep 2012], [Sun, 16 Sep 2012, Mon, 17 Sep 2012, Tue, 18 Sep 2012, Wed, 19 Sep 2012, Thu, 20 Sep 2012, Fri, 21 Sep 2012, Sat, 22 Sep 2012], [Sun, 23 Sep 2012, Mon, 24 Sep 2012, Tue, 25 Sep 2012, Wed, 26 Sep 2012, Thu, 27 Sep 2012, Fri, 28 Sep 2012, Sat, 29 Sep 2012]]

30th September is missing!

I'd expect it to be at the start of a 5th week

Passing attribute: :start_time causes error

/Users/Nadeem/.rvm/gems/ruby-2.1.2/gems/simple_calendar-1.1.5/lib/simple_calendar/model_additions.rb:9:in `class_eval': (eval):3: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)

Do you need more info?

Running rails 4.1.4

simple_calendar view specs

When I try to write a view spec that renders a calendar, I get the following error:

     Failure/Error: render
     ActionView::Template::Error:
       No route matches {:action=>"show", :controller=>"clubs", :start_date=>Sun, 29 Mar 2015}

It all works in development and production, of course; the URL generated appends the start_date as a traditional ?=start_date param. Any advice on stubbing this out or otherwise fixing it? I'm using Rails 4.1 and rspec 3.

Muchas gracias for this great gem!

any thoughts re what would be different for rails 3.0?

Hi, I like the simplistic aspect of the gem. Even though you very clearly say for rails 3.2, thought I'd try it for my 3.0.13 app... not too surprisingly it won;t get to first base...

wrong number of arguments (1 for 0)

Extracted source (around line #1):

1: <%= calendar @my_schedules do |event| %>
2:

<%= event.priority %>

3: <% end %>

Just wondering if you have any hints where I might go about modifying this to work with Rail 3.0? Not sure if it's 3.2 through-and-through, or if there might be just 1 or 2 little tweaks required?

Regardless, great work on coming up with a simple solution instead of the every-tool-in-the-kitchen approach of most gems.

undefined method

I'm having an issue, I followed the readme instructions, which were great but after including start_time in my model by using

def start_time
  start_date.to_datetime
end

then adding
<%= calendar @tasks do |task| %>

<%= link_to task.name, task %>

<% end %>

whenever I try to view the page the calendar is on I get the error

undefined method 'sunday?' for Fri, 01 Feb 2013:Date

for some reason occuring on the <%= calendar @tasks do |task| %> line, however when I search through the code I can't find any line in any file with the word sunday in it.

thanks

month_calendar / how to use use custom date instead of started_at or current date?

First of all thanks a lot for this simple and very customizable calendar. Unfortunately though, as a Rails beginner, I'm having a hard time setting the displayed month in the month_calendar to a custom date - here's the situation:

  • I use the month calendar as a sidebar mini-calendar that allows the user to browse the index view by date (created_at).
  • by clicking on a day you're routed to a url like this /orders/created/2014/07/02 which shows you the orders for the date selected
  • from these params I get a @date variable
  • the calendar doesn't use events for now

All of the above works, the orders are filtered correctly. Unfortunately the calendar defaults to the current month as I'm not sure how to tell it to use @date

I understand that the calendar is looking for a started_at attribute, which I'm not using (no events for now) or defaults to the current date.
I read the readme and browsed the issues here, but couldn't find an answer. How can I set a custom date for getting the month range? Am I missing something very obvious? Again, I'm just starting to learn Rails.

Thanks.

Add Travis CI for Continuous Integration

Reason: We all know that we break stuff without testing it out first. I use it in a couple Ruby repositories every single day after pushing commits and this add-on makes it easier for me to check what went wrong in tests and fix them right in the moments notice.

(Disclaimer: I was not paid to do this; though, It's easy and painless to setup)

Example:
rodrigoargumedo/personal-website-rails

gem install travis
# You need to go in your account settings and grab a personal token key to login.
travis login --github-token #{api-key} 
travis init

Ajax Calendar

Is there a way to make the next month links with ajax?

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.