GithubHelp home page GithubHelp logo

dangerouse / event_cal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shin1ohno/event_cal

0.0 1.0 0.0 403 KB

Calendar that easy to use, easy to customise

Home Page: http://shin1ohno.github.com/event_cal/

License: MIT License

Ruby 63.97% JavaScript 27.71% CoffeeScript 7.32% CSS 1.00%

event_cal's Introduction

Travis CI Code Climate Dependency Status

EventCal

EventCal is a calendar with events on it.

You can easily

  • create and display many kinds of events
  • customize how events displayed
  • integrate events with existing model

Use EventCal

gem 'event_cal', github: 'shin1ohno/event_cal'
  1. create calendar instance in controller and call render_monthly(@calendar) in view. simple sample code is below. only with this step, you basically can get calendar view
  2. create event class that extends ::EventCal::Events
  3. create partial for each event. with sptep 2 and 3 it's automatically shown in calendar view

sample/app_*** directory contains sample rails application that shows how you do. This sample runs as normal rails application.

class MyCalendarController < ApplicationController
  def index
    @calendar = ::EventCal::Calendar.new(Date.today)
  end

  def show
    date = Date.parse("#{params[:year]}-#{params[:month]}-#{params[:date]}")
    @calendar = ::EventCal::Calendar.new(date)
  end
end
.calendar_view
  = render_monthly(@calendar)
  = render_event_details(@calendar.events) # if you need event details view
# typically, you may want to draw routes like this
App3211::Application.routes.draw do
  resources :my_calendar do
    collection do
      get ':year/:month/:date' => 'my_calendar#show', :constraints => { :year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/ }
    end
  end
end

you can use default style for 7days * 4~5 weeks calendar

/*
 in application.css... add sprockets manifest like
 *= require_self
 *= require event_cal
 *= require_tree .
 */

you can use basic event detail selector implemented in JavaScript with Spine.js

// in application.js... add sprockets manifest like
//= require jquery
//= require jquery_ujs
//= require event_cal
//= require_tree .
// and then initialize like this...

jQuery(function($) {
  var baseDatelement;
  CalendarApplication.initialize();
  baseDatelement = CalendarDate.findByAttribute('date', $('.calendar').data('base-date')).element;
  if (baseDatelement.hasClass('has_events')) {
    return baseDatelement.click();
  }
});

Develop EventCal

running tests

bundle exec rake runs all examples

bundle first. bundle exec tork then hit a to run all rspec examples. bundle exec guard then hit return to run all jasmine expamples

Thanks

License

This project uses MIT-LICENSE.

event_cal's People

Contributors

dangerouse avatar shin1ohno 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.