jquery-monthpicker-rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/README.md +6 -2
- data/jquery-monthpicker-rails.gemspec +1 -1
- data/lib/jquery/monthpicker/rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.ui.monthpicker.js +17 -6
- metadata +14 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f18065e3578e39b4438bb5bf609a7f7a3e333f97
|
4
|
+
data.tar.gz: 32b629d78ca93df019fbf00c1f9d2b11133992cd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84809cb1be4db65ecee3798cefdabe2c3b35e2740b045ccd42a0c69ca02670ccb1fee255dab34ed3e7054b818af80199ccec35adf6c82cc5b520cdc2f171c8e5
|
7
|
+
data.tar.gz: 3ecaa35dbd45e56240e9319eaee39ffff89edf600ed448098d71e451d72c9043efed127c8aea642d0026616aed1d12606e20260a5ea06b93a1e94a209ecd2cc1
|
data/.gitignore
ADDED
data/README.md
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
# jquery-monthpicker-rails
|
2
2
|
|
3
|
-
This gem packages the jQuery Monthpicker assets for the Rails 3.1+ asset pipeline.
|
3
|
+
This gem packages the [jQuery Monthpicker][] assets for the Rails 3.1+ asset pipeline.
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/jquery-monthpicker-rails.png)](http://badge.fury.io/rb/jquery-monthpicker-rails)
|
4
6
|
|
5
7
|
# Usage
|
6
8
|
|
7
9
|
In your Gemfile, add:
|
8
10
|
|
9
11
|
```ruby
|
10
|
-
gem "jquery-monthpicker-rails"
|
12
|
+
gem "jquery-monthpicker-rails", "~> 0.0.1"
|
11
13
|
```
|
12
14
|
|
13
15
|
Then require the javascript in your application.js
|
@@ -15,3 +17,5 @@ Then require the javascript in your application.js
|
|
15
17
|
```js
|
16
18
|
//= require jquery.ui.monthpicker
|
17
19
|
```
|
20
|
+
|
21
|
+
[jQuery Monthpicker]: https://github.com/zorab47/jquery.ui.monthpicker
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.version = Jquery::Monthpicker::Rails::VERSION
|
7
7
|
s.authors = ["Charles Maresh"]
|
8
8
|
s.email = ["cmaresh@gmail.com"]
|
9
|
-
s.homepage = "https://github.com/
|
9
|
+
s.homepage = "https://github.com/zorab47/jquery-monthpicker-rails"
|
10
10
|
s.summary = "jQuery Monthpicker packaged for the Rails asset pipeline"
|
11
11
|
s.description = "jQuery Monthpicker's JavaScript files packaged for the Rails 3.1+ asset pipeline"
|
12
12
|
s.license = "MIT"
|
@@ -43,8 +43,9 @@
|
|
43
43
|
this._mainDivId = 'ui-monthpicker-div'; // The ID of the main monthpicker division
|
44
44
|
this._triggerClass = 'ui-monthpicker-trigger'; // The name of the trigger marker class
|
45
45
|
this._dialogClass = 'ui-monthpicker-dialog'; // The name of the dialog marker class
|
46
|
-
this._currentClass = "ui-datepicker-
|
46
|
+
this._currentClass = "ui-datepicker-today"; // The name of the current day marker class
|
47
47
|
this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
|
48
|
+
this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
|
48
49
|
this.regional = []; // Available regional settings, indexed by language code
|
49
50
|
this.regional[''] = { // Default regional settings
|
50
51
|
closeText: "Done", // Display text for close link
|
@@ -198,6 +199,7 @@
|
|
198
199
|
|
199
200
|
/* Make attachments based on settings. */
|
200
201
|
_attachments: function(input, inst) {
|
202
|
+
var buttonText, buttonImage;
|
201
203
|
var appendText = this._get(inst, "appendText"),
|
202
204
|
isRTL = this._get(inst, "isRTL");
|
203
205
|
|
@@ -667,13 +669,15 @@
|
|
667
669
|
|
668
670
|
/* Generate the HTML for the current state of the date picker. */
|
669
671
|
_generateHTML: function(inst) {
|
670
|
-
var printDate, hideIfNoPrevNext;
|
672
|
+
var printDate, hideIfNoPrevNext, unselectable;
|
671
673
|
|
672
674
|
hideIfNoPrevNext = false;
|
673
675
|
var today = new Date();
|
674
676
|
today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // clear time
|
675
677
|
var currentDate = (!inst.currentMonth ? new Date(9999, 9, 9) :
|
676
678
|
new Date(inst.currentYear, inst.currentMonth, 1));
|
679
|
+
var minDate = this._getMinMaxDate(inst, "min");
|
680
|
+
var maxDate = this._getMinMaxDate(inst, "max");
|
677
681
|
var html = '';
|
678
682
|
var year = currentDate && currentDate.year ? currentDate.year : 2011;
|
679
683
|
var prevText = this._get(inst, 'prevText');
|
@@ -706,7 +710,7 @@
|
|
706
710
|
(hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));
|
707
711
|
|
708
712
|
html += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">' +
|
709
|
-
prev + next + this._generateYearHeader(inst, drawYear) + // draw year header
|
713
|
+
prev + next + this._generateYearHeader(inst, drawYear, minDate, maxDate) + // draw year header
|
710
714
|
'</div><table class="ui-datepicker-calendar"><tbody>';
|
711
715
|
|
712
716
|
// draw months table
|
@@ -716,10 +720,12 @@
|
|
716
720
|
}
|
717
721
|
|
718
722
|
printDate = new Date(drawYear, month, 1);
|
723
|
+
unselectable = (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
|
719
724
|
var selectedDate = new Date(drawYear, inst.selectedMonth, 1);
|
720
725
|
|
721
726
|
html += '<td class="'
|
722
727
|
+ (drawYear == inst.currentYear && month == inst.currentMonth ? " " + this._currentClass : "") // highlight selected month
|
728
|
+
+ (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") // highlight unselectable months
|
723
729
|
+ ((month === inst.selectedMonth && drawYear === inst.selectedYear && inst._keyEvent) || // user pressed key
|
724
730
|
(defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
|
725
731
|
// or defaultDate is current printedDate and defaultDate is selectedDate
|
@@ -754,7 +760,8 @@
|
|
754
760
|
},
|
755
761
|
|
756
762
|
/* Generate the year header. */
|
757
|
-
_generateYearHeader: function(inst, drawYear) {
|
763
|
+
_generateYearHeader: function(inst, drawYear, minDate, maxDate) {
|
764
|
+
var inMinYear, inMaxYear;
|
758
765
|
var changeYear = this._get(inst, 'changeYear');
|
759
766
|
var html = '<div class="ui-datepicker-title">';
|
760
767
|
// year selection
|
@@ -773,6 +780,9 @@
|
|
773
780
|
};
|
774
781
|
var year = determineYear(years[0]);
|
775
782
|
var endYear = Math.max(year, determineYear(years[1] || ''));
|
783
|
+
|
784
|
+
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
|
785
|
+
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
|
776
786
|
|
777
787
|
inst.yearshtml += '<select class="ui-datepicker-year" ' +
|
778
788
|
"data-handler='selectYear' data-event='change'>";
|
@@ -900,8 +910,9 @@
|
|
900
910
|
|
901
911
|
/* Determines if we should allow a "next/prev" year display change. */
|
902
912
|
_canAdjustYear: function(inst, offset, curYear) {
|
903
|
-
var
|
904
|
-
|
913
|
+
var firstMonth = new Date(curYear + offset, 0, 1);
|
914
|
+
var lastMonth = new Date(curYear + offset, 11, 1);
|
915
|
+
return this._isInRange(inst, firstMonth) || this._isInRange(inst, lastMonth);
|
905
916
|
},
|
906
917
|
|
907
918
|
/* Is the given date in the accepted range? */
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-monthpicker-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Charles Maresh
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-11-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: railties
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.1.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 3.1.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: jquery-ui-rails
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '3.0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '3.0'
|
46
41
|
description: jQuery Monthpicker's JavaScript files packaged for the Rails 3.1+ asset
|
@@ -51,6 +46,7 @@ executables: []
|
|
51
46
|
extensions: []
|
52
47
|
extra_rdoc_files: []
|
53
48
|
files:
|
49
|
+
- .gitignore
|
54
50
|
- README.md
|
55
51
|
- jquery-monthpicker-rails.gemspec
|
56
52
|
- lib/jquery-monthpicker-rails.rb
|
@@ -58,29 +54,29 @@ files:
|
|
58
54
|
- lib/jquery/monthpicker/rails/engine.rb
|
59
55
|
- lib/jquery/monthpicker/rails/version.rb
|
60
56
|
- vendor/assets/javascripts/jquery.ui.monthpicker.js
|
61
|
-
homepage: https://github.com/
|
57
|
+
homepage: https://github.com/zorab47/jquery-monthpicker-rails
|
62
58
|
licenses:
|
63
59
|
- MIT
|
60
|
+
metadata: {}
|
64
61
|
post_install_message:
|
65
62
|
rdoc_options: []
|
66
63
|
require_paths:
|
67
64
|
- lib
|
68
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
66
|
requirements:
|
71
|
-
- -
|
67
|
+
- - '>='
|
72
68
|
- !ruby/object:Gem::Version
|
73
69
|
version: '0'
|
74
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
71
|
requirements:
|
77
|
-
- -
|
72
|
+
- - '>='
|
78
73
|
- !ruby/object:Gem::Version
|
79
74
|
version: 1.3.6
|
80
75
|
requirements: []
|
81
76
|
rubyforge_project:
|
82
|
-
rubygems_version:
|
77
|
+
rubygems_version: 2.0.3
|
83
78
|
signing_key:
|
84
|
-
specification_version:
|
79
|
+
specification_version: 4
|
85
80
|
summary: jQuery Monthpicker packaged for the Rails asset pipeline
|
86
81
|
test_files: []
|
82
|
+
has_rdoc:
|