From 7328d3f02c0cf410cb391cc7a8559961e98187c2 Mon Sep 17 00:00:00 2001 From: Manuel Muradas Date: Tue, 17 Apr 2018 14:52:52 -0300 Subject: [PATCH] Update service align on tab position change #1249 If a tab is moved to the right side, the align field must reflect the new position. --- app/view/main/MainController.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/view/main/MainController.js b/app/view/main/MainController.js index 091359a0..59ab47d1 100644 --- a/app/view/main/MainController.js +++ b/app/view/main/MainController.js @@ -42,14 +42,20 @@ Ext.define('Rambox.view.main.MainController', { console.log('Updating Tabs positions...'); var store = Ext.getStore('Services'); + var align = 'left'; store.suspendEvent('remove'); Ext.each(tabPanel.items.items, function(t, i) { if ( t.id !== 'ramboxTab' && t.id !== 'tbfill' && t.record.get('enabled') ) { var rec = store.getById(t.record.get('id')); - if ( rec.get('align') === 'right' ) i--; + if ( align === 'right' ) i--; + rec.set('align', align); rec.set('position', i); rec.save(); } + else if ( t.id === 'tbfill' ) { + align = 'right'; + } + }); store.load();