event_cal 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/event_cal/version.rb +1 -1
- data/vendor/assets/javascripts/event_cal_no_libs.js +39 -14
- metadata +3 -3
data/lib/event_cal/version.rb
CHANGED
@@ -22,6 +22,10 @@
|
|
22
22
|
});
|
23
23
|
};
|
24
24
|
|
25
|
+
CalendarDate.prototype.toPath = function() {
|
26
|
+
return moment(this.date).format('YYYY/MM/DD');
|
27
|
+
};
|
28
|
+
|
25
29
|
return CalendarDate;
|
26
30
|
|
27
31
|
})(Spine.Model);
|
@@ -163,23 +167,44 @@
|
|
163
167
|
'ul.event_details': CalendarEventsController
|
164
168
|
};
|
165
169
|
|
166
|
-
CalendarApplication.initialize = function() {
|
167
|
-
var controller, el, element,
|
168
|
-
|
170
|
+
CalendarApplication.initialize = function(options) {
|
171
|
+
var controller, el, element, _i, _len, _ref;
|
172
|
+
if (options == null) {
|
173
|
+
options = {};
|
174
|
+
}
|
169
175
|
for (element in calendarElements) {
|
170
176
|
controller = calendarElements[element];
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
el = _ref[_i];
|
177
|
-
_results1.push(new controller($(el)));
|
178
|
-
}
|
179
|
-
return _results1;
|
180
|
-
})());
|
177
|
+
_ref = $(element);
|
178
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
179
|
+
el = _ref[_i];
|
180
|
+
new controller($(el));
|
181
|
+
}
|
181
182
|
}
|
182
|
-
|
183
|
+
if (options.history) {
|
184
|
+
return this.initializeHistory(options.basePath);
|
185
|
+
}
|
186
|
+
};
|
187
|
+
|
188
|
+
CalendarApplication.initializeHistory = function(basePath) {
|
189
|
+
CalendarDate.all().map(function(date) {
|
190
|
+
return date.element.bind('click', function(event) {
|
191
|
+
var _ref;
|
192
|
+
return typeof window !== "undefined" && window !== null ? (_ref = window.history) != null ? _ref.pushState({
|
193
|
+
dateObjectId: date.id
|
194
|
+
}, null, "" + basePath + "/" + (date.toPath())) : void 0 : void 0;
|
195
|
+
});
|
196
|
+
});
|
197
|
+
return typeof window !== "undefined" && window !== null ? window.onpopstate = function(event) {
|
198
|
+
var date, _ref;
|
199
|
+
if (((_ref = event.state) != null ? _ref.dateObjectId : void 0) != null) {
|
200
|
+
date = CalendarDate.find(event.state.dateObjectId);
|
201
|
+
date.trigger('activate');
|
202
|
+
CalendarDate.deactivateAllDates();
|
203
|
+
return date.updateAttributes({
|
204
|
+
active: true
|
205
|
+
});
|
206
|
+
}
|
207
|
+
} : void 0;
|
183
208
|
};
|
184
209
|
|
185
210
|
return CalendarApplication;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_cal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -256,7 +256,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
256
256
|
version: '0'
|
257
257
|
segments:
|
258
258
|
- 0
|
259
|
-
hash:
|
259
|
+
hash: 519849361277941248
|
260
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
261
|
none: false
|
262
262
|
requirements:
|
@@ -265,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
265
|
version: '0'
|
266
266
|
segments:
|
267
267
|
- 0
|
268
|
-
hash:
|
268
|
+
hash: 519849361277941248
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
271
|
rubygems_version: 1.8.24
|