Skip to content
项目

关于

Calendar-generating plugin for Ruby

效率与自动化

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

<img src=“https://secure.travis-ci.org/topfunky/calendar_helper.png?branch=master” alt=“Build Status” />

A simple helper for creating an HTML calendar. The “calendar” method will be automatically available to your Rails view templates, or can be used with Sinatra or other webapps.

Some example stylesheets are provided via the Rails asset pipeline. Add to your main stylesheet with one of the following:

/*
 *= require 'calendar_styles/grey'
 *   OR
 *= require 'calendar_styles/red'
 *   OR
 *= require 'calendar_styles/blue'
 */
# Simple
calendar(:year => 2005, :month => 6)

# Set table class
calendar({:year => 2005, :month => 6, :table_class => "calendar_helper"})

# Full featured
calendar(:year => 2005, :month => 5) do |d| # This generates a simple calendar, but gives special days
  if listOfSpecialDays.include?(d)          # (days that are in the array listOfSpecialDays) one CSS class,
    [d.mday, {:class => "specialDay"}]      # "specialDay", and gives the rest of the days another CSS class,
  else                                      # "normalDay". You can also use this highlight today differently
    [d.mday, {:class => "normalDay"}]       # from the rest of the days, etc.
  end
end

If using with ERb (Rails), put in a printing tag.

<%= calendar(:year => @year, :month => @month, :first_day_of_week => 1) do |d|
      render_calendar_cell(d)
    end
%>

With Haml, use a helper to set options for each cell.

= calendar(:year => @year, :month => @month, :first_day_of_week => 1) do |d|
  - render_calendar_cell(d)

In Sinatra, include the CalendarHelper module in your helpers:

helpers do
  include CalendarHelper
end
  • The table tag has a summary attribute (overridable).

  • Each th has an id.

  • Each td as a headers attribute, containing the element id of the appropriate th.

Jeremy Voorhis – jvoorhis.com Original implementation

Geoffrey Grosenbach – nubyonrails.com Test suite and conversion to a Rails plugin

See the RDoc (or use “rake rdoc”).

To copy the CSS files, use

./script/generate calendar_styles

CSS will be copied to subdirectories of public/stylesheets/calendar.

探索相关项目

加载中…