<commit_before><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="../../bower_components/polymer/polymer.html">

<dom-module id="my-ajaxelement">
  <template>
    <style>
      :host {
        display: block;
      }
      .cityData{
        margin-bottom: 15px;
        padding: 30px 24px;
      }
    </style>
    <iron-ajax
        auto
        url="http://api.openweathermap.org/data/2.5/forecast"
        params='{"q":"74379", "cnt":"20", "appid":"44db6a862fba0b067b1930da0d769e98"}'
        handle-as="json"
        on-response="handleResponse"
        last-response="{{ajaxResponse}}">
    </iron-ajax>

    <paper-material class="headMaterial cityData">
      <paper-input is="iron-input" bind-value="{{cityName}}"></paper-input>
      <br/>
      <b>{{cityName}}</b>
       <paper-button raised>Serach</paper-button>
    </paper-material>


    <paper-material class="cityData" elevation="3">
      ID: <span>{{ajaxResponse.city.id}}</span><br/>
      NAME: <span>{{ajaxResponse.city.name}}</span><br/>
      LONG: <span>{{ajaxResponse.city.coord.lon}}</span><br/>
      LAT: <span>{{ajaxResponse.city.coord.lat}}</span><br/>
      COUNTRY: <span>{{ajaxResponse.city.country}}</span><br/>
      COUNT: <span>{{ajaxResponse.cnt}}</span><br/>
      Messeage: <span>{{ajaxResponse.message}}</span><br/>
      <span>{{ajaxResponse.cod}}</span><br/>
    </paper-material>
      <template is="dom-repeat" items="{{ajaxResponse.list}}">
        <paper-material class="cityData" elevation="1">
          <span>{{item.dt}}</span><br/>
          <span>{{item.dt_txt}}</span><br/>
          <span>{{item.main.temp}}</span><br/>
           <template is="dom-repeat" items="{{item.weather}}">
             Condition: <span>{{item.main}}</span><br/>
              Condition: <span>{{item.description}}</span><br/>
            </template>
     </paper-material>
     </template>

  </template>
  <script>
  (function() {
    'use strict';

    Polymer({
      is: 'my-ajaxelement',

      properties: {
        foo: {
          type: String,
          value: 'hallo',
          notify: true
        }
      },
      handleResponse: function(){
      console.log('handleResponse');
      }

    });<commit_msg>Update Search for City.<commit_after><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="../../bower_components/polymer/polymer.html">

<dom-module id="my-ajaxelement">
  <template>
    <style>
      :host {
        display: block;
      }
      .cityData{
        margin-bottom: 15px;
        padding: 30px 24px;
      }
    </style>
    <iron-ajax
        id="weather"
        auto
        url="http://api.openweathermap.org/data/2.5/forecast"
        params="{{weatherParams}}"
        handle-as="json"
        on-response="handleResponse"
        last-response="{{ajaxResponse}}">
    </iron-ajax>

    <paper-material class="headMaterial cityData">
      <paper-input is="iron-input" bind-value="{{cityName}}"></paper-input>
      <br/>
       <paper-button on-click="updateWeather" raised>Serach</paper-button>
    </paper-material>


    <paper-material class="cityData" elevation="3">
      ID: <span>{{ajaxResponse.city.id}}</span><br/>
      NAME: <span>{{ajaxResponse.city.name}}</span><br/>
      LONG: <span>{{ajaxResponse.city.coord.lon}}</span><br/>
      LAT: <span>{{ajaxResponse.city.coord.lat}}</span><br/>
      COUNTRY: <span>{{ajaxResponse.city.country}}</span><br/>
      COUNT: <span>{{ajaxResponse.cnt}}</span><br/>
      Messeage: <span>{{ajaxResponse.message}}</span><br/>
      <span>{{ajaxResponse.cod}}</span><br/>
    </paper-material>
      <template is="dom-repeat" items="{{ajaxResponse.list}}">
        <paper-material class="cityData" elevation="1">
          <span>{{item.dt}}</span><br/>
          <span>{{item.dt_txt}}</span><br/>
          <span>{{item.main.temp}}</span><br/>
           <template is="dom-repeat" items="{{item.weather}}">
             Condition: <span>{{item.main}}</span><br/>
              Condition: <span>{{item.description}}</span><br/>
            </template>
     </paper-material>
     </template>

  </template>
  <script>
  (function() {
    'use strict';

    Polymer({
      is: 'my-ajaxelement',

      properties: {
        foo: {
          type: String,
          value: 'hallo',
          notify: true
        },
        weatherParams:{
          type: Object,
          value: function(){
              return {
                q: "New York",
                cnt: "20",
                appid: "44db6a862fba0b067b1930da0d769e98"
              }
        },
        notify: true
      }
      },

      handleResponse: function(){
      console.log('handleResponse');
      },
      updateWeather: function(){
        document.getElementById("weather").generateRequest();
        var cityName = document.querySelector("input[is=iron-input]").value;

        this.weatherParams = {
          q: cityName,
          cnt: "20",
          appid: "44db6a862fba0b067b1930da0d769e98"
        }

      },
    });
{'fraction_non_alphanumeric': 0.17148135707087672, 'fraction_numerical': 0.016627477326167282, 'mean_word_length': 2.5132743362831858, 'pattern_counts': {'":': 3, '<': 133, '<?xml version=': 0, '>': 133, 'https://': 0, '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': '4731858', 'n_tokens_mistral': 1927, 'n_tokens_neox': 1756, 'n_words': 356}