百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

calendar_helper

> 编程语言
开源

用于生成日历的 Ruby 插件

367 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于生成日历的 Ruby 插件

= CalendarHelper

{}[http://travis-ci.org/topfunky/calendar_helper]

== DESCRIPTION:

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' */

== SYNOPSIS:

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.

@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

== Accessibility & 508 Compliance:

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

== AUTHORS:

Jeremy Voorhis -- http://jvoorhis.com Original implementation

Geoffrey Grosenbach -- http://nubyonrails.com Test suite and conversion to a Rails plugin

== Contributors:

  • Jarkko Laine http://jlaine.net/
  • Tom Armitage http://infovore.org
  • Bryan Larsen http://larsen.st
  • Eric Anderson http://saveyourcall.com

== USAGE:

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.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言