From 383a840c50ca8f6df19677e93357e9dc6c0e043c Mon Sep 17 00:00:00 2001 From: hellekin Date: Fri, 9 Oct 2020 12:48:13 +0200 Subject: Enable switching Agent Switching current Agent can help with roles and resource access. Go to your dashboard by clicking the avatar. Select agent and hit "Select" --- app/helpers/agents_helper.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 app/helpers/agents_helper.rb (limited to 'app/helpers') diff --git a/app/helpers/agents_helper.rb b/app/helpers/agents_helper.rb new file mode 100644 index 0000000..a02fb7a --- /dev/null +++ b/app/helpers/agents_helper.rb @@ -0,0 +1,9 @@ +module AgentsHelper + # Form to select an Agent + def agent_selector_form + form_for current_agent, url: '/my/current_agent', method: :patch do |f| + f.submit('select') + f.select(:id, options_for_select(current_user.agents.map { |a| [a.name, a.id] }), selected: current_agent.id) + end + end +end -- cgit v1.2.3