diff --git a/bower.json b/bower.json
index bb73d6d..09506d7 100644
--- a/bower.json
+++ b/bower.json
@@ -1,5 +1,5 @@
{
- "name": "trackmapper",
+ "name": "rikitraki",
"private": true,
"dependencies": {
"bootstrap": "~3.3.4",
diff --git a/index.html b/index.html
index e838c20..0b8a45e 100644
--- a/index.html
+++ b/index.html
@@ -10,8 +10,8 @@
About this site
@@ -887,6 +887,7 @@
Building blocks
Stupid-table-plugin super simple table sort plug-in
JavaScript Canvas to Blob polyfill for standard canvas.toBlob method
Country-Region-Selector utility for selecting coordinated country/region
+
RubaXa Sortable library for drag n'drop support
publicdomainvectors.org public domain icons
Base maps:
@@ -951,21 +952,19 @@
Building blocks
-
-
+
+
-
-
-
+
+
-
-
+
-
+
-
+
diff --git a/js/data.js b/js/data.js
index 718b2a9..6b103c3 100644
--- a/js/data.js
+++ b/js/data.js
@@ -51,18 +51,6 @@ var tmData = {
error: errorCallback
});
},
- validateEmail: function (email, successCallback, errorCallback) {
- $.ajax({
- url: 'https://api.mailgun.net/v3/address/validate',
- type: 'GET',
- data: {address: email},
- username: 'api',
- password: 'pubkey-006969454903b02211a68c07550724b2',
- dataType: 'jsonp',
- success: successCallback,
- error: errorCallback
- });
- },
updateUserProfile: function (reg, username, password, successCallback, errorCallback) {
$.ajax({
url: API_BASE_URL + '/v1/users/me',
diff --git a/js/forms.js b/js/forms.js
index 41601db..25db5c4 100644
--- a/js/forms.js
+++ b/js/forms.js
@@ -130,7 +130,6 @@ var tmForms = {
var reg = {};
reg.email = $('#inv-email').val();
- // Use mailgun email validation to improve chances of delivery
if (tmUtils.isValidEmail(reg.email)) {
tmData.addInvitation(reg, function() {
$('#invitationError').hide();
@@ -471,6 +470,10 @@ var tmForms = {
// $('#uploadTrackButton').append('
');
$('#uploadEditContainer').append('
');
$('#upload-btn').click(function() {
+ // Needed to fix crs annoying issue
+ $('#track-country').attr('data-crs-loaded', 'false');
+ window.crs.init();
+
$('#uploadTrackModal').modal('show');
return false;
});
@@ -505,7 +508,6 @@ var tmForms = {
// Enable drag and drop sorting
$('#track-photos-container').sortable();
});
-
},
uploadTrack: function () {
var self = this;
@@ -568,7 +570,6 @@ var tmForms = {
for (var j=0; j
MAX_IMAGE_SIZE) {
resizeToBlobTasks.push(self.resizeToBlob(data.trackId, images[j], j, uploadPictureTasks));
@@ -697,7 +698,7 @@ var tmForms = {
// Set current values on the form for editing
$('#edit-track-name').val(track.trackName);
$('#edit-track-description').val(track.trackDescription);
- $('#edit-track-activity').val(track.trackType);
+ $('#edit-track-activity').val(track.trackType ? track.trackType : 'Hiking'); // For compatibility with old data
$('#edit-track-level[value=' + track.trackLevel + ']').prop('checked', true);
if (track.trackFav) {
$('#edit-track-favorite').prop('checked', true);
@@ -705,8 +706,11 @@ var tmForms = {
if (track.trackRegionTags[0]) {
var country = track.trackRegionTags[0];
$('#edit-track-country').attr('data-default-value', (country === 'US') ? 'United States' : country);
+
+ // Needed to fix crs annoying issue
$('#edit-track-country').attr('data-crs-loaded', 'false');
window.crs.init();
+
if (track.trackRegionTags[1]) {
$('#edit-track-region').val(track.trackRegionTags[1]);
}
@@ -737,6 +741,7 @@ var tmForms = {
onAdd: function(evt) {evt.item.remove(); $('#edit-track-file-selector').show();}
});
+ $('#saveButton').removeAttr('disabled');
$('#editTrackModal').modal('show');
return false;
});
@@ -798,6 +803,25 @@ var tmForms = {
},
saveEditedTrackInfo: function(track) {
var self = this;
+ // A couple of private functions
+ function deletePicture (picIndex) {
+ return tmData.deleteTrackPic(track.trackId, picIndex, localStorage.getItem('rikitraki-token'));
+ }
+
+ function updateTrack(t) {
+ tmData.updateTrack(t, localStorage.getItem('rikitraki-token'), function(data) {
+ $('#savingMessage').hide();
+ $('#editMessage').fadeIn('slow');
+ setTimeout(function () {
+ window.location.href='?track=' + data.trackId;
+ }, 2000);
+ }, function(jqxhr) { // jqxhr, textStatus
+ $('#editErrorText').text('Save error, status ' + jqxhr.status + ' - ' + jqxhr.responseText);
+ $('#editError').fadeIn('slow');
+ console.log(jqxhr);
+ });
+ }
+
if (self.isValidForm('edit')) {
$('#savingMessage').fadeIn('slow');
$('#saveSpinner').spin({left: '90%'});
@@ -879,9 +903,7 @@ var tmForms = {
// Schedule delete photos task
var deletePictureTasks = [];
- function deletePicture (picIndex) {
- return tmData.deleteTrackPic(track.trackId, picIndex, localStorage.getItem('rikitraki-token'));
- }
+
if ($.inArray(true, photosToDelete) >= 0) {
photosChanged = true;
trackChanged = true;
@@ -892,20 +914,6 @@ var tmForms = {
}
}
- function updateTrack(t) {
- tmData.updateTrack(t, localStorage.getItem('rikitraki-token'), function(data) {
- $('#savingMessage').hide();
- $('#editMessage').fadeIn('slow');
- setTimeout(function () {
- window.location.href='?track=' + data.trackId;
- }, 2000);
- }, function(jqxhr) { // jqxhr, textStatus
- $('#editErrorText').text('Save error, status ' + jqxhr.status + ' - ' + jqxhr.responseText);
- $('#editError').fadeIn('slow');
- console.log(jqxhr);
- });
- }
-
t.hasPhotos = (t.trackPhotos.length === 0) ? t.hasPhotos = false : t.hasPhotos = true;
if (!photosChanged) {
@@ -922,7 +930,11 @@ var tmForms = {
});
});
});
- }
+ } else {
+ $('#editTrackModal').modal('hide');
+ $('#saveSpinner').spin(false);
+ this.cleanupErrorMarks();
+ }
}
},
removeTrack: function(trackId) {
@@ -942,6 +954,8 @@ var tmForms = {
$('#filter-btn').click(function() {
self.cleanupErrorMarks();
$('#filterModal').find('form').trigger('reset');
+
+
var filter = localStorage.getItem('rikitraki-filter');
if (filter) {
filter = JSON.parse(filter);
@@ -964,14 +978,23 @@ var tmForms = {
}
if (filter.country) {
$('#filter-country').attr('data-default-value', (filter.country === 'US') ? 'United States' : filter.country);
+
+ // Needed to fix crs annoying issue
$('#filter-country').attr('data-crs-loaded', 'false');
window.crs.init();
}
if (filter.region) {
$('#filter-region').val(filter.region);
}
+ } else {
+ // Needed to fix crs annoying issue
+ $('#filter-country').attr('data-crs-loaded', 'false');
+ window.crs.init();
}
+ // Below needed to fix annoying crs issue
+
+
var me = localStorage.getItem('rikitraki-username');
if (me) {
$('#filter-me').removeAttr('disabled');
diff --git a/package.json b/package.json
index 455ed82..0508b76 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "rikitraki",
- "version": "0.1.1",
+ "version": "0.5.1",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-bower": "^0.19.0",