diff --git a/app/assets/javascripts/lib/uservoice.js b/app/assets/javascripts/lib/uservoice.js index ae2e0f3f..991beff8 100644 --- a/app/assets/javascripts/lib/uservoice.js +++ b/app/assets/javascripts/lib/uservoice.js @@ -3,7 +3,7 @@ if(USERVOICE == undefined) { USERVOICE = {}; } -USERVOICE.load = function (barometer_id) { +USERVOICE.load = function (name, id, email, sso_token) { // Include the UserVoice JavaScript SDK (only needed once on a page) UserVoice=window.UserVoice||[];(function(){var uv=document.createElement('script');uv.type='text/javascript';uv.async=true;uv.src='//widget.uservoice.com/wybK0nSMNuhlWkIKzTyWg.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(uv,s)})(); @@ -21,24 +21,16 @@ UserVoice.push(['set', { // Identify the user and pass traits // To enable, replace sample data with actual user traits and uncomment the line -//TODO NEED HELP HERE MAKING SURE CORRECT USER DATA GETS PUSHED -UserVoice.push(['identify', { - //email: 'getElementsByTagName(userid)', // User’s email address - name: "userid", // User’s real name - //created_at: 1364406966, // Unix timestamp for the date the user signed up - id: "Metamaps.Active.Mapper.id", // Optional: Unique id of the user (if set, this should not change) - //type: 'Owner', // Optional: segment your users by type - //account: { - // id: 123, // Optional: associate multiple users with a single account - // name: 'Acme, Co.', // Account name - // created_at: 1364406966, // Unix timestamp for the date the account was created - // monthly_rate: 9.99, // Decimal; monthly rate of the account - // ltv: 1495.00, // Decimal; lifetime value of the account - // plan: 'Enhanced' // Plan name for the account - //} -}]); +if (name) { + UserVoice.push(['setSSO', sso_token]); + UserVoice.push(['identify', { + 'email': email, // User’s email address + 'name': name, // User’s real name + 'id': id, // Optional: Unique id of the user + }]); +} -// Add default trigger to the bottom-right corner of the window: +// Add default trigger to the bottom-left corner of the window: UserVoice.push(['addTrigger', { mode: 'contact', trigger_position: 'bottom-left' }]); // Or, use your own custom trigger: diff --git a/app/assets/stylesheets/uservoice.css b/app/assets/stylesheets/uservoice.css index fd3c68f5..953a5e5b 100644 --- a/app/assets/stylesheets/uservoice.css +++ b/app/assets/stylesheets/uservoice.css @@ -13,137 +13,4 @@ div.uv-icon.uv-bottom-left { top:25%; width:25px; z-index:100000; - } - -/* =NOTHING AFTER THIS POINT IS BEING USED ---------------------------------------------------------*/ - -#barometer_overlay { - top:0; - left:0; - width: 100%; - height: 100%; - position: fixed; - _position: absolute; - z-index: 1000000; - } - -#barometer_overlay * { - margin: 0; - padding: 0; - font-family: Arial, Helvetica, sans-serif; - font-style:normal; - font-variant:normal; - font-size: 12px; - color:#333; - } - -/* =Barometer Overlay -> Main ---------------------------------------------------------*/ - -#barometer_main { - width: 550px; - height: 100%; - margin: 0 auto; - z-index:2; - position:relative; - background-color: transparent; - } - -#barometer_main div { - padding: 5px 20px 0 20px; - margin:0; - background: #EEE; - overflow:none; - border-right: solid 2px #000; - border-left: solid 2px #000; - } - -#barometer_overlay #barometer_main #overlay_loading h2 { - padding: 10px 0; - font-size:28px; - } - -#barometer_overlay #barometer_main #barometer_close:hover { - background-position:-42px 0; - } - -#barometer_overlay #barometer_main a#barometer_close { - background-image:url(../images/barometer_close.png); - cursor:pointer; - height:42px; - outline-color:-moz-use-text-color; - outline-style:none; - outline-width:medium; - overflow:hidden; - position:absolute; - top:-23px; - right:-22px; - width:42px; - z-index:4; - border: none; - } - -#barometer_overlay #barometer_main span { - background:url(../images/close.png) no-repeat scroll 33px 0 transparent; - color:#FFFFFF; - cursor:pointer; - float:right; - font-size:11px; - height:20px; - padding-right:20px; - text-decoration:underline; -} - -#barometer_iframe { - width: 550px; - height: 100%; - background: transparent url(../images/barometer_loading.png) no-repeat; -} -#barometer_iframe.loaded { - background: transparent; -} - - -/* =Barometer Overlay -> Main -> Overlay header ---------------------------------------------------------*/ - -#barometer_overlay #barometer_main #overlay_header { - padding:6px 5px 1px 0; - background-color:#333; - font-weight: bold; - height:18px; - border: solid 2px #000; - } - -#barometer_overlay #barometer_main #overlay_header a { - color:#fff; - float:left; - font-size:15px; - margin-left:5px; - font-weight: normal; - } - -#barometer_overlay #barometer_main #overlay_header span { - float:right; - height:20px; - padding-right:20px; - background: transparent url(../images/close.png) no-repeat 33px 0; - text-decoration:underline; - font-size:11px; - cursor:pointer; - color: #fff; - } - -/* =Barometer screen id - used to close barometer ---------------------------------------------------------*/ - -#barometer_screen { - top:0; - left:0; - z-index:1; - width: 100%; - position: absolute; - background-color: #000; - opacity: 0.42; filter:alpha(opacity=42); -moz-opacity: 0.42; - } \ No newline at end of file +} \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a05a85c3..b0e0dcca 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -66,8 +66,6 @@ <%= render :partial => 'layouts/templates' %> <%= render :partial => 'shared/metacodeBgColors' %> <%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %> diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb deleted file mode 100644 index a109199a..00000000 --- a/config/initializers/redis.rb +++ /dev/null @@ -1,6 +0,0 @@ -if Rails.env.development? ## this also applies to metamaps.cc production mode - $redis = Redis.new(:host => 'localhost', :port=> 6379) -elsif Rails.env.production? ## this is for the heroku staging environment - uri = URI.parse(ENV["REDISTOGO_URL"]) - $redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) -end \ No newline at end of file diff --git a/config/initializers/uservoice.rb b/config/initializers/uservoice.rb new file mode 100644 index 00000000..3b010613 --- /dev/null +++ b/config/initializers/uservoice.rb @@ -0,0 +1,7 @@ +require 'uservoice-ruby' + +def current_sso_token + @current_sso_token ||= UserVoice.generate_sso_token('metamapscc', ENV['SSO_KEY'], { + :email => current_user.email + }, 300) # Default expiry time is 5 minutes = 300 seconds +end \ No newline at end of file