diff --git a/.idea/dataSources.ids b/.idea/dataSources.ids index 3534ce0..8339125 100644 --- a/.idea/dataSources.ids +++ b/.idea/dataSources.ids @@ -1569,10 +1569,118 @@ + + + + + +
+ + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + +
+ + + + + + + +
+ + + +
@@ -1603,6 +1711,11 @@
+ + + + +
@@ -19143,6 +19256,7802 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index afe60e0..1b139fb 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -1,6 +1,6 @@ - + postgresql true diff --git a/.idea/huggles.iml b/.idea/huggles.iml index 306a0b9..45870f4 100644 --- a/.idea/huggles.iml +++ b/.idea/huggles.iml @@ -112,6 +112,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -129,6 +150,7 @@ + @@ -170,6 +192,8 @@ + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 855b115..dacecd5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -17,7 +17,8 @@ - + + @@ -40,21 +83,11 @@ - - - - - - - - - - - - + + - + @@ -64,47 +97,52 @@ - + - - + + - + - - + + - + - + - - + + - - - + + + + + + + + - + @@ -114,7 +152,7 @@ - + @@ -122,21 +160,31 @@ - - + + + + + + + + + + + + - - + + - - + + - + @@ -147,23 +195,36 @@ @@ -182,8 +243,8 @@ - @@ -210,6 +271,7 @@ + @@ -228,6 +290,38 @@ + + + + + + + + + + + + + + + + + + - @@ -282,7 +376,7 @@ - - + @@ -462,7 +573,28 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -498,6 +630,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -640,12 +793,18 @@ - + + + + + + + @@ -661,47 +820,47 @@ - + - + - + + - - + + + + - - - - + - + - + - - + + - + - + - + @@ -720,38 +879,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -768,7 +895,7 @@ - + @@ -802,7 +929,7 @@ - + @@ -842,7 +969,7 @@ - + @@ -888,6 +1015,7 @@ + @@ -911,96 +1039,206 @@ + - + - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + @@ -1008,41 +1246,46 @@ - + - + - + - + - + - - + + + + + + + - + - + - - + + diff --git a/Gemfile b/Gemfile index b558ae6..c087428 100644 --- a/Gemfile +++ b/Gemfile @@ -34,6 +34,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc gem 'devise', '~> 3.5.1' gem 'bootstrap-sass', '~> 3.3.5.1' +gem 'activerecord-postgis-adapter', '~> 3.0.0' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console diff --git a/Gemfile.lock b/Gemfile.lock index adfe02c..dd6a8c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,6 +30,9 @@ GEM activemodel (= 4.2.1) activesupport (= 4.2.1) arel (~> 6.0) + activerecord-postgis-adapter (3.0.0) + activerecord (~> 4.2) + rgeo-activerecord (~> 4.0) activesupport (4.2.1) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) @@ -121,6 +124,10 @@ GEM rdoc (4.2.0) responders (2.1.0) railties (>= 4.2.0, < 5) + rgeo (0.3.20) + rgeo-activerecord (4.0.0) + activerecord (~> 4.2) + rgeo (~> 0.3) sass (3.4.16) sass-rails (5.0.3) railties (>= 4.0.0, < 5.0) @@ -160,6 +167,7 @@ PLATFORMS ruby DEPENDENCIES + activerecord-postgis-adapter (~> 3.0.0) bootstrap-sass (~> 3.3.5.1) byebug coffee-rails (~> 4.1.0) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 38c38e5..d828dda 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -14,4 +14,4 @@ //= require bootstrap-sprockets //= require jquery_ujs //= require turbolinks -//= require_tree . \ No newline at end of file +//= require_tree \ No newline at end of file diff --git a/app/assets/javascripts/map/geocode.js b/app/assets/javascripts/map/geocode.js index 2889dd4..54d69a9 100644 --- a/app/assets/javascripts/map/geocode.js +++ b/app/assets/javascripts/map/geocode.js @@ -2,7 +2,35 @@ var map; var huggles = huggles || {} huggles.after_google = huggles.after_google || [] +function showPins(coords) { + $(coords).each(function(i, coord) { + var pos = new google.maps.LatLng(coord[1], + coord[0]); + + var marker = new google.maps.Marker({ + map: map, + position: pos + }); + + marker.setMap(map); + + //map.setCenter(pos) + }) +} + function initialize() { + function showOtherPins(lat, lon) { + $.ajax('/sync', { + datatype: 'script', + method: 'POST', + data: { + sync: { + lat: lat, + lon: lon} + } + }) + } + var mapOptions = { zoom: 17 }; @@ -12,25 +40,30 @@ function initialize() { // Try HTML5 geolocation if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { - var pos = new google.maps.LatLng(position.coords.latitude, - position.coords.longitude); + var lat = position.coords.latitude; + var lon = position.coords.longitude; + + var pos = new google.maps.LatLng(lat, + lon); var marker = new google.maps.Marker({ map: map, - position: pos, + position: pos }); map.setCenter(pos); - google.maps.event.addListener(marker, 'click', function(event) { + marker.setMap(map); - var lat = marker.getPosition().lat(); - var lng = marker.getPosition().lng(); + google.maps.event.addListener(marker, "click", function(event){ + var lat = event.latLng.lat(); + var lng = event.latLng.lng(); + // populate yor box/field with lat, lng + alert("Lat=" + lat + "; Lng=" + lng); - $('#lat').val(lat); - $('#lng').val(lng); }); + showOtherPins(lat, lon) }, function() { handleNoGeolocation(true); @@ -56,12 +89,4 @@ function handleNoGeolocation(errorFlag) { var infowindow = new google.maps.InfoWindow(options); map.setCenter(options.position); -} - -huggles.after_google.push( - initialize - //function() { - // google.maps.event.addDomListener(window, 'load', initialize); - // - //} -) +} \ No newline at end of file diff --git a/app/assets/javascripts/map/gmap.js b/app/assets/javascripts/map/gmap.js index 6e869b1..489a0e5 100644 --- a/app/assets/javascripts/map/gmap.js +++ b/app/assets/javascripts/map/gmap.js @@ -1,17 +1,9 @@ var huggles = huggles || {} function loadScript() { - //var script = document.createElement('script'); - //script.type = 'text/javascript'; - //script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp' + - // '&signed_in=false&callback=initialize'; - //document.body.appendChild(script); - //$.getScript('https://maps.googleapis.com/maps/api/js?v=3.exp') - // .done(function() { - $(huggles.after_google).each(function(i, f) { - f() + $(huggles.after_google).each(function(i, f) { + f() }) - //}) } window.onload = loadScript; \ No newline at end of file diff --git a/app/assets/javascripts/map/marker_location.js b/app/assets/javascripts/map/marker_location.js index be6fb1f..e03d487 100644 --- a/app/assets/javascripts/map/marker_location.js +++ b/app/assets/javascripts/map/marker_location.js @@ -1,13 +1,14 @@ -var huggles = huggles || {} -huggles.after_google = huggles.after_google || [] - -huggles.after_google.push( - function () { - google.maps.event.addListener(map, "rightclick", function(event) { - var lat = event.latLng.lat(); - var lng = event.latLng.lng(); - // populate yor box/field with lat, lng - alert("Lat=" + lat + "; Lng=" + lng); - }) - } -) +//var huggles = huggles || {}; +//huggles.after_google = huggles.after_google || []; +// +//huggles.after_google.push( +// function () { +// +// google.maps.event.addListener(map, 'click', function(event) { +// var lat = event.latLng.lat(); +// var lng = event.latLng.lng(); +// // populate yor box/field with lat, lng +// alert("Lat=" + lat + "; Lng=" + lng); +// }) +// } +//); diff --git a/app/assets/stylesheets/_google_maps.css b/app/assets/stylesheets/_google_maps.css new file mode 100644 index 0000000..99b0352 --- /dev/null +++ b/app/assets/stylesheets/_google_maps.css @@ -0,0 +1,13 @@ +#map-container { + height: 400px; + border-radius: 16px 16px; + border-color: #fff; + border-style: solid; + box-shadow: 2px 2px 10px #B1B1B1; + margin-top: 25px; + border-width: 7px; +} +#map-canvas { + height: 384px; + width: 100%; +} \ No newline at end of file diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index abccfca..e666736 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,2 +1,3 @@ @import "bootstrap-sprockets"; -@import "bootstrap"; \ No newline at end of file +@import "bootstrap"; +@import "google_maps"; \ No newline at end of file diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 9507dc8..d4a5cf1 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -1,6 +1,7 @@ class ProfileController < ApplicationController def new + end def index diff --git a/app/controllers/sync_controller.rb b/app/controllers/sync_controller.rb new file mode 100644 index 0000000..a377d00 --- /dev/null +++ b/app/controllers/sync_controller.rb @@ -0,0 +1,13 @@ +class SyncController < ApplicationController + def sync + location = current_user.set_location sync_params if user_signed_in? + + render js: "showPins([[-117.128954,32.7477], [-117.126975, 32.748002]])" + end + + private + + def sync_params + params.require(:sync).permit :lat, :lon + end +end \ No newline at end of file diff --git a/app/models/location.rb b/app/models/location.rb new file mode 100644 index 0000000..3f713a2 --- /dev/null +++ b/app/models/location.rb @@ -0,0 +1,3 @@ +class Location < ActiveRecord::Base + belongs_to :user +end diff --git a/app/models/user.rb b/app/models/user.rb index c822027..055e3d0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,16 @@ class User < ActiveRecord::Base + has_one :location # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable + + def set_location sync_params + location = Location.new + location.user = self + location.lonlat = "POINT(#{sync_params[:lon].to_f}, #{sync_params[:lat].to_f})" + location.save + + location + end end diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index b261cfd..c6a9164 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -22,5 +22,3 @@ <%= f.submit "Log in" %> <% end %> - -<%= render "devise/shared/links" %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6154418..62f07ba 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,14 +2,17 @@ Huggles - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> +<%= render "shared/navbar" %> + <%= yield %> + + diff --git a/app/views/profile/_index.html.erb b/app/views/profile/_index.html.erb new file mode 100644 index 0000000..279f293 --- /dev/null +++ b/app/views/profile/_index.html.erb @@ -0,0 +1,8 @@ +

Profile

+ +

Potential Huggles

+ +
+
+
+
\ No newline at end of file diff --git a/app/views/profile/index.html.erb b/app/views/profile/index.html.erb index 219ec00..a9f9073 100644 --- a/app/views/profile/index.html.erb +++ b/app/views/profile/index.html.erb @@ -1,13 +1 @@ -

Profile

- -

Potential Huggles

- -
- - -
- -
-
-
-
\ No newline at end of file +<%= render 'index' %> \ No newline at end of file diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb new file mode 100644 index 0000000..06c814c --- /dev/null +++ b/app/views/shared/_navbar.html.erb @@ -0,0 +1,41 @@ + \ No newline at end of file diff --git a/config/database.yml b/config/database.yml index 7eab076..515229e 100644 --- a/config/database.yml +++ b/config/database.yml @@ -15,7 +15,7 @@ # gem 'pg' # default: &default - adapter: postgresql + adapter: postgis encoding: unicode pool: 5 username: Adam diff --git a/config/routes.rb b/config/routes.rb index 20658c1..27fde64 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,6 +8,8 @@ unauthenticated :user do root :to => 'devise/registrations#new', as: :unauthenticated_root end + + post 'sync', to: "sync#sync", as: :sync end # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/db/migrate/20150716214858_enable_postgis.rb b/db/migrate/20150716214858_enable_postgis.rb new file mode 100644 index 0000000..6f1a327 --- /dev/null +++ b/db/migrate/20150716214858_enable_postgis.rb @@ -0,0 +1,15 @@ +class EnablePostgis < ActiveRecord::Migration + def up + ActiveRecord::Base.connection.execute """ + CREATE EXTENSION IF NOT EXISTS postgis; +-- Enable Topology +CREATE EXTENSION IF NOT EXISTS postgis_topology; +-- fuzzy matching needed for Tiger +CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; +""" + end + + def down + + end +end diff --git a/db/migrate/20150717171204_create_locations.rb b/db/migrate/20150717171204_create_locations.rb new file mode 100644 index 0000000..c1ed84c --- /dev/null +++ b/db/migrate/20150717171204_create_locations.rb @@ -0,0 +1,12 @@ +class CreateLocations < ActiveRecord::Migration + def change + create_table :locations do |t| + t.references :user + t.st_point :lonlat, geographic: true + + t.timestamps null: false + end + + add_index :locations, :lonlat, using: :gist + end +end diff --git a/db/schema.rb b/db/schema.rb index 9d18d32..2c6ec04 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,10 +11,22 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150713225307) do +ActiveRecord::Schema.define(version: 20150717171204) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" + enable_extension "postgis" + enable_extension "postgis_topology" + enable_extension "fuzzystrmatch" + + create_table "locations", force: :cascade do |t| + t.integer "user_id" + t.geography "lonlat", limit: {:srid=>4326, :type=>"point", :geographic=>true} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "locations", ["lonlat"], name: "index_locations_on_lonlat", using: :gist create_table "users", force: :cascade do |t| t.string "email", default: "", null: false