mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Calendar: Introduce build methods for year and month title
This commit is contained in:
parent
c1cb6e3398
commit
5ee64dd0e0
@ -9,21 +9,7 @@
|
||||
<script src="../../external/requirejs/require.js"></script>
|
||||
<script src="../bootstrap.js">
|
||||
$.widget( "ui.calendar", $.ui.calendar, {
|
||||
_buildTitle: function() {
|
||||
var title = $( "<div>", { role: "alert", id: this.gridId + "-month-label" } ),
|
||||
month = this._renderMonthSelect(),
|
||||
year = this._renderYearSelect();
|
||||
|
||||
this._addClass( title, "ui-calendar-title" )
|
||||
._addClass( month, "ui-calendar-month" )
|
||||
._addClass( year, "ui-calendar-year" );
|
||||
|
||||
return title
|
||||
.append( month )
|
||||
.append( " " )
|
||||
.append( year );
|
||||
},
|
||||
_renderMonthSelect: function() {
|
||||
_buildTitleMonth: function() {
|
||||
var select = $( "<select>" ),
|
||||
date = this.date.clone(),
|
||||
i = 0,
|
||||
@ -48,7 +34,7 @@
|
||||
|
||||
return select;
|
||||
},
|
||||
_renderYearSelect: function() {
|
||||
_buildTitleYear: function() {
|
||||
var current = new Date(),
|
||||
select = $( "<select>" ),
|
||||
i = current.getFullYear(),
|
||||
|
@ -366,8 +366,8 @@ return $.widget( "ui.calendar", {
|
||||
|
||||
_buildTitle: function() {
|
||||
var title = $( "<div>", { role: "alert", id: this.gridId + "-month-label" } ),
|
||||
month = $( "<span>" ).text( this.viewDate.monthName() ),
|
||||
year = $( "<span>" ).text( this.viewDate.year() );
|
||||
month = this._buildTitleMonth(),
|
||||
year = this._buildTitleYear();
|
||||
|
||||
this._addClass( title, "ui-calendar-title" )
|
||||
._addClass( month, "ui-calendar-month" )
|
||||
@ -379,6 +379,14 @@ return $.widget( "ui.calendar", {
|
||||
.append( year );
|
||||
},
|
||||
|
||||
_buildTitleMonth: function() {
|
||||
return $( "<span>" ).text( this.viewDate.monthName() );
|
||||
},
|
||||
|
||||
_buildTitleYear: function() {
|
||||
return $( "<span>" ).text( this.viewDate.year() );
|
||||
},
|
||||
|
||||
_buildGrid: function() {
|
||||
var table = $( "<table>", {
|
||||
role: "grid",
|
||||
|
Loading…
Reference in New Issue
Block a user