How to remove default links on navigation bar and change their order - activeadmin

As title,
I want to remove the default links assets, comments
and change the remaining links order, how to do it ? thanks

In initializers/active_admin.rb
config.comments_menu = false
That will remove comments from the menu.
If you want to customize the menu further, remove assets, or keep comments and move them to a dropdown you can build a menu. Just omit any label that you'd like hidden from the menu.
config.comments_menu = false
#....
config.namespace :admin do |admin|
admin.build_menu do |menu|
menu.add label: 'Dashboard', priority: 0
menu.add label: 'Revenue', priority: 3
menu.add label: 'Costs', priority: 4
menu.add label: 'Categories', priority: 5
menu.add label: 'Users & Comments', priority: 6
menu.add label: 'Comments', parent: 'Users & Comments', url: "/admin/comments"
end
end

Related

How to access value of switchable fieldType dialog in magnolia 6.2 using .ftl languange

FYI I'm new in magnolia,
I'm trying to use switchable type field in dialog, here is my YAML look like :
form:
label: Confirmation Pop Up
tabs:
- name: Menu
label: Menu
fields:
- name: linkUrl
fieldType: switchable
label: Link Button Reject
class: info.magnolia.ui.field.ConfiguredSwitchableFieldDefinition
transformerClass: info.magnolia.ui.form.field.transformer.composite.SwitchableTransformer
options:
- name: intLink
label: Internal URL
selected: true
value: intLink
- name: extLink
label: External URL
value: extLink
fields:
- name: intLink
class: info.magnolia.ui.form.field.definition.LinkFieldDefinition
targetWorkspace: website
fieldType: link
appName: pages
label: Link Internal
description: Choose a page to link .
identifierToPathConverter:
class: info.magnolia.dam.app.ui.field.definition.DamUploadFieldDefinition
- name: extLink
label: Link External
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
actions:
commit:
class: info.magnolia.ui.admincentral.dialog.action.SaveDialogActionDefinition
cancel:
class: info.magnolia.ui.admincentral.dialog.action.CancelDialogActionDefinition
I can get this value
options:
- name: intLink
label: Internal URL
selected: true
value: intLink
- name: extLink
label: External URL
value: extLink
by calling ${content.linkUrl} which will show "intLink" or "extLink",
so, how do I get value of this :
fields:
- name: intLink
class: info.magnolia.ui.form.field.definition.LinkFieldDefinition
targetWorkspace: website
fieldType: link
appName: pages
label: Link Internal
description: Choose a page to link .
identifierToPathConverter:
class: info.magnolia.dam.app.ui.field.definition.DamUploadFieldDefinition
- name: extLink
label: Link External
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
Could anyone help me on this please?
If you look in the JCR for that node you'll probably see an item called linkUrlintLink and linkUrlextLink This is because the values aren't getting transformed and by default, the switchable field will concatenate the names. You should be able to access them through ${content.linkUrlintLink and ${content.linkUrlextLink. You also can use the DelegatingCompositeFieldTransformer class to strip the prepended name of the field names.

Can you add separators to dropdown menus in activeadmin

Is there a way to add separators to a dropdown menu in activeadmin?
For example, if I wanted a separator between the first and second items, how can I do that?
menu.add label: 'Tasks', priority: 10 do |tasks|
tasks.add label: 'Add News Item',
url: proc { new_feed_path },
if: proc { authorized? :create, Feed },
priority: 14
tasks.add label: 'Add Calendar Event',
url: proc { new_event_path },
if: proc { authorized? :create, Event },
priority: 15
end
I checked the documentation but don't seem to see anything for that.
As of writing this comment, ActiveAdmin is at version 1.2.1 and based on its code, it isn't possible to add separators/dividers in a dropdown menu. :(
I just checked on the Github repo and they have no opened issue nor pull request matching the "separator" or "divider" keywords.
Maybe the first step would be to open an issue describing what and how to implement it.
Nothing is preventing us from adding a divider manually:
menu.add label: 'Tasks', priority: 10 do |tasks|
tasks.add label: 'Add News Item',
url: proc { new_feed_path },
if: proc { authorized? :create, Feed },
priority: 14
tasks.add label: "<hr>".html_safe,
url: "javascript:void(0)",
priority: 15
tasks.add label: 'Add Calendar Event',
url: proc { new_event_path },
if: proc { authorized? :create, Event },
priority: 16
end
a url attribute is required so using javascript:void(0) is an option here as # will not render the label. This question discusses javascript:void(0)

How to disable doubleclick ActionButton in ActionGroups in Kivy?

Iwant to have a drop-down menu in my ActionBar.
An actiongroup in a spinner mode does what I want to have. The only problem with this solution is that ActionButtons need to be double-clicked (or longer-clicked) inside the Actiongroup, while outside of it they could be single-clicked. I would like to use singleclicks.Could anyone help me with this?
Using: Python 3.4 ; Kivy 1.8.0; Win 7
#menu-line on the top
ActionBar:
size_hint: 1, None
ActionView:
use_separator: True
ActionPrevious:
title: 'title'
with_previous: False
disabled: True
ActionButton:
text: 'button'
ActionGroup:
mode: 'spinner'
text: 'Languages'
ActionButton:
text: 'German'
on_press: root.do_something()
ActionButton:
text: 'English'
on_release: root.do_something()
warning: The answer isn't pretty.
If you follow this issue, you'll see that the problem is that ActionButtons event's aren't mapped. The solution involves giving the ActionGroup an id so that it can be referenced, changing the mode to spinner(which you've already done), and connecting the ActionGroup._dropdowns select event to your callback:
#menu-line on the top
ActionBar:
size_hint: 1, None
ActionView:
use_separator: True
ActionPrevious:
title: 'title'
with_previous: False
disabled: True
ActionButton:
text: 'button'
ActionGroup:
id: action_group
mode: 'spinner'
text: 'Languages'
ActionButton:
text: 'German'
on_release: action_group._dropdown.select(root.do_something())
ActionButton:
text: 'English'
on_release: action_group._dropdown.select(root.do_something())

Extjs make west panel expanding over the center panel

I have this border layout: http://jsfiddle.net/rGM2t/1/
Running expand function: Ext.getCmp("west").expand(); will shrink the center in order to make room for west.
How can I dynamically expand west and force him to go over center and not shrink it?
Is there anything like Ext.getCmp("west").softExpand();?
Ext.create('Ext.panel.Panel', {
width: 500,
height: 400,
title: 'Border Layout',
layout: 'border',
items: [{
title: 'West Region is collapsible',
region:'west',
xtype: 'panel',
margins: '5 0 0 5',
width: 200,
collapsible: true,
collapsed : true,
id: 'west',
layout: 'fit'
},{
title: 'Center Region',
region: 'center',
xtype: 'panel',
margins: '5 5 0 0'
}],
renderTo: Ext.getBody()
});
Ext.getCmp("west").expand();
You would need west to float. But putting floating elements in a border layout doesnt make much sense. You could use a Window component (which is just a customized floating Panel) to float over the center and the west, and then when the window closes you again see your west and center as before.
something like this maybe: http://jsfiddle.net/3bDWU/

Why does my gridPanel in a tabPanel show the wrong height?

In the attached image, the grid does not show properly. The grid is inside a tabpanel. The layout of the tab is = 'fit'.
What setting error is causing the behavior?
EDIT:
Here is the class definition for the tabpanel: Our tab is the one called 'External ID'
/*
* File: SomeTabPanel.ui.js
* Date: Mon May 02 2011 18:08:34 GMT-0400 (Eastern Daylight Time)
*
* This file was generated by Ext Designer version xds-1.0.3.2.
* http://www.extjs.com/products/designer/
*
* This file will be auto-generated each and everytime you export.
*
* Do NOT hand edit this file.
*/
SomeTabPanelUi = Ext.extend(Ext.TabPanel, {
activeTab: 0,
forceLayout: true,
border: false,
enableTabScroll: true,
initComponent: function() {
this.items = [{
xtype: 'panel',
title: 'General',
layout: 'table',
tpl: '',
ref: 'GeneralTab',
layoutConfig: {
columns: 2
},
items: [{
xtype: 'form',
title: 'Corporate',
height: 500,
width: 500,
animCollapse: false,
items: [{
xtype: 'box',
ref: '../../coporateBox'
}]
}]
},{
xtype: 'panel',
title: 'External ID',
layout: 'fit',
ref: 'ExtIdTab',
id: ''
}];
SomeTabPanelUi.superclass.initComponent.call(this);
}
});
Looks like you need to set a height for the grid somehow. Either a manual height declaration, autoHeight: true, or inherited height from a parent container.
Does the parent tabPanel have a height declared/inherited?
Setting layout: 'fit' is a good start for the containing tab, but without some code or a test case, I can't be more helpful.
It should work as described, so you must have something wrong in your code. Post your layout code if you want more help.

Resources