Reduce usage of @current_user (use helper instead)

This commit is contained in:
Sebastian Serth
2022-11-02 12:25:53 +01:00
parent a4e791e3de
commit 4f0b8c3c42
8 changed files with 22 additions and 21 deletions

View File

@@ -6,9 +6,9 @@
- if object
- current_element = object
- else
- root_element = link_to_if(@current_user && policy(model).index?, model.model_name.human(count: 2), send(:"#{model.model_name.collection}_path"))
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), send(:"#{model.model_name.collection}_path"))
- if object
- current_element = link_to_if(@current_user && policy(object).show?, object, send(:"#{model.model_name.singular}_path", object))
- current_element = link_to_if(current_user && policy(object).show?, object, send(:"#{model.model_name.singular}_path", object))
- if I18n.translation_present?("shared.#{params[:action]}")
- active_action = t("shared.#{params[:action]}", model: model&.model_name&.human)
- else