Giter VIP home page Giter VIP logo

calendar_helper's Introduction

CalendarHelper

Added in this repo

  • :other_month_colspan option

  • :display_day_names option

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.

There is also a Rails generator that copies some stylesheets for use alone or alongside existing stylesheets.

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.

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

AUTHORS:

Jeremy Voorhis – jvoorhis.com Original implementation

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

Contributors:

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.

calendar_helper's People

Contributors

benlieb avatar fxposter avatar johndouthat avatar monde avatar topfunky avatar wilkerlucio avatar

Stargazers

 avatar

Watchers

 avatar

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.