ActiveAdmin Tabs lazy loading content - ruby-on-rails

i am using ActiveAdmin to show admin graphs to the users. I have a show page with tabs, For each tab i show some graphs, but actually since the show method is called when the user requests the page, all the queries to build all the graphs are called, even if the user is seeing only the first tab. The queries are heavy, so the loading time of that page is large.
Is it possible to launch the queries and execute the related code when the user click on the single tab?

Related

Multiple actions on click - ordering issue

When the user clicks on a link to a subpage, I want to store data in sessionStorage from the current page before leaving to the next page. Then when this new page has loaded, I want to apply the sessionStorage data on this page.
What complicates things is that the link is part a collapsing menu system. Which means that this system needs to update (which is also done on click) before the page data is stored.
So essentially, the wanted execution order:
User clicks link
Menu system is updated
Page data is stored
Browser loads the new page
Page data from the previous page loads and applies on the new page
My issue is the order in which everything is executed. I don't understand when the user clicks on the link how to control the order of when the actions are executed.
Thankful for help

Handling the back button while using multi step remote links

I have a 3 step report which loads by clicking a link with the remote: :true option, so it reloads a part of the page instead of refreshing the whole page. I also provide the user with breadcrumbs, so he/she can easily navigate between the steps. However, most users use the browser back button, which of course reloads the whole page. What is the "Rails way" of dealing with this? If the browser back button is clicked the user should see the previous step in the report.
If you need to control the history the user sees, but aren't doing full page reloads on form submit, you should be manipulating the history state via Javascript's history.pushState and friends.
Assuming the responds to the submitted form is some sort of evaluated Javascript, simply include the history state manipulations there.

Ruby on Rails: Page Redirect Issue

I am having trouble with a page redirect issue in a small multi-step form process within a Rails application. Here's the rundown,
1.) There are 3 pages to this form with a, "save" and "next", button at the bottom of each page.
2.) If a user has filled out new information on the page, and attempts to click the next button, a warning modal popups and prompts the user to save their changes, or discard. This is where my issue is occurring.
3.) Instead of directing the user to the next page as they intended after pressing the modal save button, it instead just refreshes the same page the user is currently on.
I've tried everything, but honestly am not very experienced with Rails. I have made a collection on codepen for you to see all of the files.
Rails Files
Quick breakdown of the three files you will see.
1.) The saveModal is the popup that prompts for save or discard.
2.) Skills is just one of the 3 pages in the form. Any important info for you here would be at the top and bottom of the document I assume.
3.) The controller code where I think the redirect is happening is also there.

How to make the current child page refresh from the master page of an MVC app

I'm developing an MVC application that is essentially a "dashboard" on the home page and the rest of the application is various reports. One of the requirements is to be able to change parameters in the header that affect whatever page you are on. For example, if you are on the home page and looking at data for Group A, you can change to Group B and see the dashboard change. Similar behavior if you are on a report page - change to Group C, and the report refreshes with the appropriate data.
The listing of groups is a dynamically created menu in the master page, so each group option is a link. Normally I'd make each link an ActionLink and direct it to a specific page, but in this case I need the link to write the selection to a database and tell whatever the child page is to refresh.
What's the correct/most efficient/best way to set this up?
I'd consider doing this with a tabbed interface using jQuery UI tabs. In this case each tab corresponds to the action that generates the dashboard for a group. Switching between tabs causes the action for the tab to reload via AJAX the tab's contents. You can use the Cookie plugin to make the tab sticky between sessions -- see the docs for the tabs plugin.

ASP.NET MVC Ajax LoadingELement on loading a page

I'm looking on how exactly I can show a "loading element" while the page is first requested. Most examples I find, explain on how to show a "loading element" on an Ajax.BeginForm or Ajax.ActionLink...
What I'm trying to do is having a couple of dashboards.
When the user requests the page, the dashboards are shown immediately, but the data is still being loaded.
While the data is being loaded, a "loading element" should appear in the dashboard.
So, some sort of Ajax.RenderPartial, but that does not exist :)
In this case you could show the loading element immediately when the page is first requested along with the dashboards and hide it later when those dashboards are finished loading. There's the endRequest event you could subscribe to.

Resources