bohuie / digitalYouth

0 stars 1 forks source link

Remembering Tabs #9

Open RodneyEarl opened 7 years ago

RodneyEarl commented 7 years ago

Current implementations opens up a bug. Anytime the current user goes to another user's navigation pages other than the other user's default (for example, view project) and the current user clicks one of the tabs, it will overwrite their session variable and memorize the new location.

Possible fixes:

  1. Create a second session variable. This creates the issue of memorizing a location on one person, and then going to a 3rd user and not starting at their home page. Have to delete this session variable after everything is loaded or when the user leaves the page.

  2. Just remove the functionality for other user pages. This adds clunkiness.

  3. Have one session variable - does this add a level of confusion?

  4. Create a new session variable for each user page the current user visits. Would get unwieldy.

RodneyEarl commented 7 years ago

Plan of Action: Have created an application filter, can be called on after_action, for any page where the session variable(s) have been read. This works for a single variable. One variable will be for the current user, one for the other pages they visit. We do not need to clear the current user variable - it should persist across pages. The other one is temporary and should be cleared once the current user leaves the page. Use "after_action :clear_tab, only: [:method1, :method2, ...]" to session to be cleared. To consider - is it better to apply to everything and then have exempt for methods?

RodneyEarl commented 7 years ago

After_action does not cover this case. Need to look into possible JS option

RodneyEarl commented 7 years ago

Temporary workaround in SearchesController (since this acts as a flow from one user to the next, however that will not work once we have following, etc.).