Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<dom-module id="landing-page">
  <template>
  
    firebase-auth id="fbLogin" provider="anonymous" location="https://xxx.firebaseio.com" user="{{fbUser}}" statusKnown="{{statusKnown}}"></firebase-auth>
    <firebase-collection id="fbLanding" location="https://xxx.firebaseio.com/" dataReady="{{userReady}}"></firebase-collection>
    
    
    <style>
    .form-section {
        background-color: white;
        padding: 14px;
        min-width: 200px; 
    }
     .main {
        height:400px;
        margin:auto;
    }
    .errorClass{
        background-color:red;   
        color:white; 
    }
    </style>
        <div class="main fit">
        <div class="horizontal center layout center-justified">
        <div>
          <h1>Polydeals.com</h1>
          <h4>Something is brewing ... </h4>
          <h4>Fill below to get launch updates</h4>
          <paper-material elevation="3">
              <div class="form-section">
                 <form is="iron-form" id="formPost" method="post">  
                  <gold-email-input required error-message="Please enter a valid email" label="Email Address" value="{{email}}" name="email" id="email" ></gold-email-input>
                    </br>   
                  <paper-button  type="submit" name="submit" raised on-click="buttonClick">Notify Me!</paper-button>
                 </form>
                 
              </div>
          </paper-material>
        </div>
        </div>
        </br>
        <div class="horizontal center layout center-justified">
        <div>
            <a href="http://goo.gl/forms/XoQ47NhGWQ">Online Survey for tagline/slogan</a>
        </div>
        </div>
        </div>
    <footer-page></footer-page>
    <paper-toast id="toast1"></paper-toast> 
  </template>
  <script>
            Polymer({
                is: 'landing-page',
                ready: function() {
                    window.addEventListener('offline', function() {
                    Firebase.goOffline();
                  });
                  window.addEventListener('online', function() {
                    Firebase.goOnline();
                  });
                },
                buttonClick: function() {
                    this.$.fbLogin.login(); //this goes through fine
                    this.$.fbLanding.add({
                        timeStamp:Firebase.ServerValue.TIMESTAMP,
                        email:this.$.email.value
                    }); //this does not go through.
                },
                listeners: {
                'firebase-child-added': 'fireBaseResponse' 
                },
                 fireBaseResponse: function(event) {
                    var sessionId  = event.key();
                    if (!sessionId){
                        this.$.toast1.text="Ah Oh! something went wrong";
                        this.$.toast1.toggleClass('errorClass', true);
                    }
                    else{
                        this.$.toast1.toggleClass('errorClass', false);
                        this.$.toast1.text="Thanks!";
                    }
                    this.$.toast1.show();
                }
            });  
    </script>
</dom-module>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers