i am using Zend_Navigation i want to show the nav item in the breadcrumbs but hide it in my menu, how can i do that?
There are many choices, e.g.
You may set visible parameter to false (eg. in xml config file), then use setRenderInvisible(true/false) on the navigation helper,
You may use separate containers,
You may modify the container on the fly (getContainer(), getItemBy()…)
When using an XML config file, use an integer instead of a boolean value:
<visible>0</visible>
An issue has already been logged for this problem here.
Related
I'm building a tabbedpanel which consists of three tabs. I have a tab with form with text fields in it. while I am navigating from this tab I'm unable to loose the state of this tab. Can anyone suggest how to get around it?
Is the Form/ around the TabbedPanel? If YES then you can override
org.apache.wicket.extensions.markup.html.tabs.TabbedPanel#newLink()
And do something like:
form.setModelObject(new EmptyObject())
Or:
form.setModelObject(null)
Or:
use a visitor to set "empty"/null model for each FormComponent in the complete form
Or:
Just in the specific tab by using the passed 'index' parameter to #newLink().
So I have a model (Image) that belongs to another model (Product), and I want to allow a user to manage both of these two types of models, but I don't want to list the model in the navigation menu in RailsAdmin.
Basically of these two I only want Product to be visible in the navigation menu, while allowing the user to still crud their images within the edit/add form of a Product.
Is this possible with CanCan? Or do I need to use CSS to hide these navigation items?
config.model Team do
visible false
end
According to this issue, and this issue your only valid approach would be the CSS approach
I had the same issue, and unfortunately I haven't found any proper solution. The only workaround was to hack Rails Admin using javascript.
So, to hide the model Image from the navigation menu I added this code in 'app/assets/javascripts/rails_admin/custom/ui.js':
$(document).on('rails_admin.dom_ready', function() {
$('ul.nav-pills li[data-model="image"]').hide();
});
I had same issue. fixed using this css
li[data-model="event_date"] {
display:none !important;
}
in your model:
rails_admin do
visible false
end
no need to edit your rails_admin.rb file.
GWT's Editor framework is really handy and it can not only be used for editing POJOs but also for read-only display.
However I am not entirely sure what the best practice is for doing inline edits.
Let's assume I have a PersonProxy and I have one Presenter-View pair for displaying and editing the PersonProxy. This Presenter-View should by default display the PersonProxy in read-only mode and if the user presses on a edit button it should allow the user to edit the PersonProxy object.
The solution I came up with was to create two Editors (PersonEditEditor and PersonDisplayEditor) that both added via UiBinder to the View. The PersonEditEditor contains
ValueBoxEditorDecorators and the PersonDisplayEditor contains normal Labels.
Initially I display the PersonDisplayEditor and hide PersonEditEditor.
In the View I create two RequestFactoryEditorDriver for each Editor and make it accessable from the Presenter via the View interface. I also define a setState() method in the View interface.
When the Presenter is displayed for the first time I call PersonDisplayDriver.display() and setState(DISPLAYING).
When the user clicks on the Edit button I call PersonEditDriver.edit() and setState(EDITING) from my Presenter.
setState(EDITING) will hide the PersonDisplayEditor and make the PersonEditEditor visible.
I am not sure if this is the best approach. If not what's the recommended approach for doing inline edits? What's the best way to do unit-testing on the Editors?
If you can afford developing 2 distinct views, then go with it, it gives you the most flexibility.
What we did in our app, where we couldn't afford the cost of developing and maintaining two views, was to bake the two states down into our editors, e.g. a custom component that can be either a label or a text box (in most cases, we simply set the text box to read-only and applied some styling to hide the box borders).
To detect which mode we're in, because we use RequestFactoryEditorDriver (like you do), we have our editors implement HasRequestContext: receiving a null value here means the driver's display() method was used, so we're in read-only mode. An alternative would be to use an EditorVisitor along with some HasReadOnly interface (which BTW is exactly what RequestFactoryEditorDriver does to pass the RequestContext down to HasRequestContext editors).
Yes,Presenter-View pair should be. But Here two ways to achieve this feature if you like to go with:
1) Integrate Edit/View code design in one ui.xml i.e.Edit code in EDitHorizonatlPanel and View code in ViewHorizontalPanel.The panel has different id. By using id, show/hide panel with display method. if getView().setState() ==Displaying then show ViewHorizontalPanel and if getView().setState()==Editing then show EditHorizontalPanel.
2) Instead of using labels, Use textboxes only. set Enable property is false when you need it in view mode otherwise true
You have created two Presenter/view but I think if Edit/View function has similar code so no need to rewrite similar code again and again for view purpose.
If a big project has so many Edit/View function and you will create such type of multiple View/Presenter than your project size become so huge unnecessary.
I think that whatever I have suggest that might be not good approach but a way should be find out which help to avoid code replication.
I have a CMS base controller that most of my other controllers extend. It has a default action for list, create, read, update and delete actions, all of them set the title based on the name of the resource(s) the user is working with.
The index action defaults to contain only one row:
$this->_forward('list');
Now my problem is that my previously set title is gone when I open the index of a CMS controller. I'd like to know what could be happening and what is the best solution of this.
Note that the problem does not appear if I rename my list action to index. It may also be relevant that changing the view title in the index action does not work.
Hmm, where do you set your title and in what way do you do it? Personally my titles are only two parts like "Application: current action". To achieve this i do the following:
//layout.phtml
<?=$this->headTitle()->setPrefix('APP: ')?>
//indexAction()
$this->_forward('list');
//listAction()
$this->view->headTitle()->append('List Data');
I do this for every action separately and since i do not assign a title within indexAction() i get the full wanted title "APP: List Data" inside listAction(). This remains true if i have my edit action like the following
//editAction()
if (!is_numeric($this->_getParam('id'))) {
return $this->_forward('list');
}
If this doesn't do it for you, your scripts will be needed to look for an error elsewhere :)
Actually, my initial idea of this issue having to do something with routing was right. I'm loading the layout in a preDispatch action of an action controller. So what actually happend was that I re-created my layout view after setting the title attribute in the index action.
I have a custom view displaying a hierarchy model of the current project. The root element is of class MyProject which is my own class, but it represents one Eclipse IProject, and it's adaptable to IProject.
I have a "properties" menu option in the popup menu for that view, and I'd like to open up IProject's properties when a MyProject object is selected. PropertyDialogAction only looks for property pages registered for MyProject and doesn't give me a chance to offer an adapter -- or, at least, I don't know how to offer one.
What's the proper solution for this?
In the meantime, I've overridden PropertyDialogAction to handle my class in the special way I require, but that seems like quite a kludge to get this done.
How did you add the Properties in the Popup menu? Ideally its functionality is to show up the property pages of the current selection - not to show up the properties of the project in which the current selection resides. If you want that, you need to use the menu item Project->Properties - which uses the ProjectPropertyDialogAction instead of the PropertyDialogAction