Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decaffeinate #474

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ gem 'rack-cors', :require => 'rack/cors'
gem 'rack-jsonp'
gem 'http_accept_language'
gem 'puma'
gem 'sprockets-es6'

# Upgraded to 1.0.0 for Rails 5.1.4
gem 'activeadmin', '~> 1.0.0'
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ GEM
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
bcrypt (3.1.11)
better_errors (2.4.0)
coderay (>= 1.0.0)
Expand Down Expand Up @@ -325,6 +329,10 @@ GEM
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-es6 (0.9.2)
babel-source (>= 5.8.11)
babel-transpiler
sprockets (>= 3.0.0)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
Expand Down Expand Up @@ -401,6 +409,7 @@ DEPENDENCIES
sdoc
simple_form (~> 3.5)
simplecov (~> 0.7.1)
sprockets-es6
turbolinks
tzinfo-data
uglifier (>= 1.3.0)
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/active_admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//= require active_admin/base
1 change: 0 additions & 1 deletion app/assets/javascripts/active_admin.js.coffee

This file was deleted.

11 changes: 11 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//= require_self
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require_tree .
//= require_tree ./lib
//= require_tree ./views

window.Refuge = {}
Refuge.Library = {}
Refuge.Restrooms = {}
11 changes: 0 additions & 11 deletions app/assets/javascripts/application.js.coffee

This file was deleted.

73 changes: 0 additions & 73 deletions app/assets/javascripts/lib/geocoder.coffee

This file was deleted.

87 changes: 87 additions & 0 deletions app/assets/javascripts/lib/geocoder.es6
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// TODO: Update API To NOT USE GOOGLE and use Open Source

Refuge.Library.Geocoder = class Geocoder {
constructor() {
this.geocodeSearchString = this.geocodeSearchString.bind(this);
this.getAddress = this.getAddress.bind(this);
this.statusOK = google.maps.GeocoderStatus.OK;
this.googleGeocoder = new google.maps.Geocoder();
}

geocodeSearchString(address) {
const _googleGeocoder = new google.maps.Geocoder();

// This function takes in a string and geocodes it, returning two coordinates.
// It will resolve a promise with an object that contains the
// latitude and longtitude.

const requestBody = { 'address': address };
const promise = $.Deferred();

const success = (results, status) => {
if (status === this.statusOK) {
const coords = {
lat: results[0].geometry.location.lat(),
long: results[0].geometry.location.lng()
};
promise.resolve(coords);
} else {
promise.reject(status);
}
};
const fail = err => promise.reject(err);

_googleGeocoder.geocode(requestBody, success, fail);

return promise.promise();
}

getAddress(coords) {
const requestBody = {'location': new google.maps.LatLng(coords.lat, coords.long)};
const promise = $.Deferred();

console.log(requestBody);
const success = (results, status) => {
if (status === this.statusOK) {
promise.resolve(results);
}
};
const fail = err => promise.reject(err);

this.googleGeocoder.geocode(requestBody, success, fail);

return promise.promise();
}


getCurrentLocation() {
// This function returns a promise that evaluates to an object with the
// latitude and longitute of the current coordinates.

const support = navigator.geolocation;
const options = {
enableHighAccuracy: true,
timeout: 5000
};
const promise = $.Deferred();

// Callback functions
const success = function(pos) {
const result = {
lat: pos.coords.latitude,
long: pos.coords.longitude
};
promise.resolve(result);
};
const error = err => promise.reject(err);

if (support) {
navigator.geolocation.getCurrentPosition(success, error, options);
} else {
// Geolocation not supported
promise.reject("Not Supported");
}

return promise.promise();
}
}
4 changes: 0 additions & 4 deletions app/assets/javascripts/lib/global_variables.coffee.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/assets/javascripts/lib/global_variables.es6.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const currentLocationImage = "<%= image_path('marker-icon.png') %>";
const circleMarkerImage = "<%= image_path('marker-circle.png') %>";
const showMarkerImage = "<%= image_path('show-icon.png') %>";
107 changes: 0 additions & 107 deletions app/assets/javascripts/views/restrooms/new.coffee

This file was deleted.

Loading