Skip to content

Commit

Permalink
Added Firebase saving.
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckh committed Sep 2, 2014
1 parent 3046b04 commit 3c9c386
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
33 changes: 14 additions & 19 deletions elements/beta-form/beta-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@
url="//api.madmimi.com/audience_lists/01-Actionplanr Web Beta Invite/[email protected]&api_key=xxx&[email protected]&callback=?"
></polymer-jsonp> -->

<firebase-element id="add_firebase" on-data-change="{{dataChange}}" data="{{betaInvite}}" location="https://beta-invite.firebaseio.com" keys="{{keys}}" log></firebase-element>
<!-- <firebase-element id="add_firebase" on-data-change="{{dataChange}}" data="{{betaInvite}}" location="https://beta-invite.firebaseio.com/requests" keys="{{keys}}" log></firebase-element> -->

<core-ajax id="add_madmimi_request"
url="//actionplanr.com/beta-signup/app/madmimi.php?email={{email}}"
url="//actionplanr.com/beta-signup/app/madmimi.php?email={{email}}&create_at={{timestamp}}"
handleAs="text"
on-core-response="{{ajaxResponse}}"
></core-ajax>
on-core-response="{{ajaxResponse}}"></core-ajax>

<link rel="stylesheet" href="beta-form.css">

<div id="container_div" vertical layout center>
<h3 id="title">Actionplanr Beta coming soon by invitation only. <br>Get yours:</h3>
<div id="form_div" horizontal layout center>
<paper-input id="email_input" label="Input Email" type="email" value="[email protected]"
<paper-input id="email_input" label="Input Email" type="email"
validate="^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$" error=" "
required></paper-input><br>
<paper-fab icon="check" class="fab-success green" on-click="{{saveData}}" style="background: #D0F5A9;" ></paper-fab>
Expand Down Expand Up @@ -58,14 +57,10 @@ <h2 id="success_h2">Thank you for requesting <br>a beta invite!</h2>

ready: function() {
this.status = 'blank'; // blank, add, loaded, changed, added, saved, cancelled
this.email = "[email protected]";
this.email = "";
this.timestamp = new Date();
},

// responseChanged: function(oldValue) {
// console.log(this.response);
// },


ajaxResponse: function(event, response) {
console.log("ajaxResponse: ", response);
},
Expand All @@ -82,15 +77,20 @@ <h2 id="success_h2">Thank you for requesting <br>a beta invite!</h2>
this.email = "";
} else {
this.email = email;
//this.$.add_madmimi_request_jsonp.go();
this.timestamp = new Date();
this.$.add_madmimi_request.go();

new Firebase('https://beta-invite.firebaseio.com/requests').push({
email: email,
create_at: timestamp.toLocaleString(),
create_at_full: timestamp.toString()
});

console.log('saveData email: ' + this.$.email_input.value, timestamp.toLocaleString());
this.status = 'saved';
this.$.form_div.hidden = true;
this.$.title.hidden = true;
this.$.success.hidden = false;
//this.addEntry(email);
this.$.base.commitProperty(email);

}
},
Expand All @@ -100,11 +100,6 @@ <h2 id="success_h2">Thank you for requesting <br>a beta invite!</h2>
//this.$.section_title.value = "SECTION TITLE TEST"
},

addEntry: function(value) {
this.$.base.push({email: value});
this.$.email_input.value = "";
}

});

})();
Expand Down
5 changes: 1 addition & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@

<div class="hero-unit">
<img src="/images/Actionplanr300.png">
<h1 style="margin-top: -20px; font-size: 1.9em"><span style="color: 91b52c;">anywhere <span style="color: #007be3">anytime<span></h1>
<!-- <h2 style="font-size: 2.5em">Signup for Beta Invite</h2> -->

<!-- <p>You now have</p>-->
<h1 style="margin-top: -20px; font-size: 1.9em"><span style="color: 91b52c;">anywhere</span> <span style="color: #007be3">anytime</span></h1>
<beta-form></beta-form>
</div>

Expand Down
5 changes: 3 additions & 2 deletions madmimi-template.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php
$username = "[email protected]";
$api_key = "appkey value";
$email = $_GET['email'];;
$email = $_GET['email'];
$create_at = $_GET['create_at'];
$listname = "Madmimi List Name";
$ch = curl_init('https://madmimi.com/audience_lists/'.$listname.'/add');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS,"username=".$username."&api_key=".$api_key."&email=".$email);
curl_setopt($ch, CURLOPT_POSTFIELDS,"username=".$username."&api_key=".$api_key."&email=".$email."&create_at=".$create_at);
$response = curl_exec($ch);
echo "Added: ", $email;
?>

0 comments on commit 3c9c386

Please sign in to comment.