mix-rails-core 0.23.1 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/images/blank.gif +0 -0
  3. data/app/assets/images/jqzoom/advertise.jpg +0 -0
  4. data/app/assets/images/jqzoom/zoomloader.gif +0 -0
  5. data/app/assets/images/loadinfo.net.gif +0 -0
  6. data/app/assets/javascripts/angular-google-maps.js +531 -0
  7. data/app/assets/javascripts/angular-ui.min.js +7 -0
  8. data/app/assets/javascripts/angular.min.js +161 -0
  9. data/app/assets/javascripts/gmaps.js +1909 -0
  10. data/app/assets/javascripts/jquery-gmaps-latlon-picker.js +231 -0
  11. data/app/assets/javascripts/jquery.jqzoom.js +1 -0
  12. data/app/assets/javascripts/jquery.krioImageLoader.js +47 -0
  13. data/app/assets/javascripts/jquery.lazyload.js +227 -0
  14. data/app/assets/javascripts/jquery.maskedinput.js +290 -0
  15. data/app/assets/javascripts/jquery.meio.mask.min.js +1 -0
  16. data/app/assets/javascripts/jquery.ui.addresspicker.js +194 -0
  17. data/app/assets/javascripts/jquery/jquery.jqzoom-core.js +733 -0
  18. data/app/assets/javascripts/multizoom.js +388 -0
  19. data/app/assets/stylesheets/angular-ui.min.css +1 -0
  20. data/app/assets/stylesheets/jquery-gmaps-latlon-picker.css +2 -0
  21. data/app/assets/stylesheets/jquery.jqzoom.css +3 -0
  22. data/app/assets/stylesheets/jquery/jquery.jqzoom.css.erb +120 -0
  23. data/app/assets/stylesheets/multizoom.css +48 -0
  24. data/app/helpers/core_helper.rb +4 -0
  25. data/app/inputs/cell_input.rb +5 -0
  26. data/app/inputs/cep_input.rb +5 -0
  27. data/app/inputs/phone_input.rb +5 -0
  28. data/app/inputs/state_input.rb +5 -0
  29. data/app/models/attachment.rb +4 -1
  30. data/app/models/category.rb +4 -1
  31. data/app/models/ckeditor/asset.rb +7 -0
  32. data/app/models/ckeditor/attachment_file.rb +7 -0
  33. data/app/models/ckeditor/picture.rb +7 -0
  34. data/app/uploaders/ckeditor_attachment_file_uploader.rb +36 -0
  35. data/app/uploaders/ckeditor_picture_uploader.rb +47 -0
  36. data/app/views/admix/categories/_form_config.haml +3 -0
  37. data/config/initializers/ckeditor.rb +21 -0
  38. data/config/initializers/defaults_rails.rb +10 -1
  39. data/config/locales/core.pt-BR.yml +25 -2
  40. data/config/routes.rb +2 -0
  41. data/db/migrate/20130226152256_create_ckeditor_assets.rb +26 -0
  42. data/lib/mix-rails-core.rb +3 -0
  43. data/lib/mix-rails-core/version.rb +2 -2
  44. metadata +73 -120
  45. data/app/assets/javascripts/jquery/jquery.maskedinput-1.3.min.js +0 -7
  46. data/app/models/admix/categories_datagrid.rb +0 -14
  47. data/app/views/admix/categories/_form_fields.haml +0 -1
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e5b8495aaf8b708c40ffa20c59ca3860f6fb541e
4
+ data.tar.gz: e3acbe184a0425e2a3b6a69e0584a4aaebcb16d9
5
+ SHA512:
6
+ metadata.gz: 4aa878ed13dcfd3cd17e08338b2faa60ac6a7996f4140ccfb2a01bfd63b5bd863f17c19d7414e400507af2fbe511d1d96942f4b925b478532ebaacca2c0fc872
7
+ data.tar.gz: 46667ef0c19f3f5614578a57cb175e25ba1217e2b135fe5ce02cde9f9b7bcd7a78cae18138bd011e5af18ff5bb47eb1453444088511a29d85c9f5a9fc59279d6
Binary file
Binary file
@@ -0,0 +1,531 @@
1
+ /**!
2
+ * The MIT License
3
+ *
4
+ * Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * angular-google-maps
25
+ * https://github.com/nlaplante/angular-google-maps
26
+ *
27
+ * @author Nicolas Laplante https://plus.google.com/108189012221374960701
28
+ */
29
+
30
+ (function () {
31
+
32
+ "use strict";
33
+
34
+ /*
35
+ * Utility functions
36
+ */
37
+
38
+ /**
39
+ * Check if 2 floating point numbers are equal
40
+ *
41
+ * @see http://stackoverflow.com/a/588014
42
+ */
43
+ function floatEqual (f1, f2) {
44
+ return (Math.abs(f1 - f2) < 0.000001);
45
+ }
46
+
47
+ /*
48
+ * Create the model in a self-contained class where map-specific logic is
49
+ * done. This model will be used in the directive.
50
+ */
51
+
52
+ var MapModel = (function () {
53
+
54
+ var _defaults = {
55
+ zoom: 8,
56
+ draggable: false,
57
+ container: null
58
+ };
59
+
60
+ /**
61
+ *
62
+ */
63
+ function PrivateMapModel(opts) {
64
+
65
+ var _instance = null,
66
+ _markers = [], // caches the instances of google.maps.Marker
67
+ _handlers = [], // event handlers
68
+ _windows = [], // InfoWindow objects
69
+ o = angular.extend({}, _defaults, opts),
70
+ that = this,
71
+ currentInfoWindow = null;
72
+
73
+ this.center = opts.center;
74
+ this.zoom = o.zoom;
75
+ this.draggable = o.draggable;
76
+ this.dragging = false;
77
+ this.selector = o.container;
78
+ this.markers = [];
79
+
80
+ this.draw = function () {
81
+
82
+ if (that.center == null) {
83
+ // TODO log error
84
+ return;
85
+ }
86
+
87
+ if (_instance == null) {
88
+
89
+ // Create a new map instance
90
+
91
+ _instance = new google.maps.Map(that.selector, {
92
+ center: that.center,
93
+ zoom: that.zoom,
94
+ draggable: that.draggable,
95
+ mapTypeId : google.maps.MapTypeId.ROADMAP
96
+ });
97
+
98
+ google.maps.event.addListener(_instance, "dragstart",
99
+
100
+ function () {
101
+ that.dragging = true;
102
+ }
103
+ );
104
+
105
+ google.maps.event.addListener(_instance, "idle",
106
+
107
+ function () {
108
+ that.dragging = false;
109
+ }
110
+ );
111
+
112
+ google.maps.event.addListener(_instance, "drag",
113
+
114
+ function () {
115
+ that.dragging = true;
116
+ }
117
+ );
118
+
119
+ google.maps.event.addListener(_instance, "zoom_changed",
120
+
121
+ function () {
122
+ that.zoom = _instance.getZoom();
123
+ that.center = _instance.getCenter();
124
+ }
125
+ );
126
+
127
+ google.maps.event.addListener(_instance, "center_changed",
128
+
129
+ function () {
130
+ that.center = _instance.getCenter();
131
+ }
132
+ );
133
+
134
+ // Attach additional event listeners if needed
135
+ if (_handlers.length) {
136
+
137
+ angular.forEach(_handlers, function (h, i) {
138
+
139
+ google.maps.event.addListener(_instance,
140
+ h.on, h.handler);
141
+ });
142
+ }
143
+ }
144
+ else {
145
+
146
+ // Refresh the existing instance
147
+ google.maps.event.trigger(_instance, "resize");
148
+
149
+ var instanceCenter = _instance.getCenter();
150
+
151
+ if (!floatEqual(instanceCenter.lat(), that.center.lat())
152
+ || !floatEqual(instanceCenter.lng(), that.center.lng())) {
153
+ _instance.setCenter(that.center);
154
+ }
155
+
156
+ if (_instance.getZoom() != that.zoom) {
157
+ _instance.setZoom(that.zoom);
158
+ }
159
+ }
160
+ };
161
+
162
+ this.fit = function () {
163
+ if (_instance && _markers.length) {
164
+
165
+ var bounds = new google.maps.LatLngBounds();
166
+
167
+ angular.forEach(_markers, function (m, i) {
168
+ bounds.extend(m.getPosition());
169
+ });
170
+
171
+ _instance.fitBounds(bounds);
172
+ }
173
+ };
174
+
175
+ this.on = function(event, handler) {
176
+ _handlers.push({
177
+ "on": event,
178
+ "handler": handler
179
+ });
180
+ };
181
+
182
+ this.addMarker = function (lat, lng, icon, infoWindowContent, label, url,
183
+ thumbnail) {
184
+
185
+ if (that.findMarker(lat, lng) != null) {
186
+ return;
187
+ }
188
+
189
+ var marker = new google.maps.Marker({
190
+ position: new google.maps.LatLng(lat, lng),
191
+ map: _instance,
192
+ icon: icon
193
+ });
194
+
195
+ if (label) {
196
+
197
+ }
198
+
199
+ if (url) {
200
+
201
+ }
202
+
203
+ if (infoWindowContent != null) {
204
+ var infoWindow = new google.maps.InfoWindow({
205
+ content: infoWindowContent
206
+ });
207
+
208
+ google.maps.event.addListener(marker, 'click', function() {
209
+ if (currentInfoWindow != null) {
210
+ currentInfoWindow.close();
211
+ }
212
+ infoWindow.open(_instance, marker);
213
+ currentInfoWindow = infoWindow;
214
+ });
215
+ }
216
+
217
+ // Cache marker
218
+ _markers.unshift(marker);
219
+
220
+ // Cache instance of our marker for scope purposes
221
+ that.markers.unshift({
222
+ "lat": lat,
223
+ "lng": lng,
224
+ "draggable": false,
225
+ "icon": icon,
226
+ "infoWindowContent": infoWindowContent,
227
+ "label": label,
228
+ "url": url,
229
+ "thumbnail": thumbnail
230
+ });
231
+
232
+ // Return marker instance
233
+ return marker;
234
+ };
235
+
236
+ this.findMarker = function (lat, lng) {
237
+ for (var i = 0; i < _markers.length; i++) {
238
+ var pos = _markers[i].getPosition();
239
+
240
+ if (floatEqual(pos.lat(), lat) && floatEqual(pos.lng(), lng)) {
241
+ return _markers[i];
242
+ }
243
+ }
244
+
245
+ return null;
246
+ };
247
+
248
+ this.findMarkerIndex = function (lat, lng) {
249
+ for (var i = 0; i < _markers.length; i++) {
250
+ var pos = _markers[i].getPosition();
251
+
252
+ if (floatEqual(pos.lat(), lat) && floatEqual(pos.lng(), lng)) {
253
+ return i;
254
+ }
255
+ }
256
+
257
+ return -1;
258
+ };
259
+
260
+ this.addInfoWindow = function (lat, lng, html) {
261
+ var win = new google.maps.InfoWindow({
262
+ content: html,
263
+ position: new google.maps.LatLng(lat, lng)
264
+ });
265
+
266
+ _windows.push(win);
267
+
268
+ return win;
269
+ };
270
+
271
+ this.hasMarker = function (lat, lng) {
272
+ return that.findMarker(lat, lng) !== null;
273
+ };
274
+
275
+ this.getMarkerInstances = function () {
276
+ return _markers;
277
+ };
278
+
279
+ this.removeMarkers = function (markerInstances) {
280
+
281
+ var s = this;
282
+
283
+ angular.forEach(markerInstances, function (v, i) {
284
+ var pos = v.getPosition(),
285
+ lat = pos.lat(),
286
+ lng = pos.lng(),
287
+ index = s.findMarkerIndex(lat, lng);
288
+
289
+ // Remove from local arrays
290
+ _markers.splice(index, 1);
291
+ s.markers.splice(index, 1);
292
+
293
+ // Remove from map
294
+ v.setMap(null);
295
+ });
296
+ };
297
+ }
298
+
299
+ // Done
300
+ return PrivateMapModel;
301
+ }());
302
+
303
+ // End model
304
+
305
+ // Start Angular directive
306
+
307
+ var googleMapsModule = angular.module("google-maps", []);
308
+
309
+ /**
310
+ * Map directive
311
+ */
312
+ googleMapsModule.directive("googleMap", ["$log", "$timeout", "$filter", function ($log, $timeout,
313
+ $filter) {
314
+
315
+ var controller = function ($scope, $element) {
316
+
317
+ var _m = $scope.map;
318
+
319
+ self.addInfoWindow = function (lat, lng, content) {
320
+ _m.addInfoWindow(lat, lng, content);
321
+ };
322
+ };
323
+
324
+ controller.$inject = ['$scope', '$element'];
325
+
326
+ return {
327
+ restrict: "EC",
328
+ priority: 100,
329
+ transclude: true,
330
+ template: "<div class='angular-google-map' ng-transclude></div>",
331
+ replace: false,
332
+ scope: {
333
+ center: "=center", // required
334
+ markers: "=markers", // optional
335
+ latitude: "=latitude", // required
336
+ longitude: "=longitude", // required
337
+ zoom: "=zoom", // required
338
+ refresh: "&refresh", // optional
339
+ windows: "=windows" // optional"
340
+ },
341
+ controller: controller,
342
+ link: function (scope, element, attrs, ctrl) {
343
+
344
+ // Center property must be specified and provide lat &
345
+ // lng properties
346
+ if (!angular.isDefined(scope.center) ||
347
+ (!angular.isDefined(scope.center.lat) ||
348
+ !angular.isDefined(scope.center.lng))) {
349
+
350
+ $log.error("angular-google-maps: ould not find a valid center property");
351
+ return;
352
+ }
353
+
354
+ if (!angular.isDefined(scope.zoom)) {
355
+ $log.error("angular-google-maps: map zoom property not set");
356
+ return;
357
+ }
358
+
359
+ angular.element(element).addClass("angular-google-map");
360
+
361
+ // Create our model
362
+ var _m = new MapModel({
363
+ container: element[0],
364
+ center: new google.maps.LatLng(scope.center.lat, scope.center.lng),
365
+ draggable: attrs.draggable == "true",
366
+ zoom: scope.zoom
367
+ });
368
+
369
+ _m.on("drag", function () {
370
+
371
+ var c = _m.center;
372
+
373
+ $timeout(function () {
374
+
375
+ scope.$apply(function (s) {
376
+ scope.center.lat = c.lat();
377
+ scope.center.lng = c.lng();
378
+ });
379
+ });
380
+ });
381
+
382
+ _m.on("zoom_changed", function () {
383
+
384
+ if (scope.zoom != _m.zoom) {
385
+
386
+ $timeout(function () {
387
+
388
+ scope.$apply(function (s) {
389
+ scope.zoom = _m.zoom;
390
+ });
391
+ });
392
+ }
393
+ });
394
+
395
+ _m.on("center_changed", function () {
396
+ var c = _m.center;
397
+
398
+ $timeout(function () {
399
+
400
+ scope.$apply(function (s) {
401
+
402
+ if (!_m.dragging) {
403
+ scope.center.lat = c.lat();
404
+ scope.center.lng = c.lng();
405
+ }
406
+ });
407
+ });
408
+ });
409
+
410
+ if (attrs.markClick == "true") {
411
+ (function () {
412
+ var cm = null;
413
+
414
+ _m.on("click", function (e) {
415
+ if (cm == null) {
416
+
417
+ cm = {
418
+ latitude: e.latLng.lat(),
419
+ longitude: e.latLng.lng()
420
+ };
421
+
422
+ scope.markers.push(cm);
423
+ }
424
+ else {
425
+ cm.latitude = e.latLng.lat();
426
+ cm.longitude = e.latLng.lng();
427
+ }
428
+
429
+
430
+ $timeout(function () {
431
+ scope.latitude = cm.latitude;
432
+ scope.longitude = cm.longitude;
433
+ scope.$apply();
434
+ });
435
+ });
436
+ }());
437
+ }
438
+
439
+ // Put the map into the scope
440
+ scope.map = _m;
441
+
442
+ // Check if we need to refresh the map
443
+ if (angular.isUndefined(scope.refresh())) {
444
+ // No refresh property given; draw the map immediately
445
+ _m.draw();
446
+ }
447
+ else {
448
+ scope.$watch("refresh()", function (newValue, oldValue) {
449
+ if (newValue && !oldValue) {
450
+ _m.draw();
451
+ }
452
+ });
453
+ }
454
+
455
+ // Markers
456
+ scope.$watch("markers", function (newValue, oldValue) {
457
+
458
+ $timeout(function () {
459
+
460
+ angular.forEach(newValue, function (v, i) {
461
+ if (!_m.hasMarker(v.latitude, v.longitude)) {
462
+ _m.addMarker(v.latitude, v.longitude, v.icon, v.infoWindow);
463
+ }
464
+ });
465
+
466
+ // Clear orphaned markers
467
+ var orphaned = [];
468
+
469
+ angular.forEach(_m.getMarkerInstances(), function (v, i) {
470
+ // Check our scope if a marker with equal latitude and longitude.
471
+ // If not found, then that marker has been removed form the scope.
472
+
473
+ var pos = v.getPosition(),
474
+ lat = pos.lat(),
475
+ lng = pos.lng(),
476
+ found = false;
477
+
478
+ // Test against each marker in the scope
479
+ for (var si = 0; si < scope.markers.length; si++) {
480
+
481
+ var sm = scope.markers[si];
482
+
483
+ if (floatEqual(sm.latitude, lat) && floatEqual(sm.longitude, lng)) {
484
+ // Map marker is present in scope too, don't remove
485
+ found = true;
486
+ }
487
+ }
488
+
489
+ // Marker in map has not been found in scope. Remove.
490
+ if (!found) {
491
+ orphaned.push(v);
492
+ }
493
+ });
494
+
495
+ orphaned.length && _m.removeMarkers(orphaned);
496
+
497
+ // Fit map when there are more than one marker.
498
+ // This will change the map center coordinates
499
+ if (attrs.fit == "true" && newValue.length > 1) {
500
+ _m.fit();
501
+ }
502
+ });
503
+
504
+ }, true);
505
+
506
+
507
+ // Update map when center coordinates change
508
+ scope.$watch("center", function (newValue, oldValue) {
509
+ if (newValue === oldValue) {
510
+ return;
511
+ }
512
+
513
+ if (!_m.dragging) {
514
+ _m.center = new google.maps.LatLng(newValue.lat,
515
+ newValue.lng);
516
+ _m.draw();
517
+ }
518
+ }, true);
519
+
520
+ scope.$watch("zoom", function (newValue, oldValue) {
521
+ if (newValue === oldValue) {
522
+ return;
523
+ }
524
+
525
+ _m.zoom = newValue;
526
+ _m.draw();
527
+ });
528
+ }
529
+ };
530
+ }]);
531
+ }());