#3628 Fix the url to show <#foo>-tab
Merged by pingou. Opened by farhaan.
farhaan/pagure tabs-settings-fix  into  master

Download 3628.patch

This commit adds the ability to switch tabs with the right
url link on settings page.

Signed-off-by: Farhaan Bukhsh farhaan.bukhsh@gmail.com

@farhaan: Do you mean "switch" instead of "seitch"? Please fix the typo in your commit message.

Otherwise, code looks good.

Hey @ngompa thanks for pointing it out :)

@farhaan, don't forget to amend your commit to fix the typo. PRs are ephemeral, commits are less so. :)

rebased onto 13de0344652fb2d93775a021b538791fe0d819a5

@ngompa done already ;)

:thumbsup:

Gah, this whole anchors as tabs thing is kinda precarious...

This change stops it so that the anchors don't link to the the tabs when reloading the page. So if you go to:

http://localhost:5000/fedora-poaceae/settings#priorities-tab

it doesnt load the right tab. Also, if you update the the priorities, it uses this anchor to jump you back to the right tab... and this isnt working at the momment in this PR

This fixes the issue so the anchors switch to the tabs again:

diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html
index 08a65b36..ca62f148 100644
--- a/pagure/templates/settings.html
+++ b/pagure/templates/settings.html
@@ -1460,9 +1460,9 @@ $('#user').selectize({
     }
     window.onhashchange = function () {
-      $(window.location.hash).tab('show');
+      $(window.location.hash.slice(0,-4)).tab('show');
     }
-    const anchor = window.location.hash;
+    const anchor = window.location.hash.slice(0,-4);
     console.log(anchor);
     $(anchor).tab('show');
     window.scrollTo(0,0);

Hey that's a nice edge condition, I am just thinking is this the prettiest solution we can come up, I like the idea that it separates the anchor from the tab controlling element though!

rebased onto 7276f4995aab63dc8341f767bb393bf757933448

rebased onto b15873e077159a1a8ea4ce526ad26810e68c56fb

@farhaan the thing here is we need it to go to the correct tab if the anchor is in the URL. because we use it to redirect to the correct tab when updating a form.

Makes sense, we are catching hold of them through id's and forcing them to switch.

What's the status of this PR?

I have made the requested changes @ryanlerch does it look okay?

:thumbsup: LGTM!

rebased onto 19c7be9161d09547138cb1ce7eff4e2e343472cf

Local testing are happy as well, let's wait for a final run of jenkins and get it in :)

rebased onto 55fd8becdd5c509a3bcaba9a98ffc48dc8124f74

Let's merge, thanks @farhaan!

Pull-Request has been merged by pingou

Metadata