Giter VIP home page Giter VIP logo

simple_calendar's Issues

Image example in readme

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

❤️

Create Week View

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

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

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.

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.

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?

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

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 :)

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.

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!!

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)

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!

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)

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.

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

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

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?

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?

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!

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.

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| %>

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.

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

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]

Ajax Calendar

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

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!

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!

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

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?

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.

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.

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.

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.