even nicer

bzr revid: nicolas.vanhoren@openerp.com-20130211134723-3fuvud3zfzqrhg17
This commit is contained in:
niv-openerp
2013-02-11 14:47:23 +01:00
parent dfd09c748a
commit eebacd38b9
4 changed files with 41 additions and 6 deletions
+4 -1
View File
@@ -60,7 +60,9 @@ class ImportController(openerp.addons.web.http.Controller):
req.session._login = "anonymous"
req.session._password = "anonymous"
script = req.session.model('live_support.channel').read(channel, ["script"])["script"]
return req.make_response(env.get_template("web_page.html").render({"script": script}),
info = req.session.model('live_support.channel').get_info_for_chat_src(channel)
info["script"] = script
return req.make_response(env.get_template("web_page.html").render(info),
headers=[('Content-Type', "text/html")])
@openerp.addons.web.http.jsonrequest
@@ -135,6 +137,7 @@ class live_support_channel(osv.osv):
'buttonText': chan.button_text,
'inputPlaceholder': chan.input_placeholder,
'defaultMessage': chan.default_message,
"channelName": chan.name,
}
def join(self, cr, uid, ids, context=None):
+1
View File
@@ -15,5 +15,6 @@ require.config({
buttonText: {{buttonText | json}},
inputPlaceholder: {{inputPlaceholder | json}},
defaultMessage: {{(defaultMessage or None) | json}},
auto: window.oe_live_support_auto || false,
});
});
@@ -14,6 +14,7 @@ define(["nova", "jquery", "underscore", "oeclient", "require"], function(nova, $
buttonText: "Chat with one of our collaborators",
inputPlaceholder: "How may I help you?",
defaultMessage: null,
auto: false,
});
defaultInputPlaceholder = options.inputPlaceholder;
var templates_def = $.ajax({
@@ -37,7 +38,10 @@ define(["nova", "jquery", "underscore", "oeclient", "require"], function(nova, $
connection.connector.call("/live_support/available", {db: db, channel: channel}).then(function(activated) {
if (! activated)
return;
new livesupport.ChatButton(null, channel, options).appendTo($("body"));
var button = new livesupport.ChatButton(null, channel, options);
button.appendTo($("body"));
if (options.auto)
button.click();
});
});
};
+31 -4
View File
@@ -1,6 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
window.oe_live_support_auto = true;
</script>
{{script}}
<style type="text/css">
body {
@@ -35,20 +38,44 @@
opacity: 0;
top: 50%;
left: 50%;
margin: -70px 0 0 -330px;
margin: -150px 0 0 -210px;
color: white;
text-shadow: 0 1px 0 rgba(34, 52, 72, 0.2);
z-index: 10;
font-size: 64px;
font-style: italic;
font-size: 32px;
font-weight: bold;
}
.main h1 {
position: relative;
left: -4px;
padding-bottom: 5px;
font-size: 64px;
font-weight: 700;
font-style: italic;
}
.main h1 .strong {
position: absolute;
bottom: 39px;
height: 21px;
line-height: 22px;
margin: -2px 0 0 10px;
background: white;
color: #aeb0cf;
font-size: 18px;
padding: 2px 6px 2px 5px;
-moz-box-shadow: 0 0 1px rgba(34, 52, 72, 0.2), 0 1px 0 rgba(34, 52, 72, 0.1);
-webkit-box-shadow: 0 0 1px rgba(34, 52, 72, 0.2), 0 1px 0 rgba(34, 52, 72, 0.1);
border-radius: 4px;
box-shadow: 0 0 1px rgba(34, 52, 72, 0.2), 0 1px 0 rgba(34, 52, 72, 0.1);
text-shadow: none;
}
</style>
</head>
<body>
<div class="main" style="opacity: 1;">
OpenERP Live Support
<h1>OpenERP<span class="strong">7.0</span></h1>
<div class="channel_name">{{channelName}}</div>
</div>
</body>
</html>