Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
139feac
Makes the mnue look more like datepicker
benjamin-albert Nov 20, 2015
8bcce73
Fixed an issue with inline menus's width
benjamin-albert Nov 21, 2015
5373cb0
Merge branch 'master' into 3.0_prototype
benjamin-albert Nov 26, 2015
30d3273
Create .travis.yml
benjamin-albert Nov 27, 2015
14dfe2f
Update package.json for Travis CI
benjamin-albert Nov 27, 2015
a0f7622
Updated Node.js in .travis.yml
benjamin-albert Nov 27, 2015
0f73c87
Merge remote-tracking branch 'origin/3.0_prototype' into 3.0_prototype
benjamin-albert Nov 27, 2015
dbe9a7b
Added Travis CI and built with grunt badges to README
benjamin-albert Nov 27, 2015
1a7d29e
Makes the next and previous buttons have a transparent background
benjamin-albert Dec 5, 2015
e1fa4b8
Removes the width:60px rule from .month-year-input
benjamin-albert Dec 5, 2015
18a40a2
Adds themes test page (test/themes.html)
benjamin-albert Dec 6, 2015
cc8ded2
Merge remote-tracking branch 'kidsysco/master' into 3.0_prototype
benjamin-albert Dec 18, 2015
fc99cc4
Turns the year title into a button that fades in the text
benjamin-albert Dec 18, 2015
1f67723
Version bump in README.md
benjamin-albert Dec 18, 2015
b178132
Makes jump years button update it's text when the year changes
benjamin-albert Dec 19, 2015
46dd482
Renames classes and properties to reflect the new jump
benjamin-albert Dec 19, 2015
e314ddb
Ajusts the Start Year Option Tests to the new jump years button
benjamin-albert Dec 19, 2015
dcbb730
Ajusts Events and context + year buttons are disabled tests
benjamin-albert Dec 19, 2015
22b94c8
Ajusts the rest of the tests to the new jump years button structure
benjamin-albert Dec 19, 2015
6224289
Extracts the new jump years button code into its own function
benjamin-albert Dec 19, 2015
3dc868a
Makes moving forward and backwards through the years jump 12 year
benjamin-albert Dec 19, 2015
14dd334
Fixes an issue that prevented test from passing in IE.
benjamin-albert Dec 20, 2015
f013d7f
IE 8 support: Replaces use of .indexOf() with $.inArray()
benjamin-albert Dec 20, 2015
02440bc
Merge branch 'master' into 3.0_prototype
benjamin-albert Jan 1, 2016
5bfcc70
Makes the jump years button turn into Back to 2016
benjamin-albert Jan 2, 2016
7b5305f
Makes sure the Jump Years label won't show if the user clicks
benjamin-albert Jan 2, 2016
b429653
Merge branch 'master' into 3.0_prototype + bump to alpha6
Jan 5, 2016
236da1a
Adds MonthPicker.css to the main files in bower.json
Jan 6, 2016
832b111
Merge branch 'master' into 3.0_prototype
Jan 6, 2016
a119ac2
Improves CSS layout and adds comments.
Jan 12, 2016
124ec3b
Bumps version to 3.0-beta1
Jan 12, 2016
70f724e
Renames next/prev5Years i18n properties to next/prev12Years and
Jan 12, 2016
a3bbb04
Adds MonthPickerButton and makes all buttons in the header use it
Jan 12, 2016
079649d
Makes MonthPickerButton a private widget named _headerButton
Jan 12, 2016
fca9ef3
Fixes rare memory leak + renames _event() argument
Jan 13, 2016
5d63578
Merge branch 'master' into 3.0_progress
Jan 13, 2016
df3eb04
Makes the Title buttons test use an existing
Jan 13, 2016
a5b18e5
Adds the Back to 2015 button test
Jan 14, 2016
4fd4eff
Ajusts RTL support for the new designs CSS
Jan 14, 2016
116d71d
Makes the month buttons margin use em instead of px
Jan 14, 2016
7a7bd71
Adds the _applyButtonHint function
Jan 14, 2016
af6dee7
Removes _headerButton
Jan 14, 2016
b182dbf
Disables user selection on the year table (header)
Jan 14, 2016
be0aea4
Restores the jump years hint if the user closed the menu
Jan 14, 2016
3cbb69f
Adds comments to the _applyButtonHint function
Jan 14, 2016
2363473
Removes unnecessary margin from the year table buttons
benjamin-albert Jan 15, 2016
69fec96
Makes grunt produce a minified CSS file
benjamin-albert Jan 15, 2016
89d7225
Reduces the font size of the jump years button
benjamin-albert Jan 15, 2016
81db6f0
Adds the i18n button test
benjamin-albert Jan 16, 2016
7589c32
Gives new class names to <td>s in the month-picker-year-table
benjamin-albert Jan 16, 2016
c4ce4d6
Renames _jumpYearsButton to _titleButton
Jan 19, 2016
19fe092
Adds the 3.x Upgrade Guide
Jan 19, 2016
90e3d2c
Adds a link to the 3.0 Upgrade Guide to README.md
Jan 19, 2016
e1fc323
Runs grunt
benjamin-albert Jan 19, 2016
cb168bb
Adds notice about removing the width: 60px; rule
benjamin-albert Jan 19, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Makes the next and previous buttons have a transparent background
and ajausts the unit tests.
  • Loading branch information
benjamin-albert committed Dec 5, 2015
commit 1a7d29e08732552bce4c929bc8263d91b3d6676c
18 changes: 14 additions & 4 deletions MonthPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,21 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
}
};

//<a class="ui-state-hover ui-corner-all" style="width:23px;height:23px;display:inline-block;"><span class="ui-icon ui-icon-circle-triangle-w"></span></a>


var _markup =
'<div class="ui-widget-header month-picker-header ui-corner-all">' +
'<table class="month-picker-year-table" width="100%" border="0" cellspacing="1" cellpadding="2">' +
'<tr>' +
'<td class="previous-year"><button /></td>' +
'<td class="previous-year"><a /></td>' +
'<td class="year-container-all">' +
'<div id="year-container">' +
'<span class="year-title" />' +
'<span class="year" />' +
'</div>' +
'</td>' +
'<td class="next-year"><button /></td>' +
'<td class="next-year"><a /></td>' +
'</tr>' +
'</table>' +
'</div>' +
Expand Down Expand Up @@ -337,8 +340,9 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.

this._yearContainer = $('.year', _menu);

this._prevButton = $('.previous-year button', _menu).button({ text: false });
this._nextButton = $('.next-year button', _menu).button({ text: false });
this._prevButton = $('.previous-year a', _menu);
this._prevButton.button({ text: false }).removeClass('ui-state-default').css('cursor', 'default');
this._nextButton = $('.next-year a', _menu).button({ text: false }).removeClass('ui-state-default').css('cursor', 'default');

this._setRTL(_opts.IsRTL); //Assigns icons to the next/prev buttons.

Expand Down Expand Up @@ -865,6 +869,12 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_year.text(parseInt(_year.text()) + amount, 10);
this.element.focus();

var me = this;
setTimeout(function() {
var _btn = amount > 0 ? me._nextButton : me._prevButton;
_btn.addClass('ui-state-hover');
}, 1);

this._decorateButtons();

_event('OnAfter' + (amount > 0 ? 'Next' : 'Previous') + 'Year', this)();
Expand Down
6 changes: 5 additions & 1 deletion css/MonthPicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
.month-picker-year-table .year-container {
margin: 0 auto;
}
.month-picker-year-table a {
border: 1px solid transparent;
}

.month-picker-year-table .year-title {
margin: 3px;
font-size: 12px;
Expand Down Expand Up @@ -67,7 +71,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
margin-right: 0;
}

.month-picker-year-table button {
.month-picker-year-table /*button*/ a {
width: 28px;
width: 1.8em;
height: 1.8em;
Expand Down
6 changes: 5 additions & 1 deletion test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

<head>
<title>jQuery UI Month Picker tests</title>
<!--flick-->
<link rel="stylesheet" type="text/css" href="../bower_components/jquery-ui/themes/smoothness/jquery-ui.css">

<link rel="stylesheet" type="text/css" href="../bower_components/jquery-ui/
themes/smoothness/jquery.ui.theme.css">
<link rel="stylesheet" type="text/css" href="../css/MonthPicker.css" />
<link rel="stylesheet" type="text/css" href="test.css" />
<link rel="stylesheet" href="../bower_components/qunit/qunit/qunit.css" />
Expand All @@ -19,7 +23,7 @@
"Welcome to the jQuery UI Month Picker project.\n" +
"\n" +
"jQuery UI and QUnit are required for testing.\n" +
"Please download node.js, 'cd /jquery-ui-month-picker' and run 'npm install'.\n" +
"Please download node.js, 'cd ./jquery-ui-month-picker' and run 'npm install'.\n" +
"\n" +
"Tests can be ran from the command line using the 'grunt test' command.";

Expand Down
30 changes: 15 additions & 15 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ QUnit.test('Inline menu', function(assert) {

assert.notOk($("#MonthPicker_Button_InlineMenuDiv").length, 'The default button was not created');

field.MonthPicker('destroy');
//field.MonthPicker('destroy');
});

QUnit.test('SelectedMonth option', function(assert) {
Expand Down Expand Up @@ -479,7 +479,7 @@ QUnit.test('Events and context', function (assert) { // A.k.a duplicate code tes
assert.equal( this, EventsField, 'OnAfterNextYear was called in the right context' );
});

var nextYearButton = menu.find('.next-year>button');
var nextYearButton = menu.find('.next-year>a');
nextYearButton.trigger('click');
assert.ok(OnAfterNextYearTriggered, 'Clicking the next button triggered OnAfterNextYear');

Expand All @@ -490,7 +490,7 @@ QUnit.test('Events and context', function (assert) { // A.k.a duplicate code tes
assert.equal( this, EventsField, 'OnAfterPreviousYear was called in the right context' );
});

var previousYearButton = menu.find('.previous-year>button');
var previousYearButton = menu.find('.previous-year>a');
previousYearButton.trigger('click');
assert.ok(OnAfterPreviousYearTriggerd, 'Clciking rhe previous button triggered OnAfterPreviousYear');

Expand Down Expand Up @@ -631,8 +631,8 @@ QUnit.test('Right to left', function (assert) {

var menu = $(MonthPicker_RTLField);

var nextYearButton = menu.find('.next-year>button');
var previousYearButton = menu.find('.previous-year>button');
var nextYearButton = menu.find('.next-year>a');
var previousYearButton = menu.find('.previous-year>a');

// Make sure the buttons are pointing in the right (opposite) direction.
assert.ok(previousYearButton.find('span.ui-icon-circle-triangle-e').length, 'Previous button is pointed east');
Expand Down Expand Up @@ -945,8 +945,8 @@ QUnit.test('Month buttons are disabled', function (assert) {
field.MonthPicker('Open');

var menu = $(MonthPicker_RistrictMonthField);
var previousYearButton = menu.find('.previous-year>button');
var nextYearButton = menu.find('.next-year>button');
var previousYearButton = menu.find('.previous-year>a');
var nextYearButton = menu.find('.next-year>a');

// Try to click the disabled buttons.
var buttons = menu.find('.month-picker-month-table button');
Expand Down Expand Up @@ -1045,7 +1045,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
assert.ok(firstVisibleYear, "Clciking the disabled buttons didn't take us to month view");

// Make sure the next years button is disabled.
var nextYearsButton = menu.find('.next-year>button');
var nextYearsButton = menu.find('.next-year>a');
var isDisabled = nextYearsButton
.trigger('click')
.is('.ui-button-disabled');
Expand All @@ -1054,7 +1054,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
var newFirstYrar = parseInt($(buttons[0]).text(), 10);
assert.equal(newFirstYrar, firstVisibleYear, "Clicking next year didn't change the year");

var previousYearsButton = menu.find('.previous-year>button');
var previousYearsButton = menu.find('.previous-year>a');
// Keep going back until there are no disabled buttons.
// We count to 10 to avoid an infinite loop in case there's
// a bug where we are going back in time but the the buttons stay disabled.
Expand Down Expand Up @@ -1227,8 +1227,8 @@ QUnit.test('Today and selected months are highlighted', function (assert) {
var buttons = menu.find('.month-picker-month-table button');

var todaysButton = $(buttons[new Date().getMonth()]);
var nextYearButton = menu.find('.next-year>button');
var previousYearButton = menu.find('.previous-year>button');
var nextYearButton = menu.find('.next-year>a');
var previousYearButton = menu.find('.previous-year>a');

assert.ok(todaysButton.is('.ui-state-highlight'), "Today's month is highlighted");

Expand Down Expand Up @@ -1288,8 +1288,8 @@ QUnit.test('Number of months from today', function (assert) {

// Make sure we are in years view.
var buttons = menu.find('.month-picker-month-table button');
var nextYearButton = menu.find('.next-year>button');
var previousYearButton = menu.find('.previous-year>button');
var nextYearButton = menu.find('.next-year>a');
var previousYearButton = menu.find('.previous-year>a');

var enabledMonths = 0;

Expand Down Expand Up @@ -1344,8 +1344,8 @@ QUnit.test('Relative month periods', function (assert) {

// Make sure we are in years view.
var buttons = menu.find('.month-picker-month-table button');
var nextYearButton = menu.find('.next-year>button');
var previousYearButton = menu.find('.previous-year>button');
var nextYearButton = menu.find('.next-year>a');
var previousYearButton = menu.find('.previous-year>a');
var enabledMonths = 0;

// Make sure that 18 buttons + 1 for today are disabled.
Expand Down