basic function

This commit is contained in:
Matthew K. Fu JuYuan authored and Christophe Vilayphiou committed 2012-09-17 13:32:52 +08:00
1 parent 9eed9ec7b6
commit 19db9d0037
26 files changed
+420 -185

No files matched your search

+7 -3
View File
@@ -4,7 +4,7 @@ class AttributeField
include Mongoid::Timestamps
field :key
field :markup
field :markup #[select,text_field,email,date,addr]
field :locale, :type => Boolean, :default => true
field :list_options, :type => Array
field :built_in, :type => Boolean, :default => false
@@ -15,10 +15,14 @@ class AttributeField
field :neutral_title
belongs_to :attribute
belongs_to :role
# belongs_to :role
has_many :attribute_values
# validates_uniqueness_of :key
def role
self.attribute.role
end
def title_translations
if locale
return locale_title_translations
@@ -29,7 +33,7 @@ class AttributeField
def title_translations=(var)
if locale
self.locale_title = var
self.locale_title_translations = var
end
end
+4 -1
View File
@@ -2,9 +2,12 @@ class Status
include Mongoid::Document
include Mongoid::Timestamps
has_and_belongs_to_many :users
belongs_to :role
has_and_belongs_to_many :sub_roles
# has_and_belongs_to_many :sub_roles
field :title, localize: true
+3 -1
View File
@@ -2,7 +2,9 @@ class SubRole < Attribute
belongs_to :role
has_and_belongs_to_many :users
has_and_belongs_to_many :statuses, :autosave => true, :dependent => :destroy
#has_and_belongs_to_many :statuses, :autosave => true, :dependent => :destroy
has_and_belongs_to_many :tags, :class_name => "SubRoleTag", :autosave => true
# Get an sub_role from key
def self.get_sub_role_from_key(key)
self.first(:conditions => {:key => key})
+3 -2
View File
@@ -14,6 +14,7 @@ class User
# field :cache_dept
# has_one :cache_dept, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
field :cache_dept,type: Hash
field :status_record,type: Hash
has_many :attribute_values, :autosave => true, :dependent => :destroy
has_many :app_auths,as: :privilege_apps,:inverse_of => :privilege_lists
@@ -25,9 +26,9 @@ class User
has_many :other_accounts, :autosave => true, :dependent => :destroy
has_many :journals, :autosave => true, :dependent => :destroy
has_many :papers, :autosave => true, :dependent => :destroy
has_and_belongs_to_many :sub_role_tags
belongs_to :role
has_and_belongs_to_many :statuses
has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles
accepts_nested_attributes_for :attribute_values, :allow_destroy => true