add_edit_bar = ({
  role,
  title,
  contents,
  what,
  url,
  req,
  viewtemplate,
  table,
  view,
  cfgUrl,
}) => {
  if (req && req.headers.localizedstate)
    return { above: [contents], noWrapTop: true };
  if (role > 1 && req && req.xhr) return { above: [contents] }; //make sure not put in card
  if (role > 1) return contents;

  let viewSpec = "";
  if (viewtemplate) viewSpec = viewtemplate;
  if (table) {
    const tbl = Table.findOne(table);
    if (tbl)
      viewSpec = `${viewSpec} on <a href="/table/${table}">${tbl.name}</a>`;
  }
  const singleton = view?.viewtemplateObj?.singleton;

  const bar = div(
    { class: "card p-1 mt-1 mb-3 d-print-none admin-edit-bar" },
    div(
      { class: "card-body p-1" },
      i({ class: "fas fa-user-cog me-1" }),
      what && span({ class: "ms-1 me-2 badge bg-secondary" }, what),
      title,
      !singleton &&
        a(
          { class: "ms-2", href: url },
          "Edit&nbsp;",
          i({ class: "fas fa-edit" })
        ),
      cfgUrl && !singleton
        ? a(
            { class: "ms-1 me-3", href: cfgUrl },
            "Configure&nbsp;",
            i({ class: "fas fa-cog" })
          )
        : "",
      !singleton && viewSpec
    )
  );

  if (contents.above) {
    contents.above.unshift(bar);
    return contents;
  } else return { above: [bar, contents] };
}
Add Edit Bar
@param {object} opts
@param {*} opts.role
@param {*} opts.title
@param {*} opts.contents
@param {*} opts.what
@param {*} opts.url
@param {*} opts.req
@returns {object}