just added Active Admin to my project. I want hide the Edit & Delete action form the Show page, and Edit & Delete action should present in Index page.
Is there a better way to do this?
Thanks in advance.
Did you try
ActiveAdmin.register FooBar do
config.action_items.delete_if { |item|
# item is an ActiveAdmin::ActionItem
item.display_on?(:show)
}
end
?
you can find other workarounds in this thread https://github.com/gregbell/active_admin/issues/760
Related
I have an issue that When I want to add the room to the Home incase if the user is Guest then I am getting HMErrorCodeInsufficientPrivileges error. I have a view which will display after click on the button named "Add Room", My intensin is I want to detect it when the user clicked on the Add Room button and wants to display the alert without redirecting the user to Add Room View. Thank you for the valuable time. Please let me know if I am not clear.
Finally in iOS 9 I found this solution.
HMUser *adminOrNot = [selectedHome currentUser];
HMHomeAccessControl *homeContr = [selectedHome homeAccessControlForUser:adminOrNot];
if(homeContr.administrator)
{
}
I have to logout a user(admin_user) if the user(admin_user) is not using the application for 15 minutes. How it can be done? I have tried installing activeadmin in my vendor and overriding it(putting devise.rb inside initializers folder inside vendor and write set timeout it did not work), but I don't know how that works. Please help me. I cannot write it in devise.rb as it is done via normal login(user).
Also I have one more query, how the main navigation bar can be changed in activeadmin? I need two menu one in main navigation bar and according sub navigation. Is this achievable through activeadmin?
Jut use config.timeout_in = 15.minutes in your devise.rb initializer.
Active admin has nothing to do with that.
I don't know whether this is the correct way of getting layouts, but I found the solution creating my_navigation resource in active admin.
class MyNavigation < ActiveAdmin::Component
def build(namespace, menu)
if current_admin_user
render :partial => "/layouts/admin_header"
else
render :partial => "/layouts/company_admin_header"
end
end
end
As soon as I click on the "Media" item in my main menu, the following url is generated:
http://test.local/index.php/media-files
Now, I would like to create a module that is displayed only in media-files. Moreover, I want to retrieve the url of this active menu item.
So my question: How can I get the SEF-URL of an active menu item?
Thanks in advance,
enne
I think this might be what you want:
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive()->link;
echo JRoute::_($menu);
I've tested this as well, so let me know if it's what you require.
I am trying to retrieve, modify, and reinsert some text in a pop up dialog using watir web-driver. All was going swimmingly until I tried to find a way to click the "Save Book Info" button pictured here: http://i.stack.imgur.com/pGdln.png
However I am unable to find the button. To access the pop up box I gather all the links with the correct name into an array:
#browser.imgs.each do |img| #The links are imgs
if img.title.include?('Edit/Delete Book')
#books << img
end
end
From there I can access the links with #books[index].click. I am able to access and edit the text_fields with:
url = #browser.text_field(:name=>'url').value
... do stuff with url ..
#browser.text_field(:name=>'url').set url
But when I try and find the "Close" button I only get the buttons that are on the main page. After many headaches I managed to find the title of the window I want to work with using #browser.div(:class=>'dijitDialogTitleBar').title, which returns "Edit Book". Success! No. I still can't figure out how to access the buttons on that popup!
If anyone could help me with this I would be most grateful. This is my first time using Watir so it's probably a simple answer...
If more information is needed I'd be happy to supply it. Thanks in advance.
EDIT
Here is the html for the button:
<span id="dijit_form_Button_2_label"
class="dijitReset dijitInline dijitButtonText"
dojoattachpoint="containerNode">Save Book Info</span>
It looks like you have a span tag that is styled to be looked like a button. You need to access it is a span instead of a button.
Try:
#browser.span(:text => 'Save Book Info').click
I followed this tutorial about ACL - http://community.joomla.org/blogs/community/1252-16-acl.html
To make everything clear: this is what I need:
having a menu item that is linking to an article
a user enters (not logged yet) the web site (it does not matter if the user is already registered or not)
this user should see the menu item
the user clicks on the menu item
if the user is NOT logged in - the user is asked to enter the username/pass
if the user is logged in -> goto 6
after login is ok, the user can see the content of the article where the menu item was linked.
My aim is to have a menu item that would be visible for all users: logged in and not logged in. But when clicked - only logged in users can view the content where the menu item is pointing. In case the user is not logged in -> log in form should be displayed.
After following the above tutorial I got a menu item that is completely invisible for users that are NOT logged in.
How can I make the menu item to be visible for all, but need login to see content?
Thank you.
EDIT 1:
I just found this solution http://docs.joomla.org/Auto_redirect_guests_to_login
Is it the only solution? I have a huge tree menu structure. That means I need to have a clone of my huge menu... And everytime I change a menu item name - I should do it twice (in visible menu and in invisible menu).
Are there any other solutions without having 2 menus?
EDIT 2:
Found another solution (hacking core files).
This is when menu item is set to "public" but the article ACL is set to "registered"
components/com_content/views/article/view.html.php
from
// Check the view access to the article (the model has already computed the values).
if ($item->params->get('access-view') != true && (($item->params->get('show_noauth') != true && $user->get('guest') ))) {
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
return;
}
to
// Check the view access to the article (the model has already computed the values).
if ($item->params->get('access-view') != true && (($item->params->get('show_noauth') != true && $user->get('guest') ))) {
// Redirect to login
$uri = JFactory::getURI();
$app->redirect('index.php?option=com_users&view=login&return=' . base64_encode($uri), JText::_('Members please login to view this page. If you are not a member please <a href="/component/users/?view=registration">register here<a>'));
return;
}
How can I override that code and avoid hacking core files?
Or maybe there is a more elegant solution?
Thanks.
What you can do is a template override and add the login form to the page that provides the message. A template override will allow you to add extras to pages without hacking the core files, therefore when updating Joomla, it will still be there.
For more information on how to override, please see the link below:
http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
Hope this helps.