homesteading_assets 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 980d0a212e473e37ab5bbf17d5be6e899e8d126f
4
- data.tar.gz: 2bef05b711f90ce72e0f656a59a94142dd4c10a8
3
+ metadata.gz: eda1e122128b4604b0c25ecfb7d85e82276ce1d1
4
+ data.tar.gz: 88a01d6739c5ce6b4d3492c914d3cabd0afe1df3
5
5
  SHA512:
6
- metadata.gz: 929a3a1307f12be78baa146c1345640b9d79d5d3386417f2dd4faacc3a968e28c57e5429f5bf7a3de803072cdbb80854d30ebcc14bb7494c070b7d75acf4d9dd
7
- data.tar.gz: 0fd59f4b04971af31047ff9cec670f219406220d69a99c37548affe4caec62f282a5c0bf60794d6fd5d4469decca9f2f96896acfe27addc7a89a8fa743bbe5a3
6
+ metadata.gz: 8c03a3563238e096562743884d44d24d1dfd7595b9b77541039840b3c59f28a8d85419e3f814dcb8fd5a3391e7c3b63800adc48f413526c927fb469d5fb4a122
7
+ data.tar.gz: e4ad45e1f80043352079f567fd04544b940523ad310284f72de5a0c85ecd5259481b0218cf6ec51c3e2d3da3fe7e472ff07db31091c0fcac28e9f09f52ffe27b
@@ -1,2 +1,5 @@
1
- //= require jquery
1
+ //= require homesteading_assets/vendor/modernizr
2
+ //= require homesteading_assets/vendor/jquery
2
3
  //= require jquery_ujs
4
+
5
+ //= require read-post
@@ -2,46 +2,54 @@
2
2
  //= require homesteading_assets/vendor/jquery
3
3
  //= require jquery_ujs
4
4
  //= require homesteading_assets/vendor/jquery.simplyCountable
5
+ //= require write-post
5
6
 
6
7
  // for p-location geo fields
7
8
  // TODO: extract into plugin and out of global namespace
8
- function getLocation() {
9
- if (Modernizr.geolocation) {
10
- navigator.geolocation.getCurrentPosition(populateGeoFields);
9
+ (function($) {
10
+ function withLocation(callback) {
11
+ if (Modernizr.geolocation) {
12
+ navigator.geolocation.getCurrentPosition(callback);
13
+ }
11
14
  }
12
- }
13
15
 
14
- // TODO: extract into plugin and out of global namespace
15
- function populateGeoFields(position) {
16
- var latitude = position.coords.latitude;
17
- var longitude = position.coords.longitude;
18
- var altitude = position.coords.altitude;
16
+ // TODO: extract into plugin and out of global namespace
17
+ function populateGeoFields(position) {
18
+ var latitude, longitude, altitude, $pLocation;
19
19
 
20
- $(".new .p-location .p-latitude" ).val(latitude);
21
- $(".new .p-location .p-longitude").val(longitude);
22
- $(".new .p-location .p-altitude" ).val(altitude);
23
- }
20
+ latitude = position.coords.latitude;
21
+ longitude = position.coords.longitude;
22
+ altitude = position.coords.altitude;
24
23
 
24
+ $pLocation = $(".new .p-location");
25
25
 
26
- // for dt-published datetime field
27
- // TODO: extract into plugin and out of global namespace
28
- function ISODateString(d){
29
- function pad(n) { return n < 10 ? "0" + n : n }
30
- return d.getUTCFullYear()+"-"
31
- + pad(d.getUTCMonth()+1)+"-"
32
- + pad(d.getUTCDate())+"T"
33
- + pad(d.getUTCHours())+":"
34
- + pad(d.getUTCMinutes())+":"
35
- + pad(d.getUTCSeconds())+"-07:00"
36
- }
37
-
38
-
39
- $(function() {
40
- // prints something like 2009-09-28T19:03:12Z
41
- $(".new .dt-published").val(ISODateString(new Date()))
42
-
43
- // ask user to access their location
44
- // populate lat/lon/alt fields
26
+ $pLocation.find(".p-latitude" ).val(latitude);
27
+ $pLocation.find(".p-longitude").val(longitude);
28
+ $pLocation.find(".p-altitude" ).val(altitude);
29
+ }
30
+
31
+ function pad(n) {
32
+ return n < 10 ? "0" + n : n;
33
+ };
34
+
35
+ // for dt-published datetime field
45
36
  // TODO: extract into plugin and out of global namespace
46
- getLocation();
47
- });
37
+ function ISODateString(d){
38
+ return d.getUTCFullYear()+"-"
39
+ + pad(d.getUTCMonth()+1)+"-"
40
+ + pad(d.getUTCDate())+"T"
41
+ + pad(d.getUTCHours())+":"
42
+ + pad(d.getUTCMinutes())+":"
43
+ + pad(d.getUTCSeconds())+"-07:00";
44
+ }
45
+
46
+ $(function() {
47
+ // prints something like 2009-09-28T19:03:12Z
48
+ $(".new .dt-published").val(ISODateString(new Date()));
49
+
50
+ // ask user to access their location
51
+ // populate lat/lon/alt fields
52
+ // TODO: extract into plugin and out of global namespace
53
+ withLocation(populateGeoFields);
54
+ });
55
+ })(window.jQuery);
@@ -1,3 +1,3 @@
1
1
  module HomesteadingAssets
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: homesteading_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Becker
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-03 00:00:00.000000000 Z
12
+ date: 2014-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails