<commit_before><% content_for :javascript_includes do %>
  <script type="text/javascript"
    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCtWBCKJwtHq7ME82vk3d7eUsRknvzgrAQ&sensor=false&libraries=places">
  </script>
<% end %>

<div id="new_place_holder">
  <div class="callout"><%= t('place.add_new_banner') %></div>
  <div class="story_text">
    <%= form_for @place, :url =>{:action => "confirm"} do |f| %>
      <% if @place.errors.any? %>
        <div id="error_explanation">
          <p><%= t('place.fix') %></p>
          <ul class="error_reasons">
          <% @place.errors.full_messages.each do |msg| %>
            <li><%= msg %></li>
          <% end %>
          </ul>
        </div>
      <% end %>
      
      <div class="standout">
        <p class="label emphasize"><%= t'place.name' %></p>
        <%= f.text_field :name, :class => "entry_field" %>
      </div>
      
      <%= f.hidden_field :address_components, :id=>"address_components" %>
      <%= f.hidden_field :accurate_address, :id=>"accurate_address" %>
      
      <div class="standout">
        <p class="label emphasize"><%= t'place.address' %></p>
        <div>
          <input id="map_source" name="address" type="text" size="100" class="entry_field"/> 
          <span id="accurate_address_label" style="display:none"><%= t'place.approximate_address' %></span>
        </div>
      </div>
      
      <div id="selector_map" class="map_style" style="height:300px; width: 488px;">
        <div id="map_canvas" style="width:100%; height:100%"></div>
        <div id="latlng_holder"><%= t('place.latlng') %> <span id="latlng"></span></div>
      </div>
      
      <div class="field">
        <% if @place.location %>
          <input id="lat" name="place[location][]" type="hidden" value="<%= @place.location[0] %>">
          <input id="lng" name="place[location][]" type="hidden" value="<%= @place.location[1] %>">
        <% else %>
          <input id="lat" name="place[location][]" type="hidden" value="" />
          <input id="lng" name="place[location][]" type="hidden" value="" />
        <% end %>
      </div>
      <div id="map"></div>
      
      <div class='pick_category'>
        <% if @place.errors && @place.errors.keys().include?(:venue_types) %>
          <span class="missing">
        <% end %>
        <%= t'place.category' %>
        <% if @place.errors && @place.errors.keys().include?(:venue_types) %>
          </span>
        <% end %>
      </div>
      
      <%  @place.venue_types.each do |venue| %>
        <%= hidden_field_tag "place[venue_types][]", venue, :id => "place_venue_type" %>
      <% end %>
      
      <div id="create_or_cancel">
        <span class="cancel">
          <a href="<%= search_path :input => @place.name, :lat => @lat, :lng => @lng %>"><%= t ('place.cancel') %></a>
        </span>
        <input id="save_place_button" class="submit" name="commit" type="button" value="Save">
      </div>
    <% end %>
  </div>
</div>

<% content_for :javascript do %>

  <script type="text/javascript">
    var main_map;
    var t;

     function updateGeocode(){
        clearTimeout( t );
         var latlng = main_map.getCenter();
         geocoder = new google.maps.Geocoder();

         geocoder.geocode({ 'latLng': latlng }, function (results, status) {

            // This is checking to see if the Geoeode Status is OK before proceeding
            if (status == google.maps.GeocoderStatus.OK && results[0]){
                $("#address_components").val( JSON.stringify( results[0].address_components ) );
                //This is placing the returned address in the 'Address' field on the HTML form
                $("#map_source").val( results[0].formatted_address );
                if (results[0].geometry.location_type == google.maps.GeocoderLocationType.ROOFTOP ){
                    $("#accurate_address").val( true );
                    $("#accurate_address_label").hide();
                } else {
                    $("#accurate_address").val( false );
                    $("#accurate_address_label").show();
                }
            } else {
                 $("#address_components").val( "{}" );
                //This is placing the returned address in the 'Address' field on the HTML form
                $("#map_source").val( "" );
                $("#accurate_address_test").html("INVALID");
                $("#accurate_address").val( false );
            }
        });

    }

    function centerReticle(){
        clearTimeout( t );
        lat = main_map.getCenter().lat();
        lng = main_map.getCenter().lng();
        $("#lat").val(lat);
        $("#lng").val(lng);
        $("#latlng").html( lat.toFixed(4) +","+lng.toFixed(4) );
        reticleMarker.setPosition(main_map.getCenter());
        t = setTimeout("updateGeocode()",1500);
    }

    $(document).ready(function(){

        $("#save_place_button").click(function(){
            $(".category_select").remove();  //necessary to prevent rack weirdness
            $("#new_place").submit();
        });

        var options = {empty_value: "", select_class: 'category_select', preselect: $("#place_venue_type").val() };

        $('#place_venue_type').optionTree(<%= raw @categories.to_json %>, options);
        var reticleImage = new google.maps.MarkerImage(
            '/images/cross-hairs.gif',            // marker image
            new google.maps.Size(27, 27),    // marker size
            new google.maps.Point(0,0),      // marker origin
            new google.maps.Point(13, 13));  // marker anchor point
          var reticleShape = {
            coords: [32,32,32,32],           // 1px
            type: 'rect'                     // rectangle
          };

        if ( $("#lat").val() != "" && $("#lng").val() != "" ){
            latlng = new google.maps.LatLng($("#lat").val(), $("#lng").val());
        } else {
            latlng = new google.maps.LatLng(default_lat, default_lng);
        }

        var myOptions = {
          center: latlng,
          zoom: 15,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        main_map = new google.maps.Map(document.getElementById("map_canvas"),
            myOptions);

        reticleMarker = new google.maps.Marker({
            position: latlng,<commit_msg>rename the latlng variable, as it seemed to be breaking in ie8<commit_after><% content_for :javascript_includes do %>
  <script type="text/javascript"
    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCtWBCKJwtHq7ME82vk3d7eUsRknvzgrAQ&sensor=false&libraries=places">
  </script>
<% end %>

<div id="new_place_holder">
  <div class="callout"><%= t('place.add_new_banner') %></div>
  <div class="story_text">
    <%= form_for @place, :url =>{:action => "confirm"} do |f| %>
      <% if @place.errors.any? %>
        <div id="error_explanation">
          <p><%= t('place.fix') %></p>
          <ul class="error_reasons">
          <% @place.errors.full_messages.each do |msg| %>
            <li><%= msg %></li>
          <% end %>
          </ul>
        </div>
      <% end %>
      
      <div class="standout">
        <p class="label emphasize"><%= t'place.name' %></p>
        <%= f.text_field :name, :class => "entry_field" %>
      </div>
      
      <%= f.hidden_field :address_components, :id=>"address_components" %>
      <%= f.hidden_field :accurate_address, :id=>"accurate_address" %>
      
      <div class="standout">
        <p class="label emphasize"><%= t'place.address' %></p>
        <div>
          <input id="map_source" name="address" type="text" size="100" class="entry_field"/> 
          <span id="accurate_address_label" style="display:none"><%= t'place.approximate_address' %></span>
        </div>
      </div>
      
      <div id="selector_map" class="map_style" style="height:300px; width: 488px;">
        <div id="map_canvas" style="width:100%; height:100%"></div>
        <div id="latlng_holder"><%= t('place.latlng') %> <span id="latlng"></span></div>
      </div>
      
      <div class="field">
        <% if @place.location %>
          <input id="lat" name="place[location][]" type="hidden" value="<%= @place.location[0] %>">
          <input id="lng" name="place[location][]" type="hidden" value="<%= @place.location[1] %>">
        <% else %>
          <input id="lat" name="place[location][]" type="hidden" value="" />
          <input id="lng" name="place[location][]" type="hidden" value="" />
        <% end %>
      </div>
      <div id="map"></div>
      
      <div class='pick_category'>
        <% if @place.errors && @place.errors.keys().include?(:venue_types) %>
          <span class="missing">
        <% end %>
        <%= t'place.category' %>
        <% if @place.errors && @place.errors.keys().include?(:venue_types) %>
          </span>
        <% end %>
      </div>
      
      <%  @place.venue_types.each do |venue| %>
        <%= hidden_field_tag "place[venue_types][]", venue, :id => "place_venue_type" %>
      <% end %>
      
      <div id="create_or_cancel">
        <span class="cancel">
          <a href="<%= search_path :input => @place.name, :lat => @lat, :lng => @lng %>"><%= t ('place.cancel') %></a>
        </span>
        <input id="save_place_button" class="submit" name="commit" type="button" value="Save">
      </div>
    <% end %>
  </div>
</div>

<% content_for :javascript do %>

  <script type="text/javascript">
    var main_map;
    var t;

     function updateGeocode(){
        clearTimeout( t );
         var latlng_center = main_map.getCenter();
         geocoder = new google.maps.Geocoder();

         geocoder.geocode({ 'latLng': latlng_center }, function (results, status) {

            // This is checking to see if the Geoeode Status is OK before proceeding
            if (status == google.maps.GeocoderStatus.OK && results[0]){
                $("#address_components").val( JSON.stringify( results[0].address_components ) );
                //This is placing the returned address in the 'Address' field on the HTML form
                $("#map_source").val( results[0].formatted_address );
                if (results[0].geometry.location_type == google.maps.GeocoderLocationType.ROOFTOP ){
                    $("#accurate_address").val( true );
                    $("#accurate_address_label").hide();
                } else {
                    $("#accurate_address").val( false );
                    $("#accurate_address_label").show();
                }
            } else {
                 $("#address_components").val( "{}" );
                //This is placing the returned address in the 'Address' field on the HTML form
                $("#map_source").val( "" );
                $("#accurate_address_test").html("INVALID");
                $("#accurate_address").val( false );
            }
        });

    }

    function centerReticle(){
        clearTimeout( t );
        lat = main_map.getCenter().lat();
        lng = main_map.getCenter().lng();
        $("#lat").val(lat);
        $("#lng").val(lng);
        $("#latlng").html( lat.toFixed(4) +","+lng.toFixed(4) );
        reticleMarker.setPosition(main_map.getCenter());
        t = setTimeout("updateGeocode()",1500);
    }

    $(document).ready(function(){

        $("#save_place_button").click(function(){
            $(".category_select").remove();  //necessary to prevent rack weirdness
            $("#new_place").submit();
        });

        var options = {empty_value: "", select_class: 'category_select', preselect: $("#place_venue_type").val() };

        $('#place_venue_type').optionTree(<%= raw @categories.to_json %>, options);
        var reticleImage = new google.maps.MarkerImage(
            '/images/cross-hairs.gif',            // marker image
            new google.maps.Size(27, 27),    // marker size
            new google.maps.Point(0,0),      // marker origin
            new google.maps.Point(13, 13));  // marker anchor point
          var reticleShape = {
            coords: [32,32,32,32],           // 1px
            type: 'rect'                     // rectangle
          };

        if ( $("#lat").val() != "" && $("#lng").val() != "" ){
            latlng_center = new google.maps.LatLng($("#lat").val(), $("#lng").val());
        } else {
            latlng_center = new google.maps.LatLng(default_lat, default_lng);
        }

        var myOptions = {
          center: latlng_center,
          zoom: 15,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        main_map = new google.maps.Map(document.getElementById("map_canvas"),
            myOptions);

        reticleMarker = new google.maps.Marker({
            position: latlng_center,
{'fraction_non_alphanumeric': 0.18380554020992818, 'fraction_numerical': 0.008444479520164154, 'mean_word_length': 2.2195121951219514, 'pattern_counts': {'":': 0, '<': 187, '<?xml version=': 0, '>': 205, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5158652', 'n_tokens_mistral': 4068, 'n_tokens_neox': 3844, 'n_words': 742}