diff options
| author | Teddy Wing | 2017-06-14 18:04:37 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-06-14 18:04:37 +0200 | 
| commit | 07c50e21b45b8fcf219410cbfb71f1c1e67e81b6 (patch) | |
| tree | 8c328ed29f79bc309f7108c5549cf20e7cd0c4e2 /app/helpers/table_builder_helper.rb | |
| parent | b616626283a5e24d2b9996669c0978787229d9db (diff) | |
| download | chouette-core-07c50e21b45b8fcf219410cbfb71f1c1e67e81b6.tar.bz2 | |
TableBuilderHelper#build_links: Use existing `pundit_user` method
Instead of creating our own `user_context`, reuse the existing
`ApplicationController#pundit_user` method to get the context.
When I defined `user_context` I had done a project-find, found the
one place where we created a `UserContext`, and duplicated the code in
my method. Turns out after looking at the full `ApplicationController`
file, there's a handy method already there for us to use.
Refs #3479
Diffstat (limited to 'app/helpers/table_builder_helper.rb')
| -rw-r--r-- | app/helpers/table_builder_helper.rb | 7 | 
1 files changed, 1 insertions, 6 deletions
diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb index 98c170b85..361fe1aae 100644 --- a/app/helpers/table_builder_helper.rb +++ b/app/helpers/table_builder_helper.rb @@ -125,18 +125,13 @@ module TableBuilderHelper    end    def build_links(item, links) -    user_context = UserContext.new( -      current_user, -      referential: self.try(:current_referential) -    ) -      trigger = content_tag :div, class: 'btn dropdown-toggle', data: { toggle: 'dropdown' } do        content_tag :span, '', class: 'fa fa-cog'      end      menu = content_tag :ul, class: 'dropdown-menu' do        ( -        CustomLinks.new(item, user_context, links).links + +        CustomLinks.new(item, pundit_user, links).links +          item.action_links        ).map do |link|          content_tag :li, link_to(  | 
