TT#5020 Implement ngcp-csc account module mockup

Implement ngcp-csc account module mockup, linked with corresponsing
logged in ACL account. Also remove some console.logs, delete
unneeded bootstrap.js and bootstrap.css files, and replace main model
username object with formula object to correctly display username
in header also immediately after log in. Cleanups and small
refactoring in new patchset.

Change-Id: I91d4b7bfbaf7d27908640b9f730024f63b729695
changes/79/9379/3
Robert Axelsen 9 years ago
parent bba515ed55
commit 160a1dd766

@ -192,7 +192,6 @@ Ext.define('Ngcp.csc.locales', {
sp: 'all calls'
}
},
callbarring: {
title: {
en: 'Call barring for incoming and outgoing calls.',
@ -314,14 +313,92 @@ Ext.define('Ngcp.csc.locales', {
sp: 'Please use digits only and include the area code of the number. You may use the wildcard characters "?" for one and "*" for an indefinite number of arbitrary digits.'
},
new_entry_anonymous: {
en: 'To block anonymous calls you may just submit the empty string.',
it: 'To block anonymous calls you may just submit the empty string.',
de: 'To block anonymous calls you may just submit the empty string.',
fr: 'To block anonymous calls you may just submit the empty string.',
sp: 'To block anonymous calls you may just submit the empty string.'
en: 'To block anonymous calls you may just submit the empty string.',
it: 'To block anonymous calls you may just submit the empty string.',
de: 'To block anonymous calls you may just submit the empty string.',
fr: 'To block anonymous calls you may just submit the empty string.',
sp: 'To block anonymous calls you may just submit the empty string.'
}
},
account: {
title: {
en: 'Your personal settings.',
it: 'Your personal settings.',
de: 'Your personal settings.',
fr: 'Your personal settings.',
sp: 'Your personal settings.'
},
subtitle: {
en: 'PASSWORD',
it: 'PASSWORD',
de: 'PASSWORD',
fr: 'PASSWORD',
sp: 'PASSWORD'
},
password_instructions: {
en: 'You may change the password for your self-administration login here.',
it: 'You may change the password for your self-administration login here.',
de: 'You may change the password for your self-administration login here.',
fr: 'You may change the password for your self-administration login here.',
sp: 'You may change the password for your self-administration login here.'
},
change_password: {
en: 'change password',
it: 'change password',
de: 'change password',
fr: 'change password',
sp: 'change password'
},
reset_form: {
en: 'reset form',
it: 'reset form',
de: 'reset form',
fr: 'reset form',
sp: 'reset form'
},
password_short: {
en: 'The password is too short, please use 6 characters at least.',
it: 'The password is too short, please use 6 characters at least.',
de: 'The password is too short, please use 6 characters at least.',
fr: 'The password is too short, please use 6 characters at least.',
sp: 'The password is too short, please use 6 characters at least.'
},
wrong_password: {
en: 'Wrong password, please verify your input.',
it: 'Wrong password, please verify your input.',
de: 'Wrong password, please verify your input.',
fr: 'Wrong password, please verify your input.',
sp: 'Wrong password, please verify your input.'
},
password_match: {
en: 'Passwords do not match, please try again.',
it: 'Passwords do not match, please try again.',
de: 'Passwords do not match, please try again.',
fr: 'Passwords do not match, please try again.',
sp: 'Passwords do not match, please try again.'
},
change_success: {
en: 'The password has been changed successfully.',
it: 'The password has been changed successfully.',
de: 'The password has been changed successfully.',
fr: 'The password has been changed successfully.',
sp: 'The password has been changed successfully.'
},
enter_current: {
en: 'Please enter your current password.',
it: 'Please enter your current password.',
de: 'Please enter your current password.',
fr: 'Please enter your current password.',
sp: 'Please enter your current password.'
},
username: {
en: 'username',
it: 'username',
de: 'username',
fr: 'username',
sp: 'username'
}
},
filters: {
search: {
en: 'SEARCH',
@ -462,7 +539,6 @@ Ext.define('Ngcp.csc.locales', {
sp: 'save settings'
}
}
},
chat: {
title: {
@ -486,8 +562,8 @@ Ext.define('Ngcp.csc.locales', {
fr: 'Chat group name',
sp: 'Chat group name'
},
msg_box:{
empty_text:{
msg_box: {
empty_text: {
en: 'Type a message',
it: 'Type a message',
de: 'Type a message',
@ -502,7 +578,7 @@ Ext.define('Ngcp.csc.locales', {
fr: 'You can start a private conversation with {0} here.',
sp: 'You can start a private conversation with {0} here.'
},
alerts:{
alerts: {
user_ddrop: {
en: 'Only users can be dropped',
it: 'Only users can be dropped',
@ -655,7 +731,6 @@ Ext.define('Ngcp.csc.locales', {
fr: 'Videocall',
sp: 'Videocall'
}
}
}
})

@ -68,7 +68,7 @@ Ext.define('NgcpCsc.store.NavigationTree', {
}, {
text: 'Account',
iconCls: 'x-fa fa-user',
viewType: 'pageblank',
viewType: 'account',
routeId: 'account',
acl: ['administrator', 'restricted', 'host'],
leaf: true

9
bootstrap.css vendored

@ -1,9 +0,0 @@
/*
* This file is generated by Sencha Cmd and should NOT be edited. It redirects
* to the most recently built CSS file for the application to allow index.html
* in the development directory to load properly (i.e., "dev mode").
*/
@import 'build/production/NgcpCsc/resources/NgcpCsc-all.css';

2601
bootstrap.js vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,4 @@
// custom rules
.account-username {
margin-left: 40px;
}

@ -3,7 +3,12 @@ Ext.define('NgcpCsc.view.main.MainModel', {
alias: 'viewmodel.main',
data: {
currentView: null,
username: localStorage.getItem('username')
currentView: null
},
formulas: {
username: function(get) {
return localStorage.getItem('username');
}
}
});

@ -0,0 +1,50 @@
Ext.define('NgcpCsc.view.pages.account.Account', {
extend: 'Ext.panel.Panel',
xtype: 'account',
controller: 'account',
title: Ngcp.csc.locales.account.title[localStorage.getItem('languageSelected')],
defaults: {
padding: 20
},
items: [{
height: 60,
padding: '20 0 5 20',
html: Ngcp.csc.locales.account.subtitle[localStorage.getItem('languageSelected')]
}, {
height: 60,
padding: '20 0 5 20',
html: Ngcp.csc.locales.account.password_instructions[localStorage.getItem('languageSelected')]
}, {
xtype: 'accountform'
}, {
xtype: 'container',
height: 40,
padding: '10 0 10 10',
html: Ngcp.csc.locales.account.change_password[localStorage.getItem('languageSelected')].toLowerCase(),
cls: 'link',
listeners: {
click: {
element: 'el',
fn: 'submitForm'
}
}
}, {
xtype: 'container',
height: 40,
padding: '10 0 10 10',
html: Ngcp.csc.locales.account.reset_form[localStorage.getItem('languageSelected')].toLowerCase(),
cls: 'link',
listeners: {
click: {
element: 'el',
fn: 'resetForm'
}
}
}]
});

@ -0,0 +1,38 @@
Ext.define('NgcpCsc.view.pages.account.AccountController', {
extend: 'Ext.app.ViewController',
alias: 'controller.account',
resetForm: function() {
this.getViewModel().set('old-password', '');
this.getViewModel().set('new-password', '');
this.getViewModel().set('repeat-password', '');
},
submitForm: function(field) {
var oldPassword = localStorage.getItem('password');
var enteredOldPassword = this.getViewModel().get('old-password');
var newPassword = this.getViewModel().get('new-password');
var repeatPassword = this.getViewModel().get('repeat-password');
if (enteredOldPassword === null) {
this.fireEvent('showmessage', false, Ngcp.csc.locales.account.enter_current[localStorage.getItem('languageSelected')]);
} else if (newPassword.length < 6 || repeatPassword.length < 6) {
this.fireEvent('showmessage', false, Ngcp.csc.locales.account.password_short[localStorage.getItem('languageSelected')]);
} else if (oldPassword === enteredOldPassword && newPassword === repeatPassword) {
localStorage.setItem('password', newPassword);
this.fireEvent('showmessage', true, Ngcp.csc.locales.account.change_success[localStorage.getItem('languageSelected')]);
} else if (newPassword !== repeatPassword) {
this.fireEvent('showmessage', false, Ngcp.csc.locales.account.password_match[localStorage.getItem('languageSelected')]);
} else if (oldPassword !== enteredOldPassword) {
this.fireEvent('showmessage', false, Ngcp.csc.locales.account.wrong_password[localStorage.getItem('languageSelected')]);
};
this.resetForm();
},
onEnterPressed: function (field, el) {
if (el.getKey() == el.ENTER) {
this.submitForm(field.id);
};
}
});

@ -0,0 +1,58 @@
Ext.define('NgcpCsc.view.pages.account.AccountForm', {
extend: 'Ext.form.Panel',
xtype: 'accountform',
viewModel: 'account',
store: 'Account',
defaults: {
width: 750
},
items: [{
xtype: 'container',
bind: '{username}',
padding: '0 0 15 0'
}, {
xtype: 'textfield',
inputType: 'password',
fieldLabel: 'old password',
name: 'account-old-password',
bind: '{old-password}',
listeners: {
specialKey: 'onEnterPressed'
}
}, {
xtype: 'fieldcontainer',
labelStyle: 'font-weight:bold;padding:0;',
layout: 'hbox',
defaultType: 'textfield',
fieldDefaults: {
labelAlign: 'right'
},
items: [{
flex: 2,
inputType: 'password',
fieldLabel: 'new password',
name: 'account-new-password',
bind: '{new-password}',
listeners: {
specialKey: 'onEnterPressed'
}
}, {
flex: 2,
inputType: 'password',
fieldLabel: 'repeat',
name: 'account-repeat-password',
margin: '0 0 0 5',
bind: '{repeat-password}',
listeners: {
specialKey: 'onEnterPressed'
}
}]
}]
});

@ -0,0 +1,17 @@
Ext.define('NgcpCsc.view.pages.account.AccountModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.account',
data: {
new_password: '',
old_password: '',
repeat_password: ''
},
formulas: {
username: function(get) {
return Ext.String.format('{0}: <span class="account-username">{1}</span>', Ngcp.csc.locales.account.username[localStorage.getItem('languageSelected')], localStorage.getItem('username'));
}
}
});

@ -39,13 +39,10 @@ Ext.define('NgcpCsc.view.pages.callbarring.CallBarringController', {
var store, newNumber;
var fieldArrayIncoming = ['incoming-new-enter', 'incoming-new-btn'];
var fieldArrayOutgoing = ['outgoing-new-enter', 'outgoing-new-btn'];
console.log(fieldArrayIncoming.indexOf(field) > -1);
if (fieldArrayIncoming.indexOf(field) > -1) {
console.log(field);
store = Ext.getStore('CallBarringIncoming');
newNumber = this.getViewModel().get('new_in_number');
} else if (fieldArrayOutgoing.indexOf(field) > -1){
console.log(field);
store = Ext.getStore('CallBarringOutgoing');
newNumber = this.getViewModel().get('new_out_number');
};

Loading…
Cancel
Save