Skip to content

Commit

Permalink
Fix social media sharing & Display Refs #26
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuNls committed Jun 17, 2015
1 parent 1e2d485 commit da21ece
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 26 deletions.
1 change: 1 addition & 0 deletions application/config/routes.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

$route['reset-password/(:any)'] = "home/resetPassword/$1";
$route['logout'] = "home/logout";
$route['result'] = "home/result";
$route['about'] = "home/about";
$route['help'] = "home/help";
$route['contact'] = "home/contact";
Expand Down
27 changes: 17 additions & 10 deletions application/controllers/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,29 @@ function index()
if(!$this->agent->is_mobile()){
array_push($this->_headerData['javaScripts'], "home.logic", "watch.animation");
}else{
array_push($this->_headerData['javaScripts'], "home.logic.mobile");
array_push($this->_headerData['javaScripts'], "home.logic.mobile");
}

$this->load->view('header', $this->_headerData);
$this->load->view('home', $this->homeMessage());
$this->load->view('footer');
}

function result(){

if(!$this->agent->is_mobile()){
array_push($this->_headerData['javaScripts'], "home.logic", "watch.animation");
}else{
array_push($this->_headerData['javaScripts'], "home.logic.mobile");
}

$this->_headerData["meta_img"] = img_url("accuracy.jpg");

$this->load->view('header', $this->_headerData);
$this->load->view('home', $this->homeMessage());
$this->load->view('footer');
}

private function homeMessage(){

$rand = rand ( 0 , 3 );
Expand Down Expand Up @@ -75,15 +90,7 @@ function about()
$this->load->view('about');
$this->load->view('footer');
}

/*function help()
{
$this->_headerData['headerClass'] = 'blue';
$this->load->view('header', $this->_headerData);
$this->load->view('help');
$this->load->view('footer');
}*/


function contact()
{
$this->_headerData['headerClass'] = 'blue';
Expand Down
7 changes: 5 additions & 2 deletions application/views/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
<html lang="en">
<head>
<title>Toolwatch • <?php if(isset($title)) echo $title; else echo 'Easily measure and track the accuracy of your mechanical watch'; ?></title>
<meta property="og:title" content="<?php if(isset($title)) echo $title; else echo 'Easily measure and track the accuracy of your mechanical watch'; ?>">
<meta name="keywords" content="toolwatch, toolwatchapp, accuracy, precision, measure, mechanical watch, manual winding, automatic winding">
<meta name="description" content="Toolwatch makes it super easy to measure the accuracy of any mechanical watch. Keep your watch’s accuracy at its best with Toolwatch.">
<meta property="og:description" content="Toolwatch makes it super easy to measure the accuracy of any mechanical watch. Keep your watch’s accuracy at its best with Toolwatch.">

<meta property="og:title" content="<?php if(isset($title)) echo $title; else echo 'Easily measure and track the accuracy of your mechanical watch'; ?>" />
<meta property="og:description" content="<?php if(isset($meta_description)) echo $meta_description; else echo 'Toolwatch makes it super easy to measure the accuracy of any mechanical watch. Keep your watch’s accuracy at its best with Toolwatch.'; ?>" />
<meta property="og:image" content="<?php if(isset($meta_img)) echo $meta_img; else echo img_url('logo-blue.png'); ?>" />

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='//fonts.googleapis.com/css?family=Raleway:500,700' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Raleway:700,400' rel='stylesheet' type='text/css'>
Expand Down
6 changes: 3 additions & 3 deletions application/views/measure/get-accuracy.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
<center><p><br />We are happy to have you around, help us spread the love for mechanical watches and share your accuracy on:</p></center>

<div class="col-sm-12">
<div class="share-button" id="twitter" data-url="<?php echo base_url();?>" data-text="My #<?php echo $selectedWatch->brand;?> runs at {WatchAccuracy} on @Toolwatch"></div>
<div class="share-button" id="facebook" data-url="<?php echo base_url();?>" data-text="My #<?php echo $selectedWatch->brand;?> runs at {WatchAccuracy} on @ToolwatchApp"></div>
<div class="share-button" id="googleplus" data-url="<?php echo base_url();?>" data-text="My #<?php echo $selectedWatch->brand;?> runs at {WatchAccuracy} on @ToolwatchApp"></div>
<div class="share-button" id="twitter" data-url="<?php echo base_url() . '/result' ;?>" data-text="My #<?php echo $selectedWatch->brand;?> runs at {WatchAccuracy} spd on @Toolwatch"></div>
<div class="share-button" id="facebook" data-url="<?php echo base_url() . '/result' ;?>" data-text="My #<?php echo $selectedWatch->brand;?> runs at {WatchAccuracy} spd on @ToolwatchApp"></div>
<div class="share-button" id="googleplus" data-url="<?php echo base_url() . '/result' ;?>" data-text="My #<?php echo $selectedWatch->brand;?> runs at {WatchAccuracy} spd on @ToolwatchApp"></div>
</div>


Expand Down
2 changes: 2 additions & 0 deletions assets/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ $(document).ready(function()
$(this).attr("data-text", $(this).attr("data-text").replace("{WatchAccuracy}", result.accuracy));
});

initShareButton();

}
}
else
Expand Down
4 changes: 4 additions & 0 deletions assets/js/home.logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ $( document ).ready(function() {
activeIndex = activeIndex +1;
}

if(activeIndex === -1){
activeIndex = 0;
}

if(activeIndex!==0){
$('header').addClass('blue');
}else{
Expand Down
5 changes: 3 additions & 2 deletions assets/js/jquery.sharrre.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@
window.open("https://plus.google.com/share?hl="+opt.buttons.googlePlus.lang+"&url="+encodeURIComponent((opt.buttons.googlePlus.url !== '' ? opt.buttons.googlePlus.url : opt.url)), "", "toolbar=0, status=0, width=900, height=500");
},
facebook: function(opt){
window.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((opt.buttons.facebook.url !== '' ? opt.buttons.facebook.url : opt.url))+"&t="+opt.text+"", "", "toolbar=0, status=0, width=900, height=500");

window.open("https://www.facebook.com/dialog/feed?%20app_id=807383452677000%20&display=popup&name="+encodeURIComponent(opt.text)+"&link=http://www.toolwatch.io/result&redirect_uri=http://www.toolwatch.io/", "", "toolbar=0, status=0, width=900, height=500");
},
twitter: function(opt){
window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : ''), "", "toolbar=0, status=0, width=650, height=360");
Expand Down Expand Up @@ -541,7 +542,7 @@
linkedin: {site: 'linkedin', action: 'share'},
pinterest: {site: 'pinterest', action: 'pin'}
};
_gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]);
ga('send', 'event', '_trackSocial', tracking[site].site);
}
};

Expand Down
10 changes: 1 addition & 9 deletions assets/js/sharrre.logic.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
$( document ).ready(function() {

function initShareButton(){
$('#googleplus').sharrre({
share: {
googlePlus: true
Expand Down Expand Up @@ -37,11 +36,4 @@ $( document ).ready(function() {
api.openPopup('facebook');
}
});

});



function generateImage(){

}

0 comments on commit da21ece

Please sign in to comment.