break down Ray's HTML
This commit is contained in:
1 parent
3e5978c8fd
commit
5fb94f644d
11 files changed
+260
-131
No files matched your search
@@ -9,13 +9,47 @@ class AttributeField
|
||||
field :list_options, :type => Array
|
||||
field :built_in, :type => Boolean, :default => false
|
||||
field :disabled, :type => Boolean, :default => false
|
||||
field :title, localize: true
|
||||
|
||||
#field :title, localize: true
|
||||
|
||||
field :locale_title, localize: true
|
||||
field :neutral_title
|
||||
|
||||
belongs_to :attribute
|
||||
belongs_to :role
|
||||
has_many :attribute_values
|
||||
|
||||
# validates_uniqueness_of :key
|
||||
def title_translations
|
||||
if locale
|
||||
return locale_title_translations
|
||||
else
|
||||
return Hash[VALID_LOCALES.map{|d| [d,neutral_title]}]
|
||||
end
|
||||
end
|
||||
|
||||
def title_translations=(var)
|
||||
if locale
|
||||
self.locale_title = var
|
||||
end
|
||||
end
|
||||
|
||||
def title
|
||||
if locale
|
||||
return self.locale_title
|
||||
else
|
||||
return self.neutral_title
|
||||
end
|
||||
end
|
||||
|
||||
def title=(var)
|
||||
binding.pry
|
||||
if locale
|
||||
self.locale_title = var
|
||||
else
|
||||
self.neutral_title = var
|
||||
end
|
||||
end
|
||||
|
||||
# Convert the string list_options into an array
|
||||
def select_list_options=(var)
|
||||
self.list_options = var.gsub(' ', '').split(',')
|
||||
|
||||
@@ -10,6 +10,8 @@ class Role
|
||||
|
||||
has_many :sub_roles, :autosave => true, :dependent => :destroy
|
||||
has_many :users
|
||||
has_many :statuses, :autosave => true, :dependent => :destroy
|
||||
has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :sub_roles, :allow_destroy => true
|
||||
|
||||
def is_built_in?
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
class Status
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
belongs_to :role
|
||||
has_and_belongs_to_many :sub_roles
|
||||
|
||||
field :title, localize: true
|
||||
|
||||
end
|
||||
@@ -2,7 +2,7 @@ class SubRole < Attribute
|
||||
|
||||
belongs_to :role
|
||||
has_and_belongs_to_many :users
|
||||
|
||||
has_and_belongs_to_many :statuses, :autosave => true, :dependent => :destroy
|
||||
# Get an sub_role from key
|
||||
def self.get_sub_role_from_key(key)
|
||||
self.first(:conditions => {:key => key})
|
||||
|
||||
Reference in new issue
Block a user