Skip to content

Commit

Permalink
rename menu methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Oct 17, 2012
1 parent 66e0459 commit 8235f25
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
13 changes: 5 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,14 @@ cal.el.appendTo('body');
Show the given `date`. This does _not_ select the given date,
it simply ensures that it is visible in the current view.

### Calendar#monthMenu()
### Calendar#showMonthSelect()

Adds a month dropdown menu to allow jumping to selected month.
Add month selection input.

### Calendar#yearMenu([from], [to])
### Calendar#showYearSelect([from], [to])

Adds a year dropdown menu to allow jumping to selected year. `From` specifies the first year shown in the dropdown and `to` the last year. This means that if `to` is less than `from`, the years will be listed in descending order.

If `from`/`to` are both not specified the dropdown defaults to -/+ 10 years from the calendar's date.

If only `from` specified it defaults `to` +20 years from that year.
Add year selection input, with optional range specified by `from` and `to`,
which default to the current year -10 / +10.

### Calendar#prev()

Expand Down
4 changes: 2 additions & 2 deletions lib/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Calendar.prototype.show = function(date){
* @api public
*/

Calendar.prototype.yearMenu = function(from, to){
Calendar.prototype.showYearSelect = function(from, to){
if (!from) {
from = this._date.getFullYear() - 10;
to = this._date.getFullYear() + 10;
Expand All @@ -124,7 +124,7 @@ Calendar.prototype.yearMenu = function(from, to){
* @api public
*/

Calendar.prototype.monthMenu = function(){
Calendar.prototype.showMonthSelect = function(){
this.days.monthMenu();
this.show(this._date);
return this;
Expand Down
2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h1>Calendar</h1>
<script src="../build/build.js"></script>
<script>
var Calendar = require('calendar');
var one = new Calendar().monthMenu().yearMenu();
var one = new Calendar().showMonthSelect().showYearSelect();

one.on('view change', function(date, action){
console.log(action);
Expand Down

0 comments on commit 8235f25

Please sign in to comment.