diff --git a/app/javascript/vue/navigation/top_menu.vue b/app/javascript/vue/navigation/top_menu.vue index 8bc8e03f3..a09b815b1 100644 --- a/app/javascript/vue/navigation/top_menu.vue +++ b/app/javascript/vue/navigation/top_menu.vue @@ -8,7 +8,7 @@
{ - 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.fetchData(); this.checkUnseenNotifications(); $(document).on('turbolinks:load', () => { this.notificationsOpened = false; 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: { + 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) { - if (this.current_team == team) return; + if (this.currentTeam == team) return; $.post(this.teams.find(e => e.value == team).params.switch_url, (result) => { - this.current_team = result.current_team - dropdownSelector.selectValues('#sciNavigationTeamSelector', this.current_team); + this.currentTeam = result.current_team + dropdownSelector.selectValues('#sciNavigationTeamSelector', this.currentTeam); window.open(this.rootUrl, '_self') }).error((msg) => { HelperModule.flashAlertMsg(msg.responseJSON.message, 'danger');