0.0.7 • Published 8 years ago

mithril-calendar v0.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

mithril-calendar

A calendar component for mithril.

NPM

You can see a demo here.

installation

You can get a copy with bower or npm or just download it from the dist/ folder, here.

webpack/browserify/etc

var MithrilCalendar = require('mithril-calendar');

requirejs

define(['mithril','MithrilCalendar'], function(m,MithrilCalendar){
  
});

plain browser globals

<script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.30/mithril.min.js"></script>
<script src="http://konsumer.github.io/mithril-calendar/dist/MithrilCalendar.min.js"></script>

usage

Have a look at index.js to see how to construct the view, if you don't want it to look like mine, or want to leave out links or whatever, just construct your own view from stuff exposed in the controller.

var MyComponent = {
  controller: function(){
    var now = new Date();
    this.year = m.route.param('year') ? m.route.param('year') : now.getFullYear();
    this.month = m.route.param('month') ? m.route.param('month') : now.getMonth()+1;
    this.calendar = new MithrilCalendar.controller(this.year, this.month);
  },
  view: function(ctrl){
    return MithrilCalendar.view(ctrl.calendar);
  }
}

You will also need some CSS. I use LESS, so you can use that from dist/MithrilCalendar.less or the CSS file I built from it.

You can also get it via CDN, like this:

<link href="http://konsumer.github.io/mithril-calendar/dist/MithrilCalendar.min.css" media="all" rel="stylesheet" type="text/css" />
0.0.7

8 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago