diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e2c1987..97a7b2d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -17,4 +17,12 @@ module ApplicationHelper else "x-mark" end end + + def operator? + controller.class.name.split("::").first=="Operator" + end + + def admin? + controller.class.name.split("::").first=="Admin" + end end diff --git a/app/models/user.rb b/app/models/user.rb index 9f1b082..e477a58 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -34,4 +34,8 @@ class User < ApplicationRecord after_update if: :password_digest_previously_changed? do sessions.where.not(id: Current.session).delete_all end + + def name + [ firstname, " ", lastname ].join + end end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 53eda24..3055f32 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,15 +1,15 @@
Plottservice Fachbereich AB - <% if user_signed_in? && current_user.admin? || current_user.operator? %> + <% if user_signed_in? && (current_user.admin? || current_user.operator?) %>