aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2016-04-16 17:20:58 +0200
committerFelix Nagel <info@felixnagel.com>2016-09-29 15:10:46 +0200
commitd7939faae293b82d24eee21d613fe56309d6988c (patch)
tree6ddb0018b0b9f74441d92241941c8d2fad71947e
parent6fdf14f99a8c97baa5f57a88fcc1dd64bbfb243e (diff)
downloadjquery-ui-d7939faae293b82d24eee21d613fe56309d6988c.tar.gz
jquery-ui-d7939faae293b82d24eee21d613fe56309d6988c.zip
Calendar: Add icons option support
-rw-r--r--tests/unit/calendar/common.js4
-rw-r--r--ui/widgets/calendar.js29
2 files changed, 21 insertions, 12 deletions
diff --git a/tests/unit/calendar/common.js b/tests/unit/calendar/common.js
index 586c505f8..b6807ec84 100644
--- a/tests/unit/calendar/common.js
+++ b/tests/unit/calendar/common.js
@@ -17,6 +17,10 @@ common.testWidget( "calendar", {
disabled: false,
dateFormat: { date: "short" },
eachDay: $.noop,
+ icons: {
+ prevButton: "ui-icon-circle-triangle-w",
+ nextButton: "ui-icon-circle-triangle-e"
+ },
labels: {
"datePickerRole": "date picker",
"nextText": "Next",
diff --git a/ui/widgets/calendar.js b/ui/widgets/calendar.js
index f84c4d1cf..4c9a03545 100644
--- a/ui/widgets/calendar.js
+++ b/ui/widgets/calendar.js
@@ -54,6 +54,10 @@ return $.widget( "ui.calendar", {
},
dateFormat: { date: "short" },
eachDay: $.noop,
+ icons: {
+ prevButton: "ui-icon-circle-triangle-w",
+ nextButton: "ui-icon-circle-triangle-e"
+ },
labels: {
"datePickerRole": "date picker",
"nextText": "Next",
@@ -309,20 +313,21 @@ return $.widget( "ui.calendar", {
_buildHeaderButtons: function() {
var buttons = $( "<div>" );
- this.prevButton = $( "<button>", {
- html: "<span class='ui-icon ui-icon-circle-triangle-w'></span>"
- } );
- this.nextButton = $( "<button>", {
- html: "<span class='ui-icon ui-icon-circle-triangle-e'></span>"
- } );
-
- this._addClass( buttons, "ui-calendar-header-buttons" )
- ._addClass( this.prevButton, "ui-calendar-prev" )
- ._addClass( this.nextButton, "ui-calendar-next" );
+ this._addClass( buttons, "ui-calendar-header-buttons" );
return buttons
- .append( this.prevButton )
- .append( this.nextButton );
+ .append( this.prevButton = this._buildIconButton( "prev" ) )
+ .append( this.nextButton = this._buildIconButton( "next" ) );
+ },
+
+ _buildIconButton: function( key ) {
+ var button = $( "<button>" ),
+ icon = $( "<span>" );
+
+ this._addClass( button, "ui-calendar-" + key )
+ ._addClass( icon, null, "ui-icon " + this.options.icons[ key + "Button" ] );
+
+ return button.append( icon );
},
_buildHeader: function() {