Skip to content

Commit

Permalink
add share button and save data for register button
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsonpham authored and johnsonpham committed Jan 30, 2015
1 parent 2cefb8d commit b522aad
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 49 deletions.
4 changes: 2 additions & 2 deletions src/main/webapp/bootcamp/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ ul{
/*background: #fff url(../img/who.png) center bottom no-repeat;*/
background-color: #f7f7f9;
text-align: center;
padding-top: 150px;
padding-top: 130px;
padding-bottom: 50px;
width: 100%;
height: 350px;
Expand All @@ -576,7 +576,7 @@ ul{
width: 80%;
line-height: 22px;
margin: auto;
background-color: #e4e5e5;
background-color: #c9f8fe;
display: inline;
padding: 3px 10px;
-webkit-border-radius: 5px;
Expand Down
Binary file modified src/main/webapp/bootcamp/img/who.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions src/main/webapp/bootcamp/index-vi.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ <h1><a href="#"><img src="img/logo.png" alt="" title="" alt=""> Lean Vietnam Boo
<div class="main-banner-block">
<div class="sns-block">
<ul>
<li><a href="#"><i class="fa fa-facebook-square"></i></a></li>
<li><a href="#"><i class="fa fa-twitter-square"></i></a></li>
<li><a href="#"><i class="fa fa-linkedin-square"></i></a></li>
<li><a href="#"><i class="fa fa-instagram"></i></a></li>
<li><a class="share-facebook" href="https://www.facebook.com/sharer/sharer.php?u=http://www.techlooper.com/bootcamp/index.html=Framework"><i class="fa fa-facebook-square"></i></a></li>
<li><a class="share-twitter" href="https://twitter.com/intent/tweet?url=http://www.techlooper.com/bootcamp/bootcamp/index.html&text=Framework"><i class="fa fa-twitter-square"></i></a></li>
<li><a class="share-linkedin" href="https://www.linkedin.com/cws/share?isFramed=false&url=http://www.techlooper.com/bootcamp/index.html/token=#state=&from_login=true"><i class="fa fa-linkedin-square"></i></a></li>
<li><a class="share-google-plus-1" href="https://plus.google.com/share?url=http://www.techlooper.com/bootcamp/bootcamp/index.html/&gpsrc=frameless"><i class="fa fa-google-plus"></i></a></li>
</ul>
</div>
<div class="price-for-ticket">
Expand Down Expand Up @@ -278,38 +278,38 @@ <h2>Đăng kí tham gia</h2>
<form action="">
<div class="registration-field">
<!-- <label for="txtFirstName">First name <span>*</span></label> -->
<input type="text" id="txtFirstName" placeholder="Tên *" name="firstName">
<input type="text" id="txtFirstName" placeholder="First Name *" name="firstName">
</div>
<div class="registration-field">
<!-- <label for="txtLastName">Last name <span>*</span></label> -->
<input type="text" id="txtLastName" placeholder="Họ *" name="lastName">
<input type="text" id="txtLastName" placeholder="Last Name" name="lastName">
</div>
<div class="registration-field">
<!-- <label for="txtCurrentJob">Current Job Title <span>*</span></label> -->
<input type="text" id="txtCurrentJob" placeholder="Chức vụ hiện nay *" name="currentJobTitle">
<input type="text" id="txtCurrentJob" placeholder="Current Job Title *" name="currentJobTitle">
</div>
<div class="registration-field">
<!-- <label for="txtCompany">Company Name</label> -->
<input type="text" id="txtCompany" placeholder="Tên công ty" name="companyName">
<input type="text" id="txtCompany" placeholder="Company Name *" name="companyName">
</div>
<div class="registration-field">
<!-- <label for="txtEmail">Email address <span>*</span></label> -->
<input type="text" id="txtEmail" placeholder="Địa chỉ Email *" name="emailAddress">
<input type="text" id="txtEmail" placeholder="Email Address *" name="emailAddress">
</div>
<div class="registration-field">
<!-- <label for="txtPhone">Phone number<span>*</span></label> -->
<input type="text" id="txtPhone" placeholder="Số điện thoại *" name="phoneNumber">
<input type="text" id="txtPhone" placeholder="Phone Number *" name="phoneNumber">
</div>
<div class="registration-field">
<!-- <label for="txtLocation">Location <span>*</span></label> -->
<input type="text" id="txtLocation" placeholder="Nơi ở" name="location">
<input type="text" id="txtLocation" placeholder="Location *" name="location">
</div>
<div class="registration-field">
<!-- <label for="txtBirthday">Date of birth</label> -->
<input type="text" id="txtBirthDay" class="birthDay" placeholder="Ngày sinh" name="birthDay">
<input type="text" id="txtBirthDay" class="birthDay" placeholder="Date of birth" name="birthDay">
</div>
<div class="registration-field submit align-center full-box">
<button class="register">Liên hệ với tôi</button>
<button class="register">Contact Me</button>
</div>
</form>
</div>
Expand Down
29 changes: 20 additions & 9 deletions src/main/webapp/bootcamp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Lean Vietnam Boot Camp</title>
<meta name="description" content="">

<!-- Jetpack Open Graph Tags -->
<meta property="og:type" content="website" />
<meta property="og:title" content="Lean Vietnam Bootcamp" />
<meta property="og:url" content="http://www.techlooper.com/bootcamp/" />
<meta property="og:site_name" content="Lean Vietnam Bootcamp" />
<meta property="og:image" content="http://www.techlooper.com/bootcamp/bootcamp/img/what-is-it.png" />
<meta property="og:image:secure_url" content="http://www.techlooper.com/bootcamp/bootcamp/img/what-is-it.png" />
<meta name="twitter:site" content="" />
<meta name="twitter:image" content="http://www.techlooper.com/bootcamp/bootcamp/img/what-is-it.png?w=1400" />
<meta name="twitter:card" content="photo" />
<meta name="twitter:description" content="Photo post." />

<link rel="shortcut icon" href="icon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700&subset=latin,cyrillic-ext,vietnamese,latin-ext,cyrillic' rel='stylesheet' type='text/css'>
Expand Down Expand Up @@ -48,10 +61,10 @@ <h1><a href="#"><img src="img/logo.png" alt="" title="" alt=""> Lean Vietnam Boo
<div class="main-banner-block">
<div class="sns-block">
<ul>
<li><a href="#"><i class="fa fa-facebook-square"></i></a></li>
<li><a href="#"><i class="fa fa-twitter-square"></i></a></li>
<li><a href="#"><i class="fa fa-linkedin-square"></i></a></li>
<li><a href="#"><i class="fa fa-instagram"></i></a></li>
<li><a class="share-facebook" href="https://www.facebook.com/sharer/sharer.php?u=http://www.techlooper.com/bootcamp/index.html=Framework"><i class="fa fa-facebook-square"></i></a></li>
<li><a class="share-twitter" href="https://twitter.com/intent/tweet?url=http://www.techlooper.com/bootcamp/bootcamp/index.html&text=Framework"><i class="fa fa-twitter-square"></i></a></li>
<li><a class="share-linkedin" href="https://www.linkedin.com/cws/share?isFramed=false&url=http://www.techlooper.com/bootcamp/index.html/token=#state=&from_login=true"><i class="fa fa-linkedin-square"></i></a></li>
<li><a class="share-google-plus-1" href="https://plus.google.com/share?url=http://www.techlooper.com/bootcamp/bootcamp/index.html/&gpsrc=frameless"><i class="fa fa-google-plus"></i></a></li>
</ul>
</div>
<div class="price-for-ticket">
Expand Down Expand Up @@ -272,22 +285,21 @@ <h2>Registration Form</h2>
<!--<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin bibendum ipsum eget nulla molestie, vitae ultricies nulla dapibus.</p>-->
<div class="registration-form">
<div class="error-messages"></div>
<form action="">
<div class="registration-field">
<!-- <label for="txtFirstName">First name <span>*</span></label> -->
<input type="text" id="txtFirstName" placeholder="First Name *" name="firstName">
</div>
<div class="registration-field">
<!-- <label for="txtLastName">Last name <span>*</span></label> -->
<input type="text" id="txtLastName" placeholder="Last Name *" name="lastName">
<input type="text" id="txtLastName" placeholder="Last Name" name="lastName">
</div>
<div class="registration-field">
<!-- <label for="txtCurrentJob">Current Job Title <span>*</span></label> -->
<input type="text" id="txtCurrentJob" placeholder="Current Job Title *" name="currentJobTitle">
</div>
<div class="registration-field">
<!-- <label for="txtCompany">Company Name</label> -->
<input type="text" id="txtCompany" placeholder="Company Name" name="companyName">
<input type="text" id="txtCompany" placeholder="Company Name *" name="companyName">
</div>
<div class="registration-field">
<!-- <label for="txtEmail">Email address <span>*</span></label> -->
Expand All @@ -299,7 +311,7 @@ <h2>Registration Form</h2>
</div>
<div class="registration-field">
<!-- <label for="txtLocation">Location <span>*</span></label> -->
<input type="text" id="txtLocation" placeholder="Location" name="location">
<input type="text" id="txtLocation" placeholder="Location *" name="location">
</div>
<div class="registration-field">
<!-- <label for="txtBirthday">Date of birth</label> -->
Expand All @@ -308,7 +320,6 @@ <h2>Registration Form</h2>
<div class="registration-field submit align-center full-box">
<button class="register">Contact Me</button>
</div>
</form>
</div>
</div>
</div>
Expand Down
110 changes: 85 additions & 25 deletions src/main/webapp/bootcamp/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $(document).ready(function() {
menuAnimate();
contentAnimate();
invalidationData();

shareSocial();
});
function menuManager(){
var icMenu = $('.fa-bars'),
Expand Down Expand Up @@ -99,23 +99,22 @@ function contentAnimate(){
}

function invalidationData() {
$('.register').click(function(event){
$('button.register').click(function(event){
event.preventDefault();
//var nameReg = /^[A-Za-z]+$/;
var numberReg = /^[0-9]+$/;
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
var errorContent = '';
var fName = $('#txtFirstName').val(),
lName = $('#txtLastName').val(),
//lName = $('#txtLastName').val(),
job = $('#txtCurrentJob').val(),
email = $('#txtEmail').val(),
phoneNumber = $('#txtPhone').val(),
companyName = $('#txtCompany').val(),
location = $('#txtLocation').val(),
birthday = $('#txtBirthDay').val();
location = $('#txtLocation').val();
//birthday = $('#txtBirthDay').val();

var inputVal = new Array(fName, lName, job, email, phoneNumber);
var inputMessage = new Array("first name", "last name", "current job title" , "email address", "telephone number");
var inputVal = new Array(fName, companyName, job, email, phoneNumber, location);
var inputMessage = new Array("first name", "company name", "current job title" , "email address", "telephone number", 'location');
$('.error-messages').html('');
$.each(inputVal, function( index, value ) {
if(value == ""){
Expand All @@ -128,44 +127,105 @@ function invalidationData() {
});
if(phoneNumber != '' && !numberReg.test(phoneNumber)){
if(errorContent == ''){
errorContent = 'Numbers only';
errorContent = 'Telephone Numbers only';
}else{
errorContent = errorContent + ', Numbers only';
errorContent = errorContent + ', Telephone Numbers only';
}
}
if(email != '' && !emailReg.test(email)){
if(errorContent == ''){
errorContent = 'Please enter a valid email address';
errorContent = 'Email address is not valid';
}else{
errorContent = errorContent+ ', Please enter a valid email address';
errorContent = errorContent+ ', Email address is not valid';
}
}
if(errorContent != ''){
$('.error-messages').append('Please enter your <strong>' + errorContent+ '</strong>');
}else{
var userInfo = '{"firstName": "' + fName + '", "lastName" : "' + lName + '", "currentJobTitle": "' + job + '", "emailAddress" : "' + email + '", "phoneNumber": "' + phoneNumber + '", "companyName" : "' + companyName + '", "location" : "' + location + '", "birthday" : "' + birthday + '"}';
sendData(userInfo);
var today = currentDate();
var subject = today + ' – LeanVietnamBootCamp - ' + fName;
$.ajax({
type: 'POST',
url: 'http://leads.navigosgroup.com/api/leads',
contentType: "application/json; charset=utf-8",
data: JSON.stringify({
Subject: subject,
EmailAddress1: email,
Telephone1: phoneNumber,
"FirstName": fName,
"CompanyName": companyName,
Qntt_Source: 'ONLINE',
LeadQualifyCode: 'HOT',
Qntt_LegalName: companyName,
CampaignId: 'ONLINE-LeanVietnamBootCamp',
Qntt_City: location
})
, success: function (data) {
resetField();
alert('Thank you for registering for Lean Vietnam Bootcamp');
}, error: function (err) {
switch (err.status) {
case 500: // internal server error or duplication found
console.log(err.responseJSON.Message);
break;
case 400: // validation failed. The error details is the array ModelState
$.each(err.responseJSON.ModelState, function (index, validationError) {
console.log(validationError);
});
break;
default:
console.debug(err.responseJSON);
break;
}
}
});
}

});
}
function sendData(userInfo){
$.ajax({
type: 'POST',
url: 'users',
data: userInfo,
success: function(data) {resetField();alert('Thank you'); },
contentType: "application/json; charset=UTF-8",
dataType: 'json'
});
}
function resetField(){
$('#txtFirstName').val(''),
$('#txtLastName').val(''),
$('#txtCurrentJob').val(''),
$('#txtEmail').val(''),
$('#txtPhone').val(''),
$('#txtPhone').val(''),
$('#txtCompany').val(''),
$('#txtLocation').val(''),
$('#txtBirthDay').val('');
}

function currentDate(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();

if(dd<10) {
dd='0'+dd;
}

if(mm<10) {
mm='0'+mm;
}

return today = mm+'/'+dd+'/'+yyyy;
}

function shareSocial(){
$('a.share-facebook').on('click', function() {
window.open(jQuery(this).attr('href'), 'wpcomfacebook', 'menubar=1,resizable=1,width=600,height=400');
return false;
});
$('a.share-linkedin').on('click', function() {
window.open(jQuery(this).attr('href'), 'wpcomlinkedin', 'menubar=1,resizable=1,width=580,height=450');
return false;
});
$('a.share-google-plus-1').on('click', function() {
window.open(jQuery(this).attr('href'), 'wpcomgoogle-plus-1', 'menubar=1,resizable=1,width=480,height=550');
return false;
});
$('a.share-twitter').on('click', function() {
window.open(jQuery(this).attr('href'), 'wpcomtwitter', 'menubar=1,resizable=1,width=600,height=350');
return false;
});
}

0 comments on commit b522aad

Please sign in to comment.