finalized uservoice config

This commit is contained in:
Connor Turland 2014-10-07 15:19:10 -04:00
parent fbdef0108e
commit b5068b6bc4
5 changed files with 22 additions and 160 deletions

View file

@ -3,7 +3,7 @@ if(USERVOICE == undefined) {
USERVOICE = {};
}
USERVOICE.load = function (barometer_id) {
USERVOICE.load = function (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,11 @@ 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)', // Users email address
name: "userid", // Users 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 (sso_token) {
UserVoice.push(['setSSO', sso_token]);
}
// 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:

View file

@ -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;
}
}

View file

@ -66,8 +66,6 @@
<%= render :partial => 'layouts/templates' %>
<%= render :partial => 'shared/metacodeBgColors' %>
<script type="text/javascript" charset="utf-8">
//BAROMETER.load('Scqak8nyHdFEkezKMNeQp');
USERVOICE.load();
<% if authenticated? %>
Metamaps.Active.Mapper = <%= user.to_json.html_safe %>
<% else %>
@ -89,6 +87,13 @@
Metamaps.Loading.loader.setDensity(41); // default is 40
Metamaps.Loading.loader.setRange(0.9); // default is 1.3
Metamaps.Loading.loader.show(); // Hidden by default
// set up uservoice with signed in user
<% if authenticated? %>
USERVOICE.load("<%= current_sso_token %>");
<% else %>
USERVOICE.load();
<% end %>
</script>
<%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %>

View file

@ -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

View file

@ -0,0 +1,9 @@
require 'uservoice-ruby'
SSO_KEY = '3f0d5e3bbaff5ea7c95e549f75ebba8c'
def current_sso_token
@current_sso_token ||= UserVoice.generate_sso_token('metamapscc', SSO_KEY, {
:email => current_user.email
}, 300) # Default expiry time is 5 minutes = 300 seconds
end