Skip to content

Commit

Permalink
ax5calendar 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasJang committed Feb 4, 2016
1 parent b445a53 commit 817b644
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 9 deletions.
26 changes: 26 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ myCalendar.setConfig({
dayTmpl: 'String' // %s
},
selectable: 'Array|Object',
marker: 'Object',
multipleSelect: 'false|Number', // false
onClick: "Function", // null
onStateChanged: "Function" // null
Expand Down Expand Up @@ -168,6 +169,18 @@ selectable: { range: [{from: new Date(2016, 0, 1), to: new Date(2016, 0, 2)}] }
selectable: { '2016-01-01': true, '2016-01-02': true }
```

### marker

Type: `Object`

```js
marker: {
'2016-02-07': {theme: 'holiday', label: '설날'},
'2016-02-08': {theme: 'holiday', label: '설날'},
'2016-02-09': {theme: 'holiday', label: '설날'},
'2016-02-10': {theme: 'holiday', label: '대체휴일'}
}
```

### multipleSelect

Expand Down Expand Up @@ -237,3 +250,16 @@ myCalendar.setSelectable({ range: [{from: new Date(), to: new Date()}] });
myCalendar.setSelectable({ '2016-01-01': true, '2016-01-02': true });
```

- - -

## setMarker()
`setMarker(marker[, isApply])`

```js
myCalendar.setMarker({
'2016-02-07': {theme: 'holiday', label: '설날'},
'2016-02-08': {theme: 'holiday', label: '설날'},
'2016-02-09': {theme: 'holiday', label: '설날'},
'2016-02-10': {theme: 'holiday', label: '대체휴일'}
});
```
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-ax5calendar",
"version": "0.6.0",
"version": "0.7.0",
"authors": [
"ThomasJ <[email protected]>"
],
Expand Down
13 changes: 11 additions & 2 deletions dist/ax5calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@
}
};

return function (marker, isPrint) {
return function (marker, isApply) {

var
key,
Expand All @@ -896,10 +896,19 @@

this.markerMap = result;
// 변경내용 적용하여 출력
if (isPrint !== false) this.changeMode();
if (isApply !== false) this.applyMarkerMap();
};
})();

this.applyMarkerMap = function(){
if (cfg.mode === "day" || cfg.mode === "d")
{
for(var k in this.markerMap){
this.$["body"].find('[data-calendar-item-date="'+k+'"]').addClass(this.markerMap[k].theme);
}
}
};

// 클래스 생성자
this.main = (function () {
if (arguments && U.isObject(arguments[0])) {
Expand Down
2 changes: 1 addition & 1 deletion dist/ax5calendar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-ax5calendar",
"version": "0.6.0",
"version": "0.7.0",
"description": "A calendar plugin that works with Bootstrap & jQuery",
"license": "MIT",
"repository": {
Expand Down
13 changes: 11 additions & 2 deletions src/ax5calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@
}
};

return function (marker, isPrint) {
return function (marker, isApply) {

var
key,
Expand All @@ -896,10 +896,19 @@

this.markerMap = result;
// 변경내용 적용하여 출력
if (isPrint !== false) this.changeMode();
if (isApply !== false) this.applyMarkerMap();
};
})();

this.applyMarkerMap = function(){
if (cfg.mode === "day" || cfg.mode === "d")
{
for(var k in this.markerMap){
this.$["body"].find('[data-calendar-item-date="'+k+'"]').addClass(this.markerMap[k].theme);
}
}
};

// 클래스 생성자
this.main = (function () {
if (arguments && U.isObject(arguments[0])) {
Expand Down
12 changes: 10 additions & 2 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@
selectMode: "day",

// selectable: {range:[{from: '2016-02-01', to: '2016-02-20'}]},

/*
marker: {
'2016-02-07': {theme: 'holiday', label: '설날'},
'2016-02-08': {theme: 'holiday', label: '설날'},
'2016-02-09': {theme: 'holiday', label: '설날'},
'2016-02-10': {theme: 'holiday', label: '대체휴일'}
},
*/
onClick: function () {
console.log(myCalendar.getSelection());
},
Expand All @@ -81,7 +82,14 @@
});

/// todo : 공휴일 표시에 대한 대안 필요.
myCalendar.setSelection(['2016-02-11', '2016-02-12', '2016-02-13']);
// myCalendar.setSelection(['2016-02-11', '2016-02-12', '2016-02-13']);

myCalendar.setMarker({
'2016-02-07': {theme: 'holiday', label: '설날'},
'2016-02-08': {theme: 'holiday', label: '설날'},
'2016-02-09': {theme: 'holiday', label: '설날'},
'2016-02-10': {theme: 'holiday', label: '대체휴일'}
});
});
</script>

Expand Down

0 comments on commit 817b644

Please sign in to comment.