mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-21 22:33:13 +08:00
Merge pull request #5383 from artoscinote/ma_SCI_8315
Track user full name update in navigation [SCI-8315]
This commit is contained in:
commit
dae4697585
1 changed files with 22 additions and 17 deletions
|
@ -8,7 +8,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-if="teams" class="sci--navigation--top-menu-teams">
|
<div v-if="teams" class="sci--navigation--top-menu-teams">
|
||||||
<DropdownSelector
|
<DropdownSelector
|
||||||
:selectedValue="current_team"
|
:selectedValue="currentTeam"
|
||||||
:options="teams"
|
:options="teams"
|
||||||
:disableSearch="true"
|
:disableSearch="true"
|
||||||
:selectorId="`sciNavigationTeamSelector`"
|
:selectorId="`sciNavigationTeamSelector`"
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
return {
|
return {
|
||||||
rootUrl: null,
|
rootUrl: null,
|
||||||
logo: null,
|
logo: null,
|
||||||
current_team: null,
|
currentTeam: null,
|
||||||
teams: null,
|
teams: null,
|
||||||
searchUrl: null,
|
searchUrl: null,
|
||||||
user: null,
|
user: null,
|
||||||
|
@ -118,32 +118,37 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
$.get(this.url, (result) => {
|
this.fetchData();
|
||||||
this.rootUrl = result.root_url;
|
|
||||||
this.logo = result.logo;
|
|
||||||
this.current_team = result.current_team;
|
|
||||||
this.teams = result.teams;
|
|
||||||
this.searchUrl = result.search_url;
|
|
||||||
this.helpMenu = result.help_menu;
|
|
||||||
this.settingsMenu = result.settings_menu;
|
|
||||||
this.userMenu = result.user_menu;
|
|
||||||
this.user = result.user;
|
|
||||||
})
|
|
||||||
|
|
||||||
this.checkUnseenNotifications();
|
this.checkUnseenNotifications();
|
||||||
|
|
||||||
$(document).on('turbolinks:load', () => {
|
$(document).on('turbolinks:load', () => {
|
||||||
this.notificationsOpened = false;
|
this.notificationsOpened = false;
|
||||||
this.checkUnseenNotifications();
|
this.checkUnseenNotifications();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Track name update in user profile settings
|
||||||
|
$(document).on('inlineEditing::updated', '.inline-editing-container[data-field-to-update="full_name"]', this.fetchData);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
fetchData() {
|
||||||
|
$.get(this.url, (result) => {
|
||||||
|
this.rootUrl = result.root_url;
|
||||||
|
this.logo = result.logo;
|
||||||
|
this.currentTeam = result.current_team;
|
||||||
|
this.teams = result.teams;
|
||||||
|
this.searchUrl = result.search_url;
|
||||||
|
this.helpMenu = result.help_menu;
|
||||||
|
this.settingsMenu = result.settings_menu;
|
||||||
|
this.userMenu = result.user_menu;
|
||||||
|
this.user = result.user;
|
||||||
|
})
|
||||||
|
},
|
||||||
switchTeam(team) {
|
switchTeam(team) {
|
||||||
if (this.current_team == team) return;
|
if (this.currentTeam == team) return;
|
||||||
|
|
||||||
$.post(this.teams.find(e => e.value == team).params.switch_url, (result) => {
|
$.post(this.teams.find(e => e.value == team).params.switch_url, (result) => {
|
||||||
this.current_team = result.current_team
|
this.currentTeam = result.current_team
|
||||||
dropdownSelector.selectValues('#sciNavigationTeamSelector', this.current_team);
|
dropdownSelector.selectValues('#sciNavigationTeamSelector', this.currentTeam);
|
||||||
window.open(this.rootUrl, '_self')
|
window.open(this.rootUrl, '_self')
|
||||||
}).error((msg) => {
|
}).error((msg) => {
|
||||||
HelperModule.flashAlertMsg(msg.responseJSON.message, 'danger');
|
HelperModule.flashAlertMsg(msg.responseJSON.message, 'danger');
|
||||||
|
|
Loading…
Reference in a new issue