Module: Mokio::Concerns::Models::User

Extended by:
ActiveSupport::Concern
Included in:
User
Defined in:
lib/mokio/concerns/models/user.rb

Overview

Concern for User model

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

Specify what’s showed in breadcrumb



102
103
104
# File 'lib/mokio/concerns/models/user.rb', line 102

def breadcrumb_name
  email
end

#deletableObject

:nodoc:



83
84
85
# File 'lib/mokio/concerns/models/user.rb', line 83

def deletable #:nodoc:
  true
end

#editableObject

:nodoc:



79
80
81
# File 'lib/mokio/concerns/models/user.rb', line 79

def editable #:nodoc:
  true
end

#email_required?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/mokio/concerns/models/user.rb', line 119

def email_required?
  true
end

#email_viewObject

Output for email parameter, used in CommonController#index



109
110
111
112
113
# File 'lib/mokio/concerns/models/user.rb', line 109

def email_view
  html = ""
  html << (ActionController::Base.helpers.link_to self[:email], ApplicationController.helpers.edit_url(self.class.base_class, self))
  html.html_safe
end

#nameObject

:nodoc:



91
92
93
# File 'lib/mokio/concerns/models/user.rb', line 91

def name #:nodoc:
  email
end

#name_viewObject



87
88
89
# File 'lib/mokio/concerns/models/user.rb', line 87

def name_view
  "#{first_name}#{' '  unless first_name.blank?}#{last_name}"
end

#password_required?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'lib/mokio/concerns/models/user.rb', line 115

def password_required?
  !persisted? || !password.blank? || !password_confirmation.blank? || only_password
end

#roles_viewObject

Output for roles parameter, used in CommonController#index



75
76
77
# File 'lib/mokio/concerns/models/user.rb', line 75

def roles_view
  self.roles.to_a.map{|m| I18n.t("users.role_name." + m.to_s)}.join(', ')
end

#titleObject

:nodoc:



95
96
97
# File 'lib/mokio/concerns/models/user.rb', line 95

def title #:nodoc:
  email
end