Sha256: 00b142b7025e596d89c1d7424736fd818c3d63d54c219eb54c9544ebbf1e4d84
Contents?: true
Size: 1.43 KB
Versions: 23
Compression:
Stored size: 1.43 KB
Contents
# frozen_string_literal: true module Alchemy module Page::PageUsers extend ActiveSupport::Concern # Returns the creator of this page. # def creator get_page_user(creator_id) end # Returns the last updater of this page. # def updater get_page_user(updater_id) end # Returns the user currently editing this page. # def locker get_page_user(locked_by) end # Returns the name of the creator of this page. # # If no creator could be found or associated user model # does not respond to +#name+ it returns +'unknown'+ # def creator_name (creator && creator.try(:name)) || Alchemy.t('unknown') end # Returns the name of the last updater of this page. # # If no updater could be found or associated user model # does not respond to +#name+ it returns +'unknown'+ # def updater_name (updater && updater.try(:name)) || Alchemy.t('unknown') end # Returns the name of the user currently editing this page. # # If no locker could be found or associated user model # does not respond to +#name+ it returns +'unknown'+ # def locker_name (locker && locker.try(:name)) || Alchemy.t('unknown') end private def get_page_user(id) if Alchemy.user_class.respond_to? :primary_key Alchemy.user_class.try(:find_by, {Alchemy.user_class.primary_key => id}) end end end end
Version data entries
23 entries across 23 versions & 1 rubygems