grails modalbox redirect back to parent window - grails

I am new to grails, and I have been trying to get the following functionality to work.
I am using grails modal box, and I have a save button. When I click on save, how can I close the modal box, and pass a variable back to the parent window?

I think I'm doing what you want in my Customer Change actions in a couple screens at http://ibidem.cloudfoundary.com. Login as ibidem/ibidem and do a Customer Change on a Lookup Table.
Then if this is what you want, see
https://trac.maflt.org/web/ibidem/browser/trunk/src/ibidem/grails-app/views/lookupTable/show.gsp
and the corresponding controller:
https://trac.maflt.org/web/ibidem/browser/trunk/src/ibidem/grails-app/controllers/org/maflt/ibidem/LookupTableController.groovy

Related

Umbraco - Reading the nodes

I have a umbraco solution, which has a below piece of code in my view,
var home = Model.AncestorOrSelf(1);
var primaryNav = home.GetPropertyValue<IEnumerable<IPublishedContent>>("primaryNav").Where(n => n.GetPropertyValue<bool>("hideFromNavigation") == false);
From my Umbraco back office, can someone please tell me how can i find the nodes which satisfy the above piece of code.
I'm trying to a new node to the existing navigation bar, but it is not coming up. What could i be missing here?
Please let me know, i'm new to umbraco.
My Umbraco version is 7.2.1
Also, what could be the meaning of "primaryNav", here home.GetPropertyValue<IEnumerable<IPublishedContent>>("primaryNav")
Go to the root page of the website in the back office content tree. On that page there should be a content picker called something like "Primary Nav".
That should show up all of the selected items that should appear. It's also checking for a hide from navigation property, which you'd have to check individually on each of the selected nodes.
How are you trying to add the node to the menu? If it's via the picker, then it SHOULD work, unless the page has the hide from navigation checkbox checked. Also make sure you publish the root page once you've added the page to the picker rather than just saving.
The only other thing that might be causing it to not show up would be if the Partial that renders the navigation is being cached. Look in the view and see if it's using CachedPartial, and if so, that may be your culprit.

How to have one button do both "enable" and "disable" in ASP.net MVC

I am new to ASP.Net MVC, and still trying to wrap my head around the controller and passing data to the view and back.
Here is my question. I have a model in my view with a property that is "isEnabled", which can be true or false.
I have an edit button, and an enable/disable button. Edit just takes me to a new view with a form.
I want the enable/disable button to change the property of the model to enabled or disabled.
Right now I have two separate buttons. When I click on them, it fires the appropriate action from the controller (EnableModel, DisableModel), and just reloads the current view.
How can I make it so, if the model is disabled the button shows and fires the enable action, and when it is enabled, the button shows and fires the disable action.
So here are the options I thought of.
1. Two buttons, I hide them as needed. I can use an if statement to check if the model is showing or not in razor.
2. Use javascript two to the above
3. Use javascript to physically change the button
What would be the best method?
Alright so looking back can't believe I ever even asked this haha.
I went the javascript route. I had a single button, and a simple onClick javascript class that would handle the toggling.

MVC 4 accessing model list on click

I have an mvc app where I pass a list to a view. In a most click, I want to be able to render the next item in the last but am having trouble figuring out how to do that efficiently. My approach originally was to use an index i but I realized that one the page is rendered, accessing my model last at i will always leaf to the same result since that item in the list is rendered on page load and can't just be accessed dynamically. Any insight to an approach for this problem?
The model can't be accessed as it's only used on the server side.
There are a few ways of solving the problem, you can use Knockout.js or similar client side view model components, once the user click on the button just render then next item from the knockout model.
Or use AJAX to retrieve the next value from the back end and then render it to the screen.
Or generate the whole screen and just hide all items from the user and then display them once the user clicks the button

Go back to previous view, but al values of dropdowns are gone in Ruby On Rails?

I am implementing in Ruby on Rails, and I have a view, with all sort of elements, like checkboxes, dropdownlist and so on. So if I go to the next view, and then I click on back in my browser, everything is like I filled in, like I checked the checkboxes and things like that. This is how I want, it, but now I want to implement a button, just to go back to that view, i have for this button :
redirect_to request.referrer
or i tried as well
redirect_to the previous view
but when I do this, I go back, but everything is set to default again. Checkboxes aren't checked... Does someone know what to do, to get the view back like I filled it in, like I get when i click on Back on my browser?
The quick and dirty way would be to do it in javascript I guess:
Back
However there might be problems with some or older browsers, since these values are remembered by the browser.
If you want to do it the right way, you would have to save your data in a session first, and then populate the fields with the session data.

How to build a tabbed Edit View for a big ViewModel in ASP.NET without JavaScript?

I've got a big ViewModel for a ContactViewModel with several addresses (default, invoice, delivery). This ContactViewModel I would like to edit within a DefaultAddress tab, etc. and I would like to know how to handle this without JavaScript? Is this possible?
Tell me if I'm off base here;
The way i think i'd approach this is to create a partial view which takes a list. the partial view would itterate through the list and create another partial view which is the tab.
on click of the tab i'd do a postback and store the clicked tab. this id then becomes the active tab.
when i come back to rebuild my page, the partialview for the actual tab would need to check to see if it's active and then make itself visible. if not visible then simply render nothing maybe.
This can be done with CSS. Here is an example: http://www.alistapart.com/articles/slidingdoors/
The selected tab/view will need to be rendered on the server. I can see each tab being a link, when the link is clicked the correct view and selected tab is returned.
Some of the css tabs don't work correctly in IE6. I'm not sure if the above link is one of them.

Resources