Change role structure
Still needs to: change the views and create sub_roles in the dev.rake
This commit is contained in:
1 parent
e0cdedfa2e
commit
b7ac5478b4
45 files changed
+608
-492
No files matched your search
+22
-26
@@ -15,13 +15,13 @@ namespace :dev do
|
||||
|
||||
I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' )
|
||||
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' )
|
||||
var_1 = I18nVariable.create!( :document_class => 'UserRoleModel', :key => 'teacher', :en => 'Teacher', :zh_tw => '老師' )
|
||||
var_1 = I18nVariable.create!( :document_class => 'Role', :key => 'teacher', :en => 'Teacher', :zh_tw => '老師' )
|
||||
var_2 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'discipline', :en => 'Discipline', :zh_tw => '學科', :parent_id => var_1.id )
|
||||
var_3 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_1.id )
|
||||
var_4 = I18nVariable.create!( :document_class => 'UserRoleModel', :key => 'student', :en => 'Student', :zh_tw => '學生' )
|
||||
var_4 = I18nVariable.create!( :document_class => 'Role', :key => 'student', :en => 'Student', :zh_tw => '學生' )
|
||||
var_5 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_4.id )
|
||||
var_6 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'major', :en => 'Major', :zh_tw => '主修', :parent_id => var_4.id )
|
||||
var_7 = I18nVariable.create!( :document_class => 'UserInfoModel', :key => 'profile', :en => 'Profile', :zh_tw => '個人檔案' )
|
||||
var_7 = I18nVariable.create!( :document_class => 'Info', :key => 'profile', :en => 'Profile', :zh_tw => '個人檔案' )
|
||||
var_8 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'last_name', :en => 'Last name', :zh_tw => '姓氏', :parent_id => var_7.id )
|
||||
var_9 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'first_name', :en => 'First name', :zh_tw => '名字', :parent_id => var_7.id )
|
||||
var_10 = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
|
||||
@@ -32,17 +32,17 @@ namespace :dev do
|
||||
|
||||
|
||||
# TODO: modify for the new model
|
||||
urm_1 = UserRoleModel.new( :key => 'teacher', :i18n_variable_id => var_1.id, :built_in => true )
|
||||
urm_1.attribute_models.build( :key => 'discipline', :locale => true, :i18n_variable_id => var_2.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||
urm_1.attribute_models.build( :key => 'department', :locale => true, :i18n_variable_id => var_3.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||
urm_1 = Role.new( :key => 'teacher', :i18n_variable_id => var_1.id, :built_in => true )
|
||||
urm_1.attributes.build( :key => 'discipline', :locale => true, :i18n_variable_id => var_2.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||
urm_1.attributes.build( :key => 'department', :locale => true, :i18n_variable_id => var_3.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||
urm_1.save!
|
||||
urm_2 = UserRoleModel.new( :key => 'student', :i18n_variable_id => var_4.id )
|
||||
urm_2.attribute_models.build( :key => 'department', :locale => true, :i18n_variable_id => var_5.id, :markup => 'text_field', :list_options => [] )
|
||||
urm_2.attribute_models.build( :key => 'major', :locale => true, :i18n_variable_id => var_6.id, :markup => 'text_field', :list_options => [] )
|
||||
urm_2 = Role.new( :key => 'student', :i18n_variable_id => var_4.id )
|
||||
urm_2.attributes.build( :key => 'department', :locale => true, :i18n_variable_id => var_5.id, :markup => 'text_field', :list_options => [] )
|
||||
urm_2.attributes.build( :key => 'major', :locale => true, :i18n_variable_id => var_6.id, :markup => 'text_field', :list_options => [] )
|
||||
urm_2.save!
|
||||
uim_1 = UserInfoModel.new( :key => 'profile', :i18n_variable_id => var_7.id, :built_in => true )
|
||||
uim_1.attribute_models.build( :key => 'last_name', :locale => true, :i18n_variable_id => var_8.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||
uim_1.attribute_models.build( :key => 'first_name', :locale => true, :i18n_variable_id => var_9.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||
uim_1 = Info.new( :key => 'profile', :i18n_variable_id => var_7.id, :built_in => true )
|
||||
uim_1.attributes.build( :key => 'last_name', :locale => true, :i18n_variable_id => var_8.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||
uim_1.attributes.build( :key => 'first_name', :locale => true, :i18n_variable_id => var_9.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||
uim_1.save!
|
||||
|
||||
|
||||
@@ -118,22 +118,18 @@ namespace :dev do
|
||||
|
||||
|
||||
|
||||
user = User.create( :email => 'chris@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :active_role => 'teacher' )
|
||||
user_info = UserInfo.create( :user_id => user.id, :key => 'profile' )
|
||||
user_role = UserRole.create( :user_id => user.id, :key => 'teacher' )
|
||||
AttributeValue.create( :user_attribute_id => user_info.id, :key => 'first_name', :en => 'Christophe', :zh_tw => '順發' )
|
||||
AttributeValue.create( :user_attribute_id => user_info.id, :key => 'last_name', :en => 'Vilayphiou', :zh_tw => '林' )
|
||||
AttributeValue.create( :user_attribute_id => user_role.id, :key => 'discipline', :en => 'Computer Architecture', :zh_tw => '計算機系統結構' )
|
||||
AttributeValue.create( :user_attribute_id => user_role.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
|
||||
user = User.create( :email => 'chris@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :role_id => urm_1.id )
|
||||
AttributeValue.create( :user_id => user.id, :key => 'first_name', :en => 'Christophe', :zh_tw => '順發' )
|
||||
AttributeValue.create( :user_id => user.id, :key => 'last_name', :en => 'Vilayphiou', :zh_tw => '林' )
|
||||
AttributeValue.create( :user_id => user.id, :key => 'discipline', :en => 'Computer Architecture', :zh_tw => '計算機系統結構' )
|
||||
AttributeValue.create( :user_id => user.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
|
||||
|
||||
|
||||
user = User.create( :email => 'matt@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :active_role => 'student' )
|
||||
user_info = UserInfo.create( :user_id => user.id, :key => 'profile' )
|
||||
user_role = UserRole.create( :user_id => user.id, :key => 'student' )
|
||||
AttributeValue.create( :user_attribute_id => user_info.id, :key => 'first_name', :en => 'Matt', :zh_tw => '儒淵' )
|
||||
AttributeValue.create( :user_attribute_id => user_info.id, :key => 'last_name', :en => 'Fu', :zh_tw => '傅' )
|
||||
AttributeValue.create( :user_attribute_id => user_role.id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
|
||||
AttributeValue.create( :user_attribute_id => user_role.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
|
||||
user = User.create( :email => 'matt@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :role_id => urm_2.id )
|
||||
AttributeValue.create( :user_id => user.id, :key => 'first_name', :en => 'Matt', :zh_tw => '儒淵' )
|
||||
AttributeValue.create( :user_id => user.id, :key => 'last_name', :en => 'Fu', :zh_tw => '傅' )
|
||||
AttributeValue.create( :user_id => user.id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
|
||||
AttributeValue.create( :user_id => user.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user