for user new interface, member role is working.
This commit is contained in:
1 parent
b301f6522a
commit
bd0d975014
15 files changed
+312
-90
No files matched your search
@@ -268,4 +268,66 @@ namespace :build_new_member do
|
||||
# p "==Finished building status for Students"
|
||||
|
||||
# end
|
||||
task :build_sub_role_for_staff_1023 => :environment do
|
||||
role = Role.first(conditions: {key: 'staff'})
|
||||
staff_sub_roles ={
|
||||
:secretary => {"en"=>"Secretary", "zh_tw"=>"秘書"},
|
||||
:assistant => {"en"=>"Assistant", "zh_tw"=>"行政助理"},
|
||||
:research_assistant => {"en"=>"Research Assistant", "zh_tw"=>"研究助理"},
|
||||
:ta => {"en"=>"TA", "zh_tw"=>"助教"},
|
||||
:technical_specialist => {"en"=>"Technical Specialist", "zh_tw"=>"技士"}
|
||||
}
|
||||
staff_sub_roles.each do |key,item|
|
||||
role.sub_roles.build(:key=>key,:title_translations=> item)
|
||||
end
|
||||
role.save
|
||||
end
|
||||
|
||||
task :build_staff_attribute_field_1023 => :environment do
|
||||
sub_role_attribute_fields_template = [
|
||||
{key: 'status', markup: "select", locale: true, list_options: nil, built_in: true, disabled: false, locale_title_translations: {"zh_tw"=>"狀態", "en"=>"Status"}, neutral_title: nil },
|
||||
{key: 'responsibilities', markup: "text_field", locale: true, list_options: nil, built_in: true, disabled: false, locale_title_translations: {"zh_tw"=>"負責業務", "en"=>"Responsibilities"}, neutral_title: nil }
|
||||
]
|
||||
role = Role.first({conditions:{key: 'staff'}})
|
||||
role.sub_roles.each{|sb|
|
||||
sb.attribute_fields.destroy_all
|
||||
sub_role_attribute_fields_template.each{|att_f|
|
||||
sb.attribute_fields.build att_f
|
||||
}
|
||||
sb.save
|
||||
}
|
||||
role.save
|
||||
end
|
||||
|
||||
task :build_status_1023 => :environment do
|
||||
student_status ={
|
||||
:studying => {"en"=>"Studying", "zh_tw"=>"在學"},
|
||||
:drop_out => {"en"=>"Drop-out", "zh_tw"=>"休學"},
|
||||
:alumi => {"en"=>"Alumi", "zh_tw"=>"校友"},
|
||||
:suspended => {"en"=>"Suspended", "zh_tw"=>"未完成"}
|
||||
}
|
||||
|
||||
role = Role.first(conditions: {key: 'student'})
|
||||
student_status.each do |key,item|
|
||||
role.statuses.build(:key=>key.to_s,:title_translations=>item)
|
||||
end
|
||||
role.save
|
||||
|
||||
teacher_status ={
|
||||
:fulltime => {"en"=>"Full Time", "zh_tw"=>"全職"},
|
||||
:adjunct => {"en"=>"Adjunct", "zh_tw"=>"兼職"},
|
||||
:co_hiring => {"en"=>"Co Hiring", "zh_tw"=>"合聘"},
|
||||
:distinguished => {"en"=>"Distinguished", "zh_tw"=>"特聘"}
|
||||
}
|
||||
role = Role.first(conditions: {key: 'teacher'})
|
||||
teacher_status.each do |key,item|
|
||||
role.statuses.build(:key=>key.to_s,:title_translations=>item)
|
||||
end
|
||||
role.save
|
||||
|
||||
end
|
||||
|
||||
task :clean_up_attribute_value_for_deleted_fields => :environment do
|
||||
AttributeValue.all.reject{|t| !AttributeField.find(t.attribute_field_id).nil? rescue false }.each{|t| t.delete}
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user