summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/user_tabs.js.es6
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/user_tabs.js.es6')
-rw-r--r--app/assets/javascripts/user_tabs.js.es611
1 files changed, 3 insertions, 8 deletions
diff --git a/app/assets/javascripts/user_tabs.js.es6 b/app/assets/javascripts/user_tabs.js.es6
index 63bce0a6f6f..dfdfa1e7f75 100644
--- a/app/assets/javascripts/user_tabs.js.es6
+++ b/app/assets/javascripts/user_tabs.js.es6
@@ -89,7 +89,7 @@ content on the Users#show page.
const action = $target.data('action');
const source = $target.attr('href');
this.setTab(source, action);
- return this.setCurrentAction(action);
+ return this.setCurrentAction(source, action);
}
activateTab(action) {
@@ -142,14 +142,9 @@ content on the Users#show page.
.toggle(status);
}
- setCurrentAction(action) {
- const regExp = new RegExp(`\/(${this.actions.join('|')})(\.html)?\/?$`);
- let new_state = this._location.pathname;
+ setCurrentAction(source, action) {
+ let new_state = source
new_state = new_state.replace(/\/+$/, '');
- new_state = new_state.replace(regExp, '');
- if (action !== this.defaultAction) {
- new_state += `/${action}`;
- }
new_state += this._location.search + this._location.hash;
history.replaceState({
turbolinks: true,