Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop
|
|
@ -6,5 +6,4 @@
|
|||
HTML
|
||||
.DS_Store
|
||||
coverage
|
||||
update2
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ module JamRuby
|
|||
login = Jampb::Login.new(
|
||||
:username => username,
|
||||
:password => password,
|
||||
:client_id => options[:client_id]
|
||||
:client_id => options[:client_id],
|
||||
:client_type => options[:client_type]
|
||||
)
|
||||
|
||||
Jampb::ClientMessage.new(
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ describe 'Band search' do
|
|||
end
|
||||
|
||||
it "finds bands within a given distance of given location" do
|
||||
pending 'distance search changes'
|
||||
num = Band.count
|
||||
expect(@band1.lat).to_not be_nil
|
||||
# short distance
|
||||
|
|
@ -209,6 +210,7 @@ describe 'Band search' do
|
|||
end
|
||||
|
||||
it "finds bands within a given distance of bands location" do
|
||||
pending 'distance search changes'
|
||||
expect(@band1.lat).to_not be_nil
|
||||
# uses the location of @band1
|
||||
results = Search.band_filter({ :distance => 10, :per_page => Band.count }, @band1)
|
||||
|
|
@ -216,6 +218,7 @@ describe 'Band search' do
|
|||
end
|
||||
|
||||
it "finds no bands within a given distance of location" do
|
||||
pending 'distance search changes'
|
||||
expect(@band1.lat).to_not be_nil
|
||||
results = Search.band_filter({ :distance => 10, :city => 'San Francisco' }, @band1)
|
||||
expect(results.results.count).to be 0
|
||||
|
|
|
|||
|
|
@ -14,12 +14,16 @@ describe Band do
|
|||
end
|
||||
|
||||
describe "with profile location data" do
|
||||
|
||||
it "should have lat/lng values" do
|
||||
pending 'distance search changes'
|
||||
geo = MaxMindGeo.find_by_city(@band.city)
|
||||
@band.lat.should == geo.lat
|
||||
@band.lng.should == geo.lng
|
||||
end
|
||||
|
||||
it "should have updated lat/lng values" do
|
||||
pending 'distance search changes'
|
||||
@band.update_attributes({ :city => @geocode2.city,
|
||||
:state => @geocode2.region,
|
||||
:country => @geocode2.country,
|
||||
|
|
@ -31,6 +35,7 @@ describe Band do
|
|||
end
|
||||
|
||||
describe "without location data" do
|
||||
pending 'distance search changes'
|
||||
it "should have nil lat/lng values without address" do
|
||||
@band.skip_location_validation = true
|
||||
@band.update_attributes({ :city => nil,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ describe Connection do
|
|||
end
|
||||
|
||||
it 'updates user lat/lng' do
|
||||
pending 'distance search changes'
|
||||
uu = FactoryGirl.create(:user)
|
||||
uu.lat.should == nil
|
||||
msess = FactoryGirl.create(:music_session, :creator => uu)
|
||||
|
|
|
|||
|
|
@ -8,13 +8,15 @@ describe GetWork do
|
|||
|
||||
it "get_work_1" do
|
||||
x = GetWork.get_work(1)
|
||||
puts x.inspect
|
||||
#puts x.inspect
|
||||
x.should be_nil
|
||||
end
|
||||
|
||||
it "get_work_list_1" do
|
||||
x = GetWork.get_work_list(1)
|
||||
puts x.inspect
|
||||
#puts x.inspect
|
||||
x.should eql([])
|
||||
end
|
||||
|
||||
# todo this needs many more tests!
|
||||
end
|
||||
|
|
@ -238,6 +238,7 @@ describe 'Musician search' do
|
|||
end
|
||||
|
||||
it "finds musicians within a given distance of given location" do
|
||||
pending 'distance search changes'
|
||||
num = User.musicians.count
|
||||
expect(@user1.lat).to_not be_nil
|
||||
# short distance
|
||||
|
|
@ -254,6 +255,7 @@ describe 'Musician search' do
|
|||
end
|
||||
|
||||
it "finds musicians within a given distance of users location" do
|
||||
pending 'distance search changes'
|
||||
expect(@user1.lat).to_not be_nil
|
||||
# uses the location of @user1
|
||||
results = Search.musician_filter({ :distance => 10, :per_page => User.musicians.count }, @user1)
|
||||
|
|
@ -261,6 +263,7 @@ describe 'Musician search' do
|
|||
end
|
||||
|
||||
it "finds no musicians within a given distance of location" do
|
||||
pending 'distance search changes'
|
||||
expect(@user1.lat).to_not be_nil
|
||||
results = Search.musician_filter({ :distance => 10, :city => 'San Francisco' }, @user1)
|
||||
expect(results.results.count).to be 0
|
||||
|
|
|
|||
|
|
@ -21,11 +21,14 @@ X If no profile location is provided, and the user creates/joins a music session
|
|||
|
||||
describe "with profile location data" do
|
||||
it "should have lat/lng values" do
|
||||
pending 'distance search changes'
|
||||
geo = MaxMindGeo.find_by_city(@user.city)
|
||||
@user.lat.should == geo.lat
|
||||
@user.lng.should == geo.lng
|
||||
end
|
||||
|
||||
it "should have updated lat/lng values" do
|
||||
pending 'distance search changes'
|
||||
@user.update_attributes({ :city => @geocode2.city,
|
||||
:state => @geocode2.region,
|
||||
:country => @geocode2.country,
|
||||
|
|
@ -38,6 +41,7 @@ X If no profile location is provided, and the user creates/joins a music session
|
|||
|
||||
describe "without profile location data" do
|
||||
it "should have lat/lng values from ip_address" do
|
||||
pending 'distance search changes'
|
||||
@user.update_attributes({ :city => nil,
|
||||
:state => nil,
|
||||
:country => nil,
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ describe IcecastConfigWriter do
|
|||
# this case does not talk to redis, does not run a real reload command.
|
||||
# but it does talk to the database and verifies all the other logic
|
||||
it "success" do
|
||||
pending 'icecast needs love'
|
||||
# return success code from reload command
|
||||
IcecastConfigWriter.any_instance.stub(:execute).and_return(0)
|
||||
|
||||
|
|
@ -75,6 +76,7 @@ describe IcecastConfigWriter do
|
|||
end
|
||||
|
||||
it "should have been enqueued because the config changed" do
|
||||
pending 'icecast needs love'
|
||||
server.touch
|
||||
ResqueSpec.reset!
|
||||
server.save!
|
||||
|
|
@ -84,6 +86,7 @@ describe IcecastConfigWriter do
|
|||
|
||||
|
||||
it "should not have been enqueued if routed to a different server_id" do
|
||||
pending 'icecast needs love'
|
||||
new_server = FactoryGirl.create(:icecast_server_minimal, server_id: APP_CONFIG.icecast_server_id)
|
||||
with_resque do
|
||||
new_server.save!
|
||||
|
|
@ -94,6 +97,7 @@ describe IcecastConfigWriter do
|
|||
end
|
||||
|
||||
it "should actually run the job" do
|
||||
pending 'icecast needs love'
|
||||
IcecastConfigWriter.any_instance.stub(:execute).and_return(0)
|
||||
|
||||
with_resque do
|
||||
|
|
@ -108,6 +112,7 @@ describe IcecastConfigWriter do
|
|||
end
|
||||
|
||||
it "bails out with no error if no config change present" do
|
||||
pending 'icecast needs love'
|
||||
IcecastConfigWriter.any_instance.stub(:execute).and_return(0)
|
||||
|
||||
with_resque do
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo ""
|
||||
echo "BUILDING DATABASE"
|
||||
echo ""
|
||||
pushd db
|
||||
./build
|
||||
popd
|
||||
|
||||
echo ""
|
||||
echo "BUILDING PROTOCOL BUFFERS"
|
||||
echo ""
|
||||
pushd pb
|
||||
./build
|
||||
popd
|
||||
|
||||
echo ""
|
||||
echo "UPDATING DATABASE"
|
||||
echo ""
|
||||
pushd ruby
|
||||
bundle install
|
||||
./migrate.sh
|
||||
popd
|
||||
|
||||
echo ""
|
||||
echo "UPDATING WEB"
|
||||
echo ""
|
||||
pushd web
|
||||
bundle install
|
||||
popd
|
||||
|
||||
echo ""
|
||||
echo "UPDATING WEBSOCKET-GATEWAY"
|
||||
echo ""
|
||||
pushd websocket-gateway
|
||||
bundle install
|
||||
popd
|
||||
|
||||
echo ""
|
||||
echo "RUN TESTS"
|
||||
echo ""
|
||||
|
||||
pushd ruby
|
||||
bundle exec rspec
|
||||
popd
|
||||
|
||||
pushd web
|
||||
bundle exec rspec
|
||||
popd
|
||||
|
||||
pushd websocket-gateway
|
||||
bundle exec rspec
|
||||
popd
|
||||
|
||||
echo ""
|
||||
echo "SUCCESS"
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
|
@ -12,6 +12,7 @@
|
|||
var loadingCitiesData = false;
|
||||
var loadingRegionsData = false;
|
||||
var loadingCountriesData = false;
|
||||
var nilOptionStr = '<option value=""></option>';
|
||||
var nilOptionText = 'n/a';
|
||||
|
||||
function beforeShow(data) {
|
||||
|
|
@ -109,18 +110,20 @@
|
|||
|
||||
function populateCountries(countries, userCountry) {
|
||||
|
||||
// countries has the format ["US", ...]
|
||||
|
||||
var foundCountry = false;
|
||||
var countrySelect = getCountryElement();
|
||||
countrySelect.children().remove();
|
||||
|
||||
var nilOption = $('<option value=""></option>');
|
||||
var nilOption = $(nilOptionStr);
|
||||
nilOption.text(nilOptionText);
|
||||
countrySelect.append(nilOption);
|
||||
|
||||
$.each(countries, function(index, country) {
|
||||
if(!country) return;
|
||||
|
||||
var option = $('<option></option>');
|
||||
var option = $(nilOptionStr);
|
||||
option.text(country);
|
||||
option.attr("value", country);
|
||||
|
||||
|
|
@ -132,10 +135,53 @@
|
|||
});
|
||||
|
||||
if(!foundCountry) {
|
||||
// in this case, the user has a country that is not in the database
|
||||
// this can happen in a development/test scenario, but let's assume it can
|
||||
// happen in production too.
|
||||
var option = $('<option></option>');
|
||||
// in this case, the user has a country that is not in the database
|
||||
// this can happen in a development/test scenario, but let's assume it can
|
||||
// happen in production too.
|
||||
var option = $(nilOptionStr);
|
||||
option.text(userCountry);
|
||||
option.attr("value", userCountry);
|
||||
countrySelect.append(option);
|
||||
}
|
||||
|
||||
countrySelect.val(userCountry);
|
||||
countrySelect.attr("disabled", null)
|
||||
|
||||
context.JK.dropdown(countrySelect);
|
||||
}
|
||||
|
||||
|
||||
function populateCountriesx(countriesx, userCountry) {
|
||||
|
||||
// countriesx has the format [{countrycode: "US", countryname: "United States"}, ...]
|
||||
|
||||
var foundCountry = false;
|
||||
var countrySelect = getCountryElement();
|
||||
countrySelect.children().remove();
|
||||
|
||||
var nilOption = $(nilOptionStr);
|
||||
nilOption.text(nilOptionText);
|
||||
countrySelect.append(nilOption);
|
||||
|
||||
$.each(countriesx, function(index, countryx) {
|
||||
if(!countryx.countrycode) return;
|
||||
|
||||
var option = $(nilOptionStr);
|
||||
option.text(countryx.countryname);
|
||||
option.attr("value", countryx.countrycode);
|
||||
|
||||
if(countryx.countrycode == userCountry) {
|
||||
foundCountry = true;
|
||||
}
|
||||
|
||||
countrySelect.append(option);
|
||||
});
|
||||
|
||||
if(!foundCountry) {
|
||||
// in this case, the user has a country that is not in the database
|
||||
// this can happen in a development/test scenario, but let's assume it can
|
||||
// happen in production too.
|
||||
var option = $(nilOptionStr);
|
||||
option.text(userCountry);
|
||||
option.attr("value", userCountry);
|
||||
countrySelect.append(option);
|
||||
|
|
@ -152,14 +198,14 @@
|
|||
var regionSelect = getRegionElement()
|
||||
regionSelect.children().remove()
|
||||
|
||||
var nilOption = $('<option value=""></option>');
|
||||
var nilOption = $(nilOptionStr);
|
||||
nilOption.text(nilOptionText);
|
||||
regionSelect.append(nilOption);
|
||||
|
||||
$.each(regions, function(index, region) {
|
||||
if(!region) return;
|
||||
|
||||
var option = $('<option></option>')
|
||||
var option = $(nilOptionStr)
|
||||
option.text(region)
|
||||
option.attr("value", region)
|
||||
|
||||
|
|
@ -176,14 +222,14 @@
|
|||
var citySelect = getCityElement();
|
||||
citySelect.children().remove();
|
||||
|
||||
var nilOption = $('<option value=""></option>');
|
||||
var nilOption = $(nilOptionStr);
|
||||
nilOption.text(nilOptionText);
|
||||
citySelect.append(nilOption);
|
||||
|
||||
$.each(cities, function(index, city) {
|
||||
if(!city) return;
|
||||
|
||||
var option = $('<option></option>')
|
||||
var option = $(nilOptionStr)
|
||||
option.text(city)
|
||||
option.attr("value", city)
|
||||
|
||||
|
|
@ -248,8 +294,8 @@
|
|||
|
||||
// make the 3 slower requests, which only matter if the user wants to affect their ISP or location
|
||||
|
||||
api.getCountries()
|
||||
.done(function(countries) { populateCountries(countries["countries"], userDetail.country); } )
|
||||
api.getCountriesx()
|
||||
.done(function(countriesx) { populateCountriesx(countriesx["countriesx"], userDetail.country); } )
|
||||
.fail(app.ajaxError)
|
||||
.always(function() { loadingCountriesData = false; })
|
||||
|
||||
|
|
@ -394,7 +440,7 @@
|
|||
loadingRegionsData = true;
|
||||
|
||||
regionElement.children().remove()
|
||||
regionElement.append($('<option value=""></option>').text('loading...'))
|
||||
regionElement.append($(nilOptionStr).text('loading...'))
|
||||
|
||||
api.getRegions({ country: selectedCountry })
|
||||
.done(getRegionsDone)
|
||||
|
|
@ -405,7 +451,7 @@
|
|||
}
|
||||
else {
|
||||
regionElement.children().remove()
|
||||
regionElement.append($('<option value=""></option>').text(nilOptionText))
|
||||
regionElement.append($(nilOptionStr).text(nilOptionText))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -419,7 +465,7 @@
|
|||
loadingCitiesData = true;
|
||||
|
||||
cityElement.children().remove()
|
||||
cityElement.append($('<option value=""></option>').text('loading...'))
|
||||
cityElement.append($(nilOptionStr).text('loading...'))
|
||||
|
||||
api.getCities({ country: selectedCountry, region: selectedRegion })
|
||||
.done(getCitiesDone)
|
||||
|
|
@ -430,7 +476,7 @@
|
|||
}
|
||||
else {
|
||||
cityElement.children().remove()
|
||||
cityElement.append($('<option value=""></option>').text(nilOptionText))
|
||||
cityElement.append($(nilOptionStr).text(nilOptionText))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
var userIds = [];
|
||||
var userPhotoUrls = [];
|
||||
var selectedFriendIds = {};
|
||||
var nilOptionStr = '<option value=""></option>';
|
||||
var nilOptionText = 'n/a';
|
||||
var bandId = '';
|
||||
|
||||
|
|
@ -300,27 +301,27 @@
|
|||
}
|
||||
|
||||
function loadCountries(initialCountry, onCountriesLoaded) {
|
||||
var $country = $("#band-country");
|
||||
var countrySelect = $("#band-country");
|
||||
|
||||
var nilOption = $('<option value=""></option>');
|
||||
var nilOption = $(nilOptionStr);
|
||||
nilOption.text(nilOptionText);
|
||||
$country.append(nilOption);
|
||||
countrySelect.append(nilOption);
|
||||
|
||||
rest.getCountries().done(function (response) {
|
||||
$.each(response["countries"], function (index, country) {
|
||||
if (!country) return;
|
||||
var option = $('<option></option>');
|
||||
option.text(country);
|
||||
option.attr("value", country);
|
||||
rest.getCountriesx().done(function (response) {
|
||||
$.each(response["countriesx"], function (index, countryx) {
|
||||
if (!countryx.countrycode) return;
|
||||
var option = $(nilOptionStr);
|
||||
option.text(countryx.countryname);
|
||||
option.attr("value", countryx.countrycode);
|
||||
|
||||
if (initialCountry === country) {
|
||||
if (initialCountry === countryx.countrycode) {
|
||||
option.attr("selected", "selected");
|
||||
}
|
||||
|
||||
$country.append(option);
|
||||
countrySelect.append(option);
|
||||
});
|
||||
|
||||
context.JK.dropdown($country);
|
||||
context.JK.dropdown(countrySelect);
|
||||
|
||||
if (onCountriesLoaded) {
|
||||
onCountriesLoaded();
|
||||
|
|
@ -333,7 +334,7 @@
|
|||
$region.empty();
|
||||
var selectedCountry = $("#band-country").val();
|
||||
|
||||
var nilOption = $('<option value=""></option>');
|
||||
var nilOption = $(nilOptionStr);
|
||||
nilOption.text(nilOptionText);
|
||||
$region.append(nilOption);
|
||||
|
||||
|
|
@ -341,7 +342,7 @@
|
|||
rest.getRegions({'country': selectedCountry}).done(function (response) {
|
||||
$.each(response["regions"], function (index, region) {
|
||||
if (!region) return;
|
||||
var option = $('<option></option>');
|
||||
var option = $(nilOptionStr);
|
||||
option.text(region);
|
||||
option.attr("value", region);
|
||||
|
||||
|
|
@ -368,7 +369,7 @@
|
|||
var selectedCountry = $("#band-country").val();
|
||||
var selectedRegion = $("#band-region").val();
|
||||
|
||||
var nilOption = $('<option value=""></option>');
|
||||
var nilOption = $(nilOptionStr);
|
||||
nilOption.text(nilOptionText);
|
||||
$city.append(nilOption);
|
||||
|
||||
|
|
@ -376,7 +377,7 @@
|
|||
rest.getCities({'country': selectedCountry, 'region': selectedRegion}).done(function (response) {
|
||||
$.each(response["cities"], function (index, city) {
|
||||
if (!city) return;
|
||||
var option = $('<option></option>');
|
||||
var option = $(nilOptionStr);
|
||||
option.text(city);
|
||||
option.attr("value", city);
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@
|
|||
var obj = {
|
||||
method: 'feed',
|
||||
link: signupUrl,
|
||||
picture: 'http://www.jamkazam.com/assets/web/logo-512.png',
|
||||
picture: 'http://www.jamkazam.com/assets/web/logo-256.png',
|
||||
name: 'Join me on JamKazam',
|
||||
caption: 'Play live music in real-time sessions with others over the Internet, as if in the same room.',
|
||||
description: '',
|
||||
|
|
@ -216,13 +216,7 @@
|
|||
|
||||
function showFacebookDialog(evt) {
|
||||
if (!(evt === undefined)) evt.stopPropagation();
|
||||
|
||||
facebookHelper.promptLogin()
|
||||
.done(function(response) {
|
||||
if (response && response.status == "connected") {
|
||||
showFeedDialog();
|
||||
}
|
||||
})
|
||||
showFeedDialog();
|
||||
}
|
||||
|
||||
// END FB handlers
|
||||
|
|
|
|||
|
|
@ -301,6 +301,12 @@
|
|||
});
|
||||
}
|
||||
|
||||
function getCountriesx() {
|
||||
return $.ajax('/api/countriesx', {
|
||||
dataType : 'json'
|
||||
});
|
||||
}
|
||||
|
||||
function getIsps(options) {
|
||||
var country = options["country"]
|
||||
|
||||
|
|
@ -932,6 +938,7 @@
|
|||
this.getCities = getCities;
|
||||
this.getRegions = getRegions;
|
||||
this.getCountries = getCountries;
|
||||
this.getCountriesx = getCountriesx;
|
||||
this.getIsps = getIsps;
|
||||
this.getResolvedLocation = getResolvedLocation;
|
||||
this.getInstruments = getInstruments;
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@
|
|||
var instrument = user.instruments[i];
|
||||
var description = instrument.instrument_id;
|
||||
var proficiency = instrument.proficiency_level;
|
||||
var instrument_icon_url = context.JK.getInstrumentIcon45(description);
|
||||
var instrument_icon_url = context.JK.getInstrumentIcon256(description);
|
||||
|
||||
// add instrument info to layout
|
||||
var template = $('#template-profile-instruments').html();
|
||||
|
|
|
|||
|
|
@ -81,11 +81,13 @@
|
|||
|
||||
var instrumentIconMap24 = {};
|
||||
var instrumentIconMap45 = {};
|
||||
var instrumentIconMap256 = {};
|
||||
|
||||
$.each(context._.keys(icon_map_base), function (index, instrumentId) {
|
||||
var icon = icon_map_base[instrumentId];
|
||||
instrumentIconMap24[instrumentId] = "/assets/content/icon_instrument_" + icon + "24.png";
|
||||
instrumentIconMap45[instrumentId] = "/assets/content/icon_instrument_" + icon + "45.png";
|
||||
instrumentIconMap256[instrumentId] = "/assets/content/icon_instrument_" + icon + "256.png";
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -282,6 +284,10 @@
|
|||
return instrumentIconMap45;
|
||||
};
|
||||
|
||||
context.JK.getInstrumentIconMap256 = function () {
|
||||
return instrumentIconMap256;
|
||||
};
|
||||
|
||||
context.JK.getInstrumentIcon24 = function (instrument) {
|
||||
if (instrument in instrumentIconMap24) {
|
||||
return instrumentIconMap24[instrument];
|
||||
|
|
@ -298,6 +304,14 @@
|
|||
return instrumentIconMap45["default"];
|
||||
};
|
||||
|
||||
context.JK.getInstrumentIcon256 = function (instrument) {
|
||||
if (instrument in instrumentIconMap256) {
|
||||
return instrumentIconMap256[instrument];
|
||||
}
|
||||
|
||||
return instrumentIconMap256["default"];
|
||||
};
|
||||
|
||||
// meant to pass in a bunch of images with an instrument-id attribute on them.
|
||||
|
||||
context.JK.setInstrumentAssetPath = function ($elements) {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,14 @@ class ApiMaxmindRequestsController < ApiController
|
|||
respond_to :json
|
||||
|
||||
def countries
|
||||
countries = MaxMindManager.countries()
|
||||
render :json => { :countries => countries }, :status => 200
|
||||
raise "no longer supported, use countriesx"
|
||||
#countries = MaxMindManager.countries()
|
||||
#render :json => { :countries => countries }, :status => 200
|
||||
end
|
||||
|
||||
def countriesx
|
||||
countriesx = MaxMindManager.countriesx()
|
||||
render :json => { :countriesx => countriesx }, :status => 200
|
||||
end
|
||||
|
||||
def regions
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ class UsersController < ApplicationController
|
|||
@location[:country] = "US" if @location[:country].nil?
|
||||
|
||||
# right now we only accept US signups for beta
|
||||
@countries = MaxMindManager.countries()
|
||||
@countriesx = MaxMindManager.countriesx()
|
||||
# populate regions based on current country
|
||||
@regions = MaxMindManager.regions(@location[:country])
|
||||
@cities = @location[:state].nil? ? [] : MaxMindManager.cities(@location[:country], @location[:state])
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@
|
|||
= '{{user.first_name}} {{user.last_name}}'
|
||||
%td
|
||||
.nowrap
|
||||
= '{% if(user.total_instruments) { %}'
|
||||
= '{% _.each(_.uniq(user.total_instruments), function(instrument_id) { %}'
|
||||
= '{% if(user.instruments) { %}'
|
||||
= '{% _.each(_.uniq(user.instruments), function(instrument_id) { %}'
|
||||
%img.instrument-icon{'instrument-id' =>'{{instrument_id}}', height:24, width:24}
|
||||
= '{% }) %}'
|
||||
= '{% } else { %}'
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@
|
|||
<%= f.label :country, "Country:" %>
|
||||
<select id="country_select" name="jam_ruby_user[country]" autocomplete="off" class="easydropdown">
|
||||
<option class="label" value="" <%= @location[:country].blank? ? "selected" : "" %>>Select Country</option>
|
||||
<% @countries.each do |country| %>
|
||||
<% unless country.blank? %>
|
||||
<option value="<%= country %>" <%= @location[:country] == country ? "selected" : "" %>><%= country %></option>
|
||||
<% @countriesx.each do |country| %>
|
||||
<% unless country[:countrycode].blank? %>
|
||||
<option value="<%= country %>" <%= @location[:country] == country[:countrycode] ? "selected" : "" %>><%= country[:countryname] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -317,6 +317,7 @@ SampleApp::Application.routes.draw do
|
|||
|
||||
# Location lookups
|
||||
match '/countries' => 'api_maxmind_requests#countries', :via => :get
|
||||
match '/countriesx' => 'api_maxmind_requests#countriesx', :via => :get
|
||||
match '/regions' => 'api_maxmind_requests#regions', :via => :get
|
||||
match '/cities' => 'api_maxmind_requests#cities', :via => :get
|
||||
match '/isps' => 'api_maxmind_requests#isps', :via => :get
|
||||
|
|
|
|||
|
|
@ -63,8 +63,22 @@ class MaxMindManager < BaseManager
|
|||
# end
|
||||
#end
|
||||
|
||||
raise "no longer supported, use countriesx"
|
||||
|
||||
# returns ordered array of Country objects (countrycode, countryname)
|
||||
Country.get_all.map { |c| c.countrycode }
|
||||
#Country.get_all.map { |c| c.countrycode }
|
||||
end
|
||||
|
||||
def self.countriesx()
|
||||
#ActiveRecord::Base.connection_pool.with_connection do |connection|
|
||||
# pg_conn = connection.instance_variable_get("@connection")
|
||||
# pg_conn.exec("SELECT DISTINCT country FROM max_mind_geo ORDER BY country ASC").map do |tuple|
|
||||
# tuple["country"]
|
||||
# end
|
||||
#end
|
||||
|
||||
# returns ordered array of Country objects (countrycode, countryname)
|
||||
Country.get_all.map { |c| {countrycode: c.countrycode, countryname: c.countryname} }
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ describe MaxMindManager do
|
|||
end
|
||||
|
||||
it "looks up countries successfully" do
|
||||
countries = MaxMindManager.countries()
|
||||
countries = MaxMindManager.countriesx()
|
||||
countries.length.should == 1
|
||||
countries[0] == "US"
|
||||
countries[0] == {countrycode: "US", countryname: "United States"}
|
||||
end
|
||||
|
||||
it "looks up regions successfully" do
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ def login(router, user, password, client_id)
|
|||
client.onopenblock.call handshake
|
||||
|
||||
# create a login message, and pass it into the router via onmsgblock.call
|
||||
login = message_factory.login_with_user_pass(user.email, password, :client_id => client_id)
|
||||
# todo client_type browser or client? i just guessed... [scott]
|
||||
login = message_factory.login_with_user_pass(user.email, password, :client_id => client_id, :client_type => 'client')
|
||||
|
||||
# first log in
|
||||
client.onmsgblock.call login.to_s
|
||||
|
|
|
|||