Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

made authorize button configurable

  • Loading branch information...
commit 6c39ee49365cd3b89042c03872d4ee7a096bdfed 1 parent 6195686
@pulse00 pulse00 authored
View
5 Resources/public/js/gdash-1.0.js
@@ -83,6 +83,7 @@ gadash.configKeys = function(settings) {
gadash.apiKey = settings.apiKey;
gadash.clientId = settings.clientId;
gadash.tableId = settings.tableId;
+ gadash.authorizeButton = settings.authorizeButton || 'authorize-button';
};
@@ -126,7 +127,7 @@ gadash.handleAuthResult = function(authResult) {
* command queue only happens once.
*/
gadash.handleAuthorized = function() {
- var authorizeButton = document.getElementById('authorize-button');
+ var authorizeButton = document.getElementById(gadash.authorizeButton);
authorizeButton.style.visibility = 'hidden';
gadash.executeCommandQueue();
@@ -149,7 +150,7 @@ gadash.onAuthorized = function() {
* click handler to the authorize-button.
*/
gadash.handleUnAuthorized = function() {
- var authorizeButton = document.getElementById('authorize-button');
+ var authorizeButton = document.getElementById(gadash.authorizeButton);
authorizeButton.style.visibility = '';
authorizeButton.onclick = gadash.handleAuthClick;
gadash.onUnauthorized();
View
18 Resources/views/Analytics/dashboard.html.twig
@@ -3,13 +3,21 @@
<script src="https://apis.google.com/js/client.js?onload=gadashInit"></script>
<script>
- gadash.configKeys({
- 'apiKey': '{{ google_analytics.apiKey }}',
- 'clientId':'{{ google_analytics.clientId }}',
- 'tableId': '{{ google_analytics.tableId }}'
- });
+ var config = {
+ 'apiKey': '{{ google_analytics.apiKey }}',
+ 'clientId':'{{ google_analytics.clientId }}',
+ 'tableId': '{{ google_analytics.tableId }}'
+ };
+
+ {% if authorizeButton is defined %}
+ config.authorizeButton = '{{ authorizeButton }}';
+ {% endif %}
+
+ gadash.configKeys(config);
+
{% if initCallback is defined %}
gadash.initCallback = {{ initCallback }};
{% endif %}
+
</script>

0 comments on commit 6c39ee4

Please sign in to comment.
Something went wrong with that request. Please try again.