diff --git a/app/helpers/application_helper/navbar.rb b/app/helpers/application_helper/navbar.rb index 0b3dcf4b22d..2ef1b684eb5 100644 --- a/app/helpers/application_helper/navbar.rb +++ b/app/helpers/application_helper/navbar.rb @@ -4,7 +4,6 @@ def menu_to_json(placement = :default) structure = [] Menu::Manager.menu(placement) do |menu_section| next unless menu_section.visible? - structure << item_to_hash(menu_section) end structure @@ -16,6 +15,7 @@ def item_to_hash(item) :title => item.name, :iconClass => item.icon, :href => item.link_params[:href], + :type => item.type, :preventHref => !item.href, :visible => item.visible?, :active => item_active?(item), diff --git a/app/javascript/components/main-menu/helpers.js b/app/javascript/components/main-menu/helpers.js new file mode 100644 index 00000000000..38dd5566002 --- /dev/null +++ b/app/javascript/components/main-menu/helpers.js @@ -0,0 +1,7 @@ +export const getHrefByType = (type, href, id) => ( + { + big_iframe: `/dashboard/iframe?id=${id}`, + // eslint-disable-next-line no-script-url + modal: 'javascript:void(0);', + } +)[type] || href; diff --git a/app/javascript/components/main-menu/second-level.jsx b/app/javascript/components/main-menu/second-level.jsx index b8801f1f591..a2a48a5011f 100644 --- a/app/javascript/components/main-menu/second-level.jsx +++ b/app/javascript/components/main-menu/second-level.jsx @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { MenuItem } from './main-menu'; import { menuProps } from './recursive-props'; +import { getHrefByType } from './helpers'; const SecondLevel = ({ id, @@ -9,9 +10,17 @@ const SecondLevel = ({ href, items, level, + type, }) => (