Browse Source

don't wipe out custom entry after the location-specific buttons load

pull/10/head
Aaron Parecki 9 years ago
parent
commit
b869090f78
2 changed files with 22 additions and 1 deletions
  1. +21
    -0
      views/new-post.php
  2. +1
    -1
      views/partials/entry-buttons.php

+ 21
- 0
views/new-post.php View File

@ -98,7 +98,28 @@ $(function(){
latitude: position.coords.latitude,
longitude: position.coords.longitude
}, function(response) {
// save and restore the value entered in the custom fields
var custom_eat = $('#custom_eat').val();
var custom_drink = $('#custom_drink').val();
var selected = false;
if($("#custom_drink:focus").length == 1) {
selected = '#custom_drink';
}
if($("#custom_eat:focus").length == 1) {
selected = '#custom_eat';
}
$("#entry-buttons").html(response);
// restore the custom values entered
$('#custom_eat').val(custom_eat);
$('#custom_drink').val(custom_drink);
if(selected) {
$(selected).focus();
}
bind_keyboard_shortcuts();
});

+ 1
- 1
views/partials/entry-buttons.php View File

@ -18,7 +18,7 @@
}
if($type == 'drink' || $type == 'eat') {
echo '<li>';
echo '<input type="text" class="form-control text-custom-'.$type.'" name="custom_'.$type.'" placeholder="Custom '.$noun.'" style="width: 72%; float: left; margin-right: 2px;">';
echo '<input type="text" class="form-control text-custom-'.$type.'" id="custom_'.$type.'" name="custom_'.$type.'" placeholder="Custom '.$noun.'" style="width: 72%; float: left; margin-right: 2px;">';
echo '<input type="submit" class="btn btn-default btn-custom-'.$type.'" value="Post" style="width: 26%; float: right;">';
echo '<div style="clear:both;"></div>';
echo '</li>';

Loading…
Cancel
Save