I need add two action into submit button, I succeed on that but because I can't find correct function from API, there is two buttons. Like this
I want it like this:
What I have tried
form.addSubmitButton({ label: 'Action 1'});
form.addSubmitButton({ label: 'Action 2'});
And
form.addSubmitButton({ id : 'action', label: 'Action 1'});
form.addSubmitButton({ id : 'action', label: 'Action 2'});
And
form.addSubmitButton({ id: 'action1', label: 'Action 1'});
var test = form.addSubmitButton({ id: 'action2', label: 'Action 2'});
test.isHidden = true;
Something that worked for me was adding the name attribute to each submit button using client script. That way when the user clicks it will send the name as a parameter.
Related
I attempt to add a button onto my action on Google assistant, but the code only works for the first one. Here is where I add in the button for the ones that don't work:
'Biology': {
title: 'Biology',
text:'Press the button to visit our site for more info. Biology is an important subject for those who are willing to take it, and this website will provide you' +
'with the necessary skill for this subject.',
image: new Image({
url: 'https://www.edzuki.com/biology/Biology+Edzuki.jpg',
alt: 'Biology as a subject',
}),
button: new Button({
title:'Click for the Biology Page',
url: 'https://www.edzuki.com/biology/',
}),
and, for some reason, this one works
'Art': {
title: 'Art',
text:'Press the button to visit our site for more info. Art is an important subject for those who are willing to take it, and this website will provide you' +
'with the necessary skill for this subject.',
image: new Image({
url: 'https://www.edzuki.com/art/Art.jpg',
alt: 'Art as a subject',
}),
buttons: new Button({
title: 'Click for Art',
url: `https://www.edzuki.com/art/`,
}),
display: 'WHITE',
},
for const subjectCard (a basic card).
No errors are thrown by the assistant, just no button is visible. Why is this?
Thanks in advance.
In your first example you use the key button for your button, but in the second example you use buttons with an 's'. The docs also suggest you should be using the plural version buttons and your own code should show you this works based on your second working example
https://developers.google.com/actions/assistant/responses#basic_card
e.g
'Biology': {
title: 'Biology',
text:'Press the button to visit our site for more info. Biology is an important subject for those who are willing to take it, and this website will provide you' +
'with the necessary skill for this subject.',
image: new Image({
url: 'https://www.edzuki.com/biology/Biology+Edzuki.jpg',
alt: 'Biology as a subject',
}),
buttons: new Button({
title:'Click for the Biology Page',
url: 'https://www.edzuki.com/biology/',
}),
How can we customize an ActiveAdmin page for different users based on their role:
ActiveAdmin.register_page 'Dashboard' do
content title: 'Admin Content' do
# show this only to admins
end
content title: 'Reviewer Content' do
# show this only to reviewers
end
end
After trying several complicated things, the solution was straightforward:
ActiveAdmin.register_page 'Dashboard' do
menu priority: 1, label: proc { I18n.t('active_admin.dashboard') }
content title: proc { I18n.t('active_admin.dashboard') } do
render partial: current_user.admin? ? 'admin_dashboard' : 'content_dashboard'
end
end
Then you can render those partials based on roles.
When using the telegram API (in my case using telebot:https://github.com/kosmodrey/telebot)
How can link to a bot_command with a parameter ?
For example i want a bot that shows information about some fruits and i have
['apples','pears','bananas']
i can do /show [fruit] to show details about each fruit and /list to
show a list of all fruits.
When i do /list i want to show it like this:
You currently have 3 fruit:
APPLES PEARS BANANAS
However i want these to be clickable and once the user clicks a fruitname, he
will be directed to /show [clicked fruit].
i tried with a normal a href in { parse_mode : HTML } but that doesn't
seem to work.
Use inline buttons. They work the way you described. For example:
var options = {
reply_markup: JSON.stringify({
inline_keyboard: [
[
{text: 'button 1', callback_data: '1'},
{text: 'button 2', callback_data: '2'},
{text: 'button 3', callback_data: '3'},
],
]
})
};
bot.sendMessage(chatId, 'Pick action:', options);
You can think of them as anchor tags. They appear along with the text in chat window, and scroll with the text, but you can click on them. Non-inline buttons are more like a permanent menu.
Example above is using this library.
I'm trying to add a colorbutton in a TinyMCE dialog box to replace my old color selector which was initially created with a select input.
See : ColorButton : API 4.X
This class creates a color button control. This is a split button in which the main button has a visual representation of the currently selected color. When clicked the caret button displays a color picker, allowing the user to select a new color.
I can add and see the new colorbutton in the dialog box but it doesn't show the colorpicker when clicked.
Here is my code:
editor.windowManager.open( {
title: 'Choose color',
body: [
{
type: 'listbox',
name: 'bg-color',
label: 'Color (select)',
'values': [
{text: 'White', value: '#FFF'},
{text: 'Black', value: '#000'},
{text: 'Silver', value: 'silver'},
]
},
{
type: 'ColorButton',
name: 'bg-color2',
label: 'Color (colorpicker)',
},
],
onsubmit: function(e) {
// Do something here
}
});
And you will find a tinymce fiddle here to illustrate this issue:http://fiddle.tinymce.com/sfeaab
Since my debugger doesn't show any JS error, is there something wrong in this code or is there another way to add a colorpicker in a dialogbox?
Thanks!
#MavBzh I think you've a wrong perception on how the color button works. The ColorButton UI is only help with rendering a button which not much difference with PanelButton UI. you can see this example http://fiddle.tinymce.com/sfeaab/3 in this fiddle I use textcolor plugin example.
So, in order to use color button you're required to specify the Panel to hold the color picker.
{
type: 'colorbutton',
name: 'color',
text: 'Color',
selectcmd: 'ForeColor',
panel: {
role: 'application',
ariaRemember: true,
html: renderColorPicker,
onclick: onPanelClick
},
onclick: onButtonClick
}
then later set onclick callback action and render the color picker HTML output yourself, the renderColorPicker function is used as the panel content, then assigned onPanelClick callback to put the color to the text placeholder in the ColorButton.
PS: in the fiddle I used v4.0.21
Is it possible to create a item in a tabbar-ed card layout, that has no tab?
I want to create a message overlay that stretches from screen top to the tab bar and doesn't cover the tab bar. When i do this by adding an item to the panel everything works fine except a blank icon is created on the tabbar. Is there a way to prevent this icon from being created?
you can create the new item with hidden: true config option
Ext.define('App.view.settings.SettingsContainer', {
extend: 'Ext.tab.Panel',
xtype: 'settingsContainer',
requires : [
...
],
config: {
tabBar: {
docked: 'top'
},
tab: {
title: 'Settings',
iconCls: 'user'
},
items: [{
xtype: 'settingsAccountContainer'
}
, {
xtype: 'changeCompanyView',
hidden: true
}]
}
});
changeCompanyView is created, but no tab icon is visible.
It could be activated by
settingsContainer.setActiveItem(1);
Cheers, Oleg
This should work. Add the overlay to the child item and not the tab panel.
childPanelItem.add(
Ext.create('Ext.Panel',
{
xtype:'panel',
html:'Demo',
top:0,
left:0,
right:0,
bottom:0
}
)
);
If you add to the child panel the icon will not appear on the tab bar.