From 911ce3a21b0c7f01af44dc4fd002e2797af7bfe0 Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 18 Jun 2014 12:50:32 +0200 Subject: [PATCH 1/3] expose debug and insider via js global ns --- app/views/talks/show.html.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/talks/show.html.haml b/app/views/talks/show.html.haml index 5232408f1..7952201c9 100644 --- a/app/views/talks/show.html.haml +++ b/app/views/talks/show.html.haml @@ -299,5 +299,8 @@ = t('.just_listening_in') .scripts + :javascript + window.debug = #{!Settings.disable_js_debugging}; + window.insider = #{current_user.insider?}; = javascript_include_tag 'livepage' = render 'config' From 27031813bdc9930c6661731d4a9899446ab3548d Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 18 Jun 2014 12:50:47 +0200 Subject: [PATCH 2/3] fix insider method --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 2edaf0391..1605731de 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -136,7 +136,7 @@ def for_select end def insider? - email =~ /@voicerepublic.com^/ + !!(email =~ /@voicerepublic.com$/) end end From 2f00d0a2539fd04194ef0a6944166fe15e1299f6 Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 18 Jun 2014 12:50:59 +0200 Subject: [PATCH 3/3] use debug and insider info to determine if logs should be exposed --- .../{livepage.js.coffee.erb => livepage.js.coffee} | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) rename app/assets/javascripts/{livepage.js.coffee.erb => livepage.js.coffee} (80%) diff --git a/app/assets/javascripts/livepage.js.coffee.erb b/app/assets/javascripts/livepage.js.coffee similarity index 80% rename from app/assets/javascripts/livepage.js.coffee.erb rename to app/assets/javascripts/livepage.js.coffee index 6890eaea3..b8f3e80fc 100644 --- a/app/assets/javascripts/livepage.js.coffee.erb +++ b/app/assets/javascripts/livepage.js.coffee @@ -7,8 +7,11 @@ window.Livepage = angular.module 'Livepage', [] configFunc = ($logProvider) -> - $logProvider.debugEnabled <%= !Settings.disable_js_debugging %> + $logProvider.debugEnabled window.debug or window.insider configFunc.$inject = ['$logProvider'] window.Livepage.config configFunc + + +