slackgmailskypefacebook-workplaceoutlookemailmicrosoft-teamsdiscordmessengercustom-servicesmacoslinuxwindowsinboxwhatsappicloudtweetdeckhipchattelegramhangouts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.2 KiB
57 lines
1.2 KiB
Ext.define('Rambox.store.Services', { |
|
extend: 'Ext.data.Store' |
|
,alias: 'store.services' |
|
|
|
,requires: [ |
|
'Ext.data.proxy.LocalStorage' |
|
] |
|
|
|
,model: 'Rambox.model.Service' |
|
|
|
,autoLoad: true |
|
,autoSync: true |
|
|
|
,sorters: [ |
|
{ |
|
property: 'position' |
|
,direction: 'ASC' |
|
} |
|
] |
|
|
|
,listeners: { |
|
load: function( store, records, successful ) { |
|
if ( Ext.isEmpty(records) ) { |
|
Ext.get('spinner').destroy(); |
|
Ext.cq1('app-main').add({ tabConfig : { xtype : 'tbfill' } }); |
|
return; |
|
} |
|
|
|
var servicesLeft = []; |
|
var servicesRight = []; |
|
store.each(function(service) { |
|
var cfg = { |
|
xtype: 'webview' |
|
,id: 'tab_'+service.get('id') |
|
,title: service.get('name') |
|
,icon: service.get('type') !== 'custom' ? 'resources/icons/'+service.get('logo') : service.get('logo') |
|
,src: service.get('url') |
|
,type: service.get('type') |
|
,muted: service.get('muted') |
|
,record: service |
|
,tabConfig: { |
|
service: service |
|
} |
|
}; |
|
|
|
service.get('align') === 'left' ? servicesLeft.push(cfg) : servicesRight.push(cfg); |
|
}); |
|
|
|
Ext.cq1('app-main').add(servicesLeft); |
|
Ext.cq1('app-main').add({ tabConfig : { xtype : 'tbfill' } }); |
|
|
|
if ( !Ext.isEmpty(servicesRight) ) { |
|
Ext.cq1('app-main').add(servicesRight); |
|
} |
|
} |
|
} |
|
});
|
|
|