[IMP] Useability

bzr revid: fp@tinyerp.com-20130213104321-2lbtgpkhl8prqq42
This commit is contained in:
Fabien Pinckaers
2013-02-13 11:43:21 +01:00
parent 6960905a08
commit 734ffa107b
2 changed files with 51 additions and 29 deletions
+11 -1
View File
@@ -118,7 +118,7 @@ class live_support_channel(osv.osv):
return res
_columns = {
'name': fields.char(string="Name", size=200, required=True),
'name': fields.char(string="Channel Name", size=200, required=True),
'user_ids': fields.many2many('im.user', 'live_support_channel_im_user', 'channel_id', 'user_id', string="Users"),
'are_you_inside': fields.function(_are_you_inside, type='boolean', string='Are you inside the matrix?', store=False),
'script': fields.function(_script, type='text', string='Script', store=False),
@@ -151,6 +151,8 @@ class live_support_channel(osv.osv):
'button_text': "Chat with one of our collaborators",
'input_placeholder': "How may I help you?",
'default_message': '',
'user_ids': lambda self,cr, uid, ctx={}: [uid],
'are_you_inside': lambda self,cr, uid, ctx={}: True,
'image': _get_default_image,
}
@@ -164,6 +166,14 @@ class live_support_channel(osv.osv):
return False
return random.choice(users).id
def test_channel(self, cr, uid, channel, context=None):
if not channel:
return {}
return {
'url': self.browse(cr, uid, channel[0], context=context or {}).web_page,
'type': 'ir.actions.act_url'
}
def get_info_for_chat_src(self, cr, uid, channel, context=None):
url = self.pool.get('ir.config_parameter').get_param(cr, openerp.SUPERUSER_ID, 'web.base.url')
chan = self.browse(cr, uid, channel, context=context)
+40 -28
View File
@@ -64,39 +64,51 @@
<field name="name" placeholder="e.g. YourWebsite.com"/>
</h1>
<div>
<button type="object" name="join" class="oe_group_join" string="Join" attrs='{"invisible": [["are_you_inside", "=", True]]}'/>
<button type="object" name="quit" string="Quit" attrs='{"invisible": [["are_you_inside", "=", False]]}'/>
<button type="object" name="join" class="oe_highlight" string="Join Channel" attrs='{"invisible": [["are_you_inside", "=", True]]}'/>
<button type="object" name="quit" string="Leave Channel" attrs='{"invisible": [["are_you_inside", "=", False]]}'/>
<button type="object" name="test_channel" string="Test" attrs='{"invisible": [["web_page", "=", False]]}'/>
<field name="are_you_inside" invisible="1"/>
</div>
</div>
<field name="user_ids" readonly="1" nolabel="1" colspan="2" widget="many2many_kanban">
<kanban>
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div>
<div class="oe_group_details" style="min-height: 40px">
<img t-att-src="kanban_image('im.user', 'image', record.id.value)"
class="oe_avatar oe_kanban_avatar_smallbox" style="float:left; margin-right: 10px;"/>
<h4><field name="name"/></h4>
</div>
</div>
</t>
</templates>
</kanban>
</field>
<label for="web_page" colspan="2"/>
<field name="web_page" readonly="1" nolabel="1" colspan="2"/>
<label for="script" colspan="2"/>
<field name="script" readonly="1" nolabel="1" colspan="2"/>
<group col="4">
<field name="button_text"/>
<field name="input_placeholder"/>
<field name="default_message"/>
<group>
<group string="Operators">
<field name="user_ids" widget="many2many_kanban" nolabel="1" colspan="2">
<kanban>
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div>
<div class="oe_group_details" style="min-height: 40px">
<img t-att-src="kanban_image('im.user', 'image', record.id.value)"
class="oe_avatar oe_kanban_avatar_smallbox" style="float:left; margin-right: 10px;"/>
<h4><field name="name"/></h4>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</group>
<group string="Options">
<field name="button_text"/>
<field name="input_placeholder"/>
<field name="default_message"/>
</group>
</group>
<div attrs='{"invisible": [["web_page", "=", False]]}'>
<separator string="How to use the Live Chat widget?"/>
<p>
Copy and paste this code into your website, within the &amp;lt;head&amp;gt; tag:
</p>
<field name="script" readonly="1" class="oe_tag"/>
<p>
or copy this url and send it by email to your customers or suppliers:
</p>
<field name="web_page" readonly="1" class="oe_tag"/>
</div>
</sheet>
</form>
</field>