SmartUI inlineActionbar - how to make your custom command to be the first in the inlineActionbar?

Hi,

Can someone help me with making custom command to be shown in the inlineActionbar with icon (not under "..." menu)?

I assume it is because it has 5 items by default to be shown first.

here is the code I have:

define(['i18n!olylak/reprint/impl/nls/lang'
], function (lang) {
  'use strict';

  return {

    otherToolbar: [
      {
        signature: 'reprint',
        name: lang.toolbarButtonTitle
      },
    ],

    inlineActionbar: [
        {
            signature: 'reprint',
            name: lang.toolbarButtonTitle,
            icon: "icon icon-toolbar-metadata"
        }   
    ]
  };

});

Thanks in advance for any help.

Regards,
Oleh Lylak.

Comments

  • try this :
    inlineActionbar: [
    {
    signature: 'reprint',
    name: lang.toolbarButtonTitle,
    icon: "icon icon-toolbar-metadata",
    group: "info"
    }
    ]

  • @pnocera@globalcents.com said:
    try this :
    inlineActionbar: [
    {
    signature: 'reprint',
    name: lang.toolbarButtonTitle,
    icon: "icon icon-toolbar-metadata",
    group: "info"
    }
    ]

    Hi,

    Thanks a lot for you response! It's working :)

  • @pnocera@globalcents.com said:
    try this :
    inlineActionbar: [
    {
    signature: 'reprint',
    name: lang.toolbarButtonTitle,
    icon: "icon icon-toolbar-metadata",
    group: "info"
    }
    ]

    Hmm, the issue is that it's not coming up the first time you open a folder and hover the document. But when you click "..." item and it does backend validation. After that when you hover again the command is shown.

    In my case the logic to show it or not is done on backend inside Menus2NodeAction::IsSelectable() function.

  • I have a question about this too.  Perhaps this is a moronic question but in the above JSON block, are those CSS styles, and I presume you would stick something in your command's CSS to point to the graphic represented by icon-toolbar-metadata?
    The other question I have about commands is how do you make them only appear on either certain MIME types or certain subtypes, much like the WebNodeCommand object in Oscript has an _Enabled() function to make that determination on page load, or is that possible in smart UI?
    -Hugh
  • Hi Hugh, the commands have an enabled function which is quite similar to the OScript _Enabled()
    If you wish to enable the command based on certain criteria, coming from the node and from module configuration setting ( eg a list of mimetypes ), there's a good blog article here : https://pos2007.de/config-settings-send-to-a-smartui-module 
    From this the enabled function on your command could be something like 
    enabled: function(status) {
          var config = module.config();
          var node = CommandHelper.getJustOneNode(status);
          if (node) {
            var mt = node.get('mime_type');
            if (mt !== undefined && mt !== null && mt !== '') {
              var mte = config.MIMETypeExclusions;
              if (mte !== undefined && mte !== null && mte !== '') {
                var excluded = config.MIMETypeExclusions.split(',');
                if (excluded.length > 0) {
                  return excluded.indexOf ( mt ) === -1;
                }
              }
              return true;
            }
          }
          return false;
        },
  • Merci Pierre, c'est geniale.  Je vais essayer quelque chose comme cela quand j'ai la chance.  Les meilleures réponses viennent toujours des partenaires.  :)  I'm totally going to use this in the module I'm building to limit where and when my extended commands show up.
    I also read Reiner's blog (starting to become the definitive source of Smart UI documentation).  I can totally see a use for extending the default config object so I'm going to try that in a module I'm building.
    But back to the icon. First, assuming those are styles, are those two styles both ones you defined, or are they OT styles?
    -Hugh


  • well this is in your template.
    ...and you HAVE TO set your icons as svg, otherwise the gulp build won't copy them to the bundle. And you'll spend hours trying to find why the  >:) these icons won't display  B)
  • Merci encore Pierre.  I'll be trying this out for sure.
    -Hugh
  • Hi Pierre (and anyone from OT DEV can chime in as well),
      When I tried to use the config object, I found that module object doesn't exist.  How do you get the module object from which you can get the config that should be passed by your CSUIExtension?  I noticed that some things have changed since Reiner's blog as well. The GetDynamicConfig returns a rather large Assoc by default where as at the time he wrote his blog, it returned undefined.
      I'm on a CS 20.2 instance.
    -Hugh
  • Simply requirering "module" helps.
    My config for the azure translation keys via Admin Pages-> js in the mlm Panel  runs that way