rails-scheduler 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +1,6 @@
1
1
  //= require jquery
2
+ //
3
+ //= require_self
4
+ //= require_tree ./scheduler
2
5
 
3
6
  var Scheduler = Scheduler || {};
4
-
5
- Scheduler.form = {};
6
-
7
- Scheduler.form.init = function(form, startDate) {
8
- Scheduler.form.current = form;
9
-
10
- Scheduler.form.showFrequency(form.find("select.scheduler-frequency").val());
11
-
12
- form.on("change", "select.scheduler-frequency", function(){
13
- Scheduler.form.showFrequency($(this).val());
14
- });
15
-
16
- if (startDate) {
17
- var weekDay = (startDate.getDay() + 6) % 7; // monday is 0 in Rails
18
- var weekDayOrder = Math.floor((startDate.getDate() - startDate.getDay() + 6) / 7);
19
- if (weekDayOrder > 3) {
20
- weekDayOrder = -1;
21
- }
22
-
23
- // check day of week
24
- form.find('#event_week_days_' + weekDay).attr('checked','checked');
25
-
26
- // init day of month
27
- form.find('#event_week_day_order').val(weekDayOrder);
28
- form.find('#event_week_day').val(weekDay);
29
- }
30
- }
31
-
32
- Scheduler.form.showFrequency = function(value) {
33
- form = Scheduler.form.current;
34
-
35
- form.find("#scheduler-options").children("div").hide();
36
- form.find("#scheduler-options").find("select,input").attr('disabled', 'disabled');
37
-
38
- form.find("#scheduler-frequency-" + value ).show();
39
- form.find("#scheduler-frequency-" + value ).find("select,input").removeAttr('disabled');
40
- }
@@ -0,0 +1,47 @@
1
+ Scheduler.form = (function($, undefined) {
2
+ var current;
3
+
4
+ var init = function(form, startDate) {
5
+ current = form;
6
+
7
+ showFrequency(form.find("select.scheduler-frequency").val());
8
+
9
+ form.on("change", "select.scheduler-frequency", function(){
10
+ showFrequency($(this).val());
11
+ });
12
+
13
+ if (startDate) {
14
+ var weekDay = (startDate.getDay() + 6) % 7; // monday is 0 in Rails
15
+ var weekDayOrder = Math.floor((startDate.getDate() - startDate.getDay() + 6) / 7);
16
+ if (weekDayOrder > 3) {
17
+ weekDayOrder = -1;
18
+ }
19
+
20
+ // check day of week
21
+ form.find('#event_week_days_' + weekDay).attr('checked','checked');
22
+
23
+ // init day of month
24
+ form.find('#event_week_day_order').val(weekDayOrder);
25
+ form.find('#event_week_day').val(weekDay);
26
+ }
27
+ };
28
+
29
+ var showFrequency = function(value) {
30
+ current.find("#scheduler-options").children("div").hide();
31
+ current.find("#scheduler-options").find("select,input").attr('disabled', 'disabled');
32
+
33
+ current.find("#scheduler-frequency-" + value ).show();
34
+ current.find("#scheduler-frequency-" + value ).find("select,input").removeAttr('disabled');
35
+ };
36
+
37
+ var reset = function(form) {
38
+ var select = form.find('select.scheduler-frequency');
39
+ select.find('option[value="0"]').prop('selected', true);
40
+ select.change();
41
+ };
42
+
43
+ return {
44
+ init: init,
45
+ reset: reset
46
+ };
47
+ })(jQuery);
@@ -1,3 +1,3 @@
1
1
  module Scheduler
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-15 00:00:00.000000000Z
12
+ date: 2012-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &77878590 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *77878590
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: recurrence
27
- requirement: &77877930 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 1.2.0
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *77877930
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.2.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: mysql2
38
- requirement: &77877590 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *77877590
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: factory_girl
49
- requirement: &77877230 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,7 +69,12 @@ dependencies:
54
69
  version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *77877230
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  description: ! 'Scheduler support: daily, weekly and montly repetitions'
59
79
  email:
60
80
  - atapiador@dit.upm.es
@@ -69,6 +89,7 @@ files:
69
89
  - README.rdoc
70
90
  - Rakefile
71
91
  - app/assets/javascripts/scheduler.js
92
+ - app/assets/javascripts/scheduler/form.js
72
93
  - app/helpers/scheduler_helper.rb
73
94
  - app/views/scheduler/_form.html.erb
74
95
  - config/locales/en.yml
@@ -135,7 +156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
156
  version: '0'
136
157
  segments:
137
158
  - 0
138
- hash: -788628867
159
+ hash: -160142861
139
160
  required_rubygems_version: !ruby/object:Gem::Requirement
140
161
  none: false
141
162
  requirements:
@@ -144,10 +165,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
165
  version: '0'
145
166
  segments:
146
167
  - 0
147
- hash: -788628867
168
+ hash: -160142861
148
169
  requirements: []
149
170
  rubyforge_project:
150
- rubygems_version: 1.8.10
171
+ rubygems_version: 1.8.24
151
172
  signing_key:
152
173
  specification_version: 3
153
174
  summary: Provide a Rails application with support for scheduled events