Can I programmatically open a turbo_frame? - ruby-on-rails

I have a list of documents(index.html.erb) where I can click a document to load details (show.html.erb) in a turbo_frame modal. This works well. There is a preview button that goes to a non turbo view for previewing an attachment. From here I want to click a back button to go back to the index.html.erb page but I'd also like to trigger the show.html.erb modal so they are technically back where they started. I was attempting to just force a redirect in the controller to the documents#show but this changes the route to /show and closing the modal gives you a blank page. Is it possible to open a turbo_frame without a click?

Related

iOS Choose the adapted view

I'm implementing a check module message in my app and I want some advice to choose the adapted view.
When I click on a button, it redirect to a view with all messages. I'll click on a message ( choose it ) and it'll redirect me to a view with more info about this message. I can then go back to the list messages.
Have you any idea about what view I can choose after clicked on the button ?

check in viewWillAppear for tab clicks before refreshing

I have 4 tabs in my application, one of my Tab loads a UIWebview which loads remote html contents. I have code to refresh content in "viewWillAppear" which will refresh the content when you navigate between tabs so far so good.
Here is my problem:
When I click on Tab 1 ( UIWebView) and load an html form which has file upload input field as shown in the screen cap, upon clicking "Choose file" from html form will trigger actionsheet ( shown below) "Take Photo/Video" , this will launch the camera after taking the picture and selecting it will force the UIWebview to refresh ( as the code to refresh is in viewWillApper which will trigger the refresh when coming from camera) which is not right as I don't want my view to refresh when coming from Camera, can someone suggest if there is a way to check in viewWillApper if you are coming from Camera/Gallery or by clicking on tab. Thnx.

Having a popup window able to update the main window

I have a list of items showed on a page. Each item can be clicked and opened in a popup window to be edited. On this popup window, I have a save button.
When this 'save' button is clicked, I would like:
call an action controller to update the database
close the popup window
refresh the main list item (still opened in the background)
Can anyone help me to achieve this? I really don't know how to update the main window (list of items).
Thanks.

iPad: Cannot display Second Modal View Controller after dismiss the first one

Hi I am new to iOS development, and my app i am working on is allow users to log in to the server by using web services, and after the user logged in, he will get a list of the books he's allowed to access and then he select one and do what he needs to do after that.
So here is my problem. There is a "Sign In" button on the main view. After he click the button "Sign In", a modal view poped up asking him to fill in his username/password. I set up the main view controller to be the delegate so that the modal view controller can pass the credentials to the main view controller. After the log in information passed, the main view controller will dismiss the sign in view controller and connect to a server to verify user account. As the response, the server send back a list of book objects. Here I want to use a modal view to populate a UITableView with the book list to let user select from. So in the - (void)parserDidEndDocument:(NSXMLParser *)parser method in main view controller, I put the code to generate and show the second modal view with the book list, and it doesn't show no matter what I do. I know I did get the book list and I know the code to populate the second modal view got executed, but the second modal view just not show.
I read some related questions here and no matter how I dismiss the first modal view, the second one was not shown at all.
Actually I found a solution to it even though it is not a pretty solution at all. All I have to do is just set the dismissModalViewControllerAnimated to NO for the first modal view I dismissed and then I can have my second modal view shown up. I saw somebody used timer but that didn't work for me at all.

Navigate a WebView

With a webview is it possible to set up a simple 'Back' button (either in a navigation bar or a top toolbar) that doesn't show the back button on the first URL of the WebView - and only appearing on a second URL to get back to the first?
Unless I'm getting getting this wrong, in a lot of hybrid native/web apps such as News apps, you often see news articles in a table (HTML page rather than a 'programmed in xcode' table) which hyperlink to article detail pages (again, HTML rather than natively coded) - what I can't figure, is how the detail page (2nd URL in webview) displays with a 'back button' but the table (1st URL in webview) doesn't have the button showing in these type of apps?
Currently, I have a webview as described, with a 'back' bar button item in a toolbar at the top of screen (outlet as 'cangoback' for WebView) but the button is visible when there's no page to 'go back' to -
What I've got simply is:
Webview - 1st URL, HTML table - 'back' button shows, but isn't active (of course)
Webview - 2nd URL, HTML detail page - 'back' button shows, and can go back.
How do you get it to only appear on 2nd URL, or be HIDDEN on 1st URL?
Regards
Randy
You can play with the Navigation Bar's visibility.
Implement this:
[self.navigationController setNavigationBarHidden:YES animated:YES];

Resources