1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-03 19:57:57 +02:00

Monstra Dashboard - GA update #204

This commit is contained in:
metal_gvc
2014-01-25 00:24:02 +02:00
parent 2ba945313f
commit 76c71c8174
2 changed files with 27 additions and 7 deletions

View File

@@ -11,14 +11,14 @@ $.monstra.ganalytics = {
authScopes: 'https://www.googleapis.com/auth/analytics.readonly'
},
_gaAreas: '#authOk,#authFail,#gaSettings,#gaLoading',
_gaAreas: '#authOk,#authFail,#gaSettings,#gaLoading,#reauthError,#gaHelpLink',
_startDate: moment().subtract('days', 29),
_endDate: moment(),
init: function(data){
$.extend(this.conf, data);
$('#gaSettingsLink').click(function(){
$.monstra.ganalytics.show('#gaSettings');
$('.gaSettingsLink').click(function(){
$.monstra.ganalytics.show('#gaSettings,#gaHelpLink');
});
},
@@ -94,7 +94,7 @@ $.monstra.ganalytics = {
gaReportingResults: function(res){
if (typeof res.error != 'undefined' && typeof res.error.message != 'undefined') {
$.monstra.ganalytics.showError(res.error.message);
$.monstra.ganalytics.showError(res.error.message, res.error.code);
return;
}
@@ -148,8 +148,14 @@ $.monstra.ganalytics = {
$(selector).removeClass('hide').show();
},
showError: function(msg){
showError: function(msg, errCode){
if (typeof errCode !== 'undefined' && errCode == 403) {
$.monstra.ganalytics.show('#reauthError,#gaHelpLink');
} else {
$.monstra.ganalytics.show('#gaHelpLink');
}
$('#gaAlerts').html(msg);
$('#authOk').addClass('hide');
},
setVisits: function(val){

View File

@@ -33,7 +33,10 @@
<script src="https://apis.google.com/js/client.js?onload=glibOnloadHandle"></script>
<div class="well dashboard-well">
<div class="row"><div class="col-md-12"><h4><?php echo __('Goggle Analytics', 'system'); ?></h4></div></div>
<div class="row">
<div class="col-md-10"><h4><?php echo __('Goggle Analytics', 'system'); ?></h4></div>
<div class="col-md-2"><a href="#" class="gaSettingsLink"><?php echo __('Settings', 'system'); ?></a></div>
</div>
<div class="row">
<div class="col-md-12">
@@ -61,7 +64,6 @@
</div>
</div>
<div class="col-md-3">
<div><a href="javascript:void(0);" id="gaSettingsLink">Settings</a></div>
<div><h3>Today</h3></div>
<div>Visits:<span id="gaVisits"></span></div>
<div>Visitors:<span id="gaVisitors"></span></div>
@@ -75,6 +77,12 @@
</div>
</div>
<div id="reauthError" class="row hide">
<div class="col-md-12">
<?php echo __('Please check your analytics settings then exit from google account and authorize with right google analytics account.', 'system'); ?>
</div>
</div>
<div id="gaSettings" class="row hide">
<div class="col-md-12">
<form method="POST">
@@ -94,6 +102,12 @@
</div>
</div>
<div id="gaHelpLink" class="row hide">
<div class="col-md-12">
<br />Google Analytics help page: <a href="https://support.google.com/analytics/?hl=en" target="_blank">https://support.google.com/analytics/?hl=en</a>
</div>
</div>
</div>
</div>
</div>