mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-17 19:12:37 -05:00
28 lines
462 B
Ruby
28 lines
462 B
Ruby
class TrustLevel
|
|
|
|
attr_reader :id, :name
|
|
|
|
def self.Levels
|
|
{:new => 0,
|
|
:basic => 1,
|
|
:regular => 2,
|
|
:experienced => 3,
|
|
:advanced => 4,
|
|
:moderator => 5}
|
|
end
|
|
|
|
def self.all
|
|
self.Levels.map do |name_key, id|
|
|
TrustLevel.new(name_key, id)
|
|
end
|
|
end
|
|
|
|
def initialize(name_key, id)
|
|
@name = I18n.t("trust_levels.#{name_key}.title")
|
|
@id = id
|
|
end
|
|
|
|
def serializable_hash
|
|
{id: @id, name: @name}
|
|
end
|
|
end
|