Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photometry plot does not render as initial tab on target detail page #573

Closed
griffin-h opened this issue Oct 24, 2022 · 5 comments
Closed
Assignees

Comments

@griffin-h
Copy link
Contributor

I customized my TOM to show the photometry tab first when loading a target detail page by moving the "active" class from "observe-tab" to "photometry-tab":

<li class="nav-item">
  <a class="nav-link active" id="photometry-tab" href="#photometry" role="tab" data-toggle="tab">Photometry</a>
</li>
<li class="nav-item">
  <a class="nav-link" id="spectroscopy-tab" href="#spectroscopy" role="tab" data-toggle="tab">Spectroscopy</a>
</li>
<li class="nav-item">
  <a class="nav-link" id="observe-tab" href="#observe" role="tab" data-toggle="tab">Observe</a>
</li>

This works to make that the default tab. However, the photometry plot does not initially load. You have to click to a different tab and then back to this tab to get it to load. Is there something else I need to change to get this to render automatically?

I discussed this with @phycodurus last week and he asked me to open a low-priority issue to remind him to look into it.

@phycodurus
Copy link
Contributor

Thanks, Griffin, for taking the time to submit the issue and reminding me!

@rachel3834
Copy link
Contributor

This seems related to issue #697

@rachel3834 rachel3834 moved this from Backlog to Staged in TOM Toolkit Oct 30, 2023
@jchate6
Copy link
Contributor

jchate6 commented Nov 28, 2023

@griffin-h Sorry I'm just getting to this. Did you also set the tab-pane to active?

<div class="tab-pane active" id="photometry">
        {% photometry_for_target target %}
        {% get_photometry_data object %}
</div>

If you didn't do this, then even though the photometry tab is selected, the html associated with the observe tab will be visible on load. You would then need to select a different tab to sync things again before you could actually display the photometry which sounds like it might be your issue.

I also want to point out that with tomtoolkit 2.15.12 we have added the ability to set the initial tab by adding ?tab=photometry (or whatever tab you are looking for) after the URL.

Part of the motivation for this was to maintain the tab on a page refresh and to allow us to redirect to specific tabs after certain tasks are done. This could be useful when redirecting from any pages you've overwritten if you include these changes in Saguaro.

Would you find it a useful feature for us to include something like a DEFAULT_TARGET_DETAIL_TAB in the settings.py to use as the default active tab for users so this wouldn't have to be overwritten by individual users?

@jchate6 jchate6 self-assigned this Nov 28, 2023
@jchate6 jchate6 moved this from Staged to Backlog in TOM Toolkit Dec 1, 2023
@griffin-h
Copy link
Contributor Author

@griffin-h Sorry I'm just getting to this. Did you also set the tab-pane to active?

<div class="tab-pane active" id="photometry">
        {% photometry_for_target target %}
        {% get_photometry_data object %}
</div>

If you didn't do this, then even though the photometry tab is selected, the html associated with the observe tab will be visible on load. You would then need to select a different tab to sync things again before you could actually display the photometry which sounds like it might be your issue.

I didn't do this, but I just tried it, and it still doesn't work. As the page is loading, it initially looks like it's going to work, but then it snaps back to the built-in default tab (which I think is the first tab).

I also want to point out that with tomtoolkit 2.15.12 we have added the ability to set the initial tab by adding ?tab=photometry (or whatever tab you are looking for) after the URL.

Part of the motivation for this was to maintain the tab on a page refresh and to allow us to redirect to specific tabs after certain tasks are done. This could be useful when redirecting from any pages you've overwritten if you include these changes in Saguaro.

This is definitely useful! I would use it when redirecting back to the target page from custom pages I've written.

Would you find it a useful feature for us to include something like a DEFAULT_TARGET_DETAIL_TAB in the settings.py to use as the default active tab for users so this wouldn't have to be overwritten by individual users?

Yes, this would also be useful! Otherwise I don't know a way to set the default tab via the ?tab=photometry method without overwriting the target list page to change all the links there. (If I'm missing something, let me know.)

@jchate6
Copy link
Contributor

jchate6 commented Dec 13, 2023

Resolved by setting the tab-pane to active and implementing the updated target detail javascript from tomtoolkit >= 2.15.12

The additional work of a customizable default tab has been spun off into Issue #783

@jchate6 jchate6 closed this as completed Dec 13, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Merged (to dev) in TOM Toolkit Dec 13, 2023
@jchate6 jchate6 moved this from Merged (to dev) to Released in TOM Toolkit Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants