Added chat tabs based on database. Added chat.preferences store.

This commit is contained in:
Martin Edenhofer 2015-11-17 16:39:46 +01:00
parent fe572ae54b
commit d94399ec7f
3 changed files with 26 additions and 14 deletions

View file

@ -7,21 +7,27 @@ class App.ChannelChat extends App.ControllerTabs
@title @header, true
@tabs = [
{
name: 'company.com/sales',
target: 'company-com-sales',
controller: App.ChannelChatDesigner,
},
{
name: 'company.com',
target: 'company-com',
controller: App.ChannelChatDesigner,
}
]
@render()
@load()
load: =>
@tabs = []
@ajax(
id: 'chat_index'
type: 'GET'
url: @apiPath + '/chats'
processData: true
success: (data, status, xhr) =>
App.Collection.loadAssets(data.assets)
for chat in App.Chat.all()
tab =
name: chat.name
target: "chat-#{chat.id}"
controller: App.ChannelChatDesigner
params:
model: chat
@tabs.push tab
@render()
)
class App.ChannelChatDesigner extends App.Controller
events:

View file

@ -2,6 +2,7 @@
class Chat < ApplicationModel
validates :name, presence: true
store :preferences
def customer_state(session_id = nil)
return { state: 'chat_disabled' } if !Setting.get('chat')

View file

@ -0,0 +1,5 @@
class Update3Chat < ActiveRecord::Migration
def up
add_column :chats, :preferences, :string, limit: 5000, null: true
end
end