2021-04-18 14:34:55 +03:00
# frozen_string_literal: true
2020-07-27 11:49:23 +03:00
module AdditionalsRoutesHelper
def _dashboards_path ( project , * args )
if project
project_dashboards_path ( project , * args )
else
dashboards_path ( * args )
end
end
def _dashboard_path ( project , * args )
if project
project_dashboard_path ( project , * args )
else
dashboard_path ( * args )
end
end
def _dashboard_async_blocks_path ( project , * args )
if project
project_dashboard_async_blocks_path ( project , * args )
else
dashboard_async_blocks_path ( * args )
end
end
def _edit_dashboard_path ( project , * args )
if project
edit_project_dashboard_path ( project , * args )
else
edit_dashboard_path ( * args )
end
end
def _new_dashboard_path ( project , * args )
if project
new_project_dashboard_path ( project , * args )
else
new_dashboard_path ( * args )
end
end
def _update_layout_setting_dashboard_path ( project , * args )
if project
update_layout_setting_project_dashboard_path ( project , * args )
else
update_layout_setting_dashboard_path ( * args )
end
end
def _add_block_dashboard_path ( project , * args )
if project
add_block_project_dashboard_path ( project , * args )
else
add_block_dashboard_path ( * args )
end
end
def _remove_block_dashboard_path ( project , * args )
if project
remove_block_project_dashboard_path ( project , * args )
else
remove_block_dashboard_path ( * args )
end
end
def _order_blocks_dashboard_path ( project , * args )
if project
order_blocks_project_dashboard_path ( project , * args )
else
order_blocks_dashboard_path ( * args )
end
end
2021-04-18 14:34:55 +03:00
def dashboard_link_path ( project , dashboard , ** options )
2020-07-27 11:49:23 +03:00
options [ :dashboard_id ] = dashboard . id
2021-05-02 10:52:32 +03:00
case dashboard . dashboard_type
when DashboardContentProject :: TYPE_NAME
project_path project , ** options
when DashboardContentWelcome :: TYPE_NAME
home_path ( ** options )
2020-07-27 11:49:23 +03:00
else
2021-05-02 10:52:32 +03:00
dashboard_type_name = dashboard . dashboard_type [ 0 .. - 10 ]
route_helper = " DashboardContent #{ dashboard_type_name } ::ROUTE_HELPER " . constantize
send route_helper , ** options
2020-07-27 11:49:23 +03:00
end
end
end