ActiveAdmin create/update controller - activeadmin

In my create method in controller, how to decide which to use: create! or super?
Also, what's the difference between
super do |format|
and
super do |success, failure|
Thank you

ActiveAdmin uses InheritedResources. The InheritedResources README explains "calling super is not very readable. That's why all methods have aliases". The bottom of that section also shows how update! do |success, failure| provides a more compact alternative to update! do |format| when you want to override the default success/failure behaviour.

Related

How to modify Hybris Backoffice refocus functionality

I'm trying to modify the backoffice refocusing functionality. Not sure exactly where the behavior is taking place but I believe the class is the FocusUtils.java (com.hybris.cockpitng.editor.util) This util class is used in the DefaultEditorAreaValidationHandler.onEvent().
The action takes place in the summary-view of a product in the "Data Quality" section. Here the user can see what fields are missing or are needing to be filled. They can click on the attribute listed and the editor will refocus on the selected field. Currently the refocusing is working with the OOTB implementation BUT it cuts off the label to the fields at times. I would like to slightly modify this util class (override) and use the custom implementation instead.
Field label is cut off
What should be dispalyed instead:
Field label is displayed correctly
The only way to do this from what I can see is by modifying/replacing the widget implementation that is using this logic. Basededitorarea widget (com\hybris\cockpitng\widgets\baseeditorarea) and specifically having to override bean definition of the below bean and additional classes as well.
<alias name="defaultEditorAreaValidationPopupDelegate" alias="editorAreaValidationPopupDelegate" />
This is the only bean I see that is defined in the backoffice-widgets-spring.xml that eventually touches this focus logic. This is like the starting point. Ideally, it would be nice to just make changes to the actual util class or replace it with a custom one rather than having to duplicate many other classes.
Does anyone know if this is the correct approach to doing this? or if anyone has any alternative suggestions that would be great.

Alfresco replace component advsearch

i successfully modified alfresco advseach.
Now i have to replace the original. I really don't know how can i do this, until this moment i was working in share/target but i can't do that anymore. I need to somehow rewrite default url of advsearch. I need that Alfresco call my advsearch instead of default advsearch after clean installation or after command mvnclean.
I think that this should working:
<extension>
<modules>
<module>
<id>ADVSearchExt</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<components>
<component>
<region-id>search</region-id>
<source-id>advsearch</source-id>
<scope>page</scope>
<url>/comp/advsearchext</url>
</component>
</components>
</module>
</modules>
</extension>
It looks like you've created an alternative WebScript for the Component and you wish to swap it out. It's not possible to reconfigure an existing Component configuration as you are trying to do. What you actually need to do is to create one extension to remove the default component (see this blog post) and then provide another component to render your WebScript (see this blog post).
NOTE: On subsequent reading of the question, I've realised that this original answer doesn't directly answer the question, however it does contain useful related information... I'll try and answer the actual question as well!
Assuming you're using Alfresco 5.0 or 5.1 then the only way of accessing the advanced search page (via standard navigation) would be via the drop-down menu option in the header bar.
The header bar is an rendered by Aikau and it is a relatively simple exercise to customize the header bar to navigate to an alternative page when you click on that "Advanced Search..." menu item.
This blog post is the first in a 3-part series describing how you can customize the header bar.
The widget that you need to customize is the "alfresco/header/SearchBox" widget. Unfortunately, at the moment it doesn't off a simple configuration option for changing the page to navigate to. In this scenario you could raise an issue on the Aikau Github page to make a request for this feature to be added. This would require that you wait for the feature to be included in a future release (releases are weekly) and then make use of that new configuration option.
The alternative would be to extend the default SearchBox widget and create a new extension module that swaps out the default SearchBox with your custom version. You would need to extend the postCreate function and remove alfresco/menus/AlfMenuItem that is created and replace it with one that has an appropriate targetUrl.
Unfortunately this is neither the most future proof or simplest solution, but is is possible. The most future proof solution (in terms of working with future upgrades to Alfresco) would be to make the feature request as clearly there are benefits to being able to reconfigure the advanced search page.

Liferay overriding JSONAction using hook

Liferay has feature to modify Struts Action using hook which is straight-forward. However I am trying to override getJSON method of RateEntryAction.
The use case is I need total positive score and total negative score instead of average score that Liferay's OOTB rating component provides.
I already have necessary methods readily available in Liferay API to get the total positive and negative scores. I created a custom type just like "stars" and "votes" to write my necessary logic in hook. I was then planning to override struts action represented by /portal/rate_enty to override the method and add negative and positive votes in the json that is already being returned.
But RateEntryAction (which is the original class) is extending JSONAction and overriding getJSON method. Is it possible to override just getJSON method using struts action hook?
I can see this action class in struts-config.xml, so it's a Struts Action.
This is the path you could try to override.
<action path="/portal/rate_entry" type="com.liferay.portal.action.RateEntryAction" />
I would try to override this path, and see if can put your logic there.
RateEntryAction extends from JSONAction , and this one from org.apache.struts.action.Action , which is the same class that PortletAction extends.
Hope this help
As per my research we can only hook com.liferay.portal.struts.PortletAction sub classes, Yeah JSONAction also extend org.apache.struts.action.Action class same as PortletAction, but liferay allow only those classes hookable which comes under PortletAction class not except that.
As RateEntryAction is not a Struts Action, you can't overload it with a Struts Action Hook. I'm not aware of any hookable way to override it, thus my best guess is that you'll have to either go for ext or introduce a whole new JSON API function and hook all places in Liferay that refer to the original implementation to now go to your implementation.
I suspect that in this case an ext plugin will be easier to maintain. Someone correct me if I'm wrong.

how to disable UITextTapRecognizer on a UITextView

I want to try to disable the UITextTapRecognizer, which I think is a built in property of the UITextView, as I suspect it is interfering with a tap gesture recognizer that I want to implement. How is it possible to do this?
Thanks for reading!
I'm not sure this answers your question directly (i.e. "disable the UITextTapRecognizer"), but I think it might help. You can prevent that tapRecognizer from recognizing gestures, thereby basically "disabling" it (I think).
"You can prevent gesture recognizers from looking at specific touches
or from even recognizing a gesture. You can specify these “prevention”
relationships using either delegation methods or overriding methods
declared by the UIGestureRecognizer class.
The UIGestureRecognizerDelegate protocol declares two optional methods
that prevent specific gesture recognizers from recognizing gestures on
a case-by-case basis."
Try the gestureRecognizerShouldBegin: or gestureRecognizer:shouldReceiveTouch: delegate protocol methods.
"In addition, there are two UIGestureRecognizer methods (declared in
UIGestureRecognizerSubclass.h) that effect the same behavior as these
delegation methods. A subclass can override these methods to define
class-wide prevention rules."
look at:
- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer;
- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer;
source: Apple docs (event handling guide for iOS)
I hope it helps!

libary control for Xpages and using ssjs for defaultvalues/validators

I' working on a libary control for Xpages and need some help in creating.
I would create an control wich reads a configuration file and creates controls in a table, controls like Editboxes, checkboxgroups and so on.
Ive Build my control like Keith Strickland
in his Bolg entry
http://xprentice.gbs.com/A55BAC/keithstric.nsf/default.xsp?documentId=82770C11FA7B9B21852579C100581766
so and now to my queststion:
I would store in my configuration ssjs code for computing a defaultvalue or an validation
but how could I compute the ssjs?
the automatic generated code from the Designer uses a PageExpressionEvaluator Object but I couldent create one by my self.
someone an Idea?
You can use the ExpressionEvaluatorImpl class instead:
com.ibm.xsp.page.compiled.ExpressionEvaluatorImpl( facesContext )

Resources