user new interface 70%

This commit is contained in:
Matthew K. Fu JuYuan authored and chris committed 2012-10-09 06:40:18 +08:00
1 parent 1aacf5e2ce
commit 9f825de288
20 files changed
+589 -52

No files matched your search

+31
View File
@@ -1,6 +1,37 @@
# encoding: utf-8
namespace :build_new_member do
task :set_gender => :environment do
af = AttributeField.first({conditions:{key: "gender"}})
af.markup_value = {"1"=>{"en"=>"Male", "zh_tw"=>"男性"}, "2"=>{"en"=>"Female", "zh_tw"=>"女性"}, "3"=>{"en"=>"Other", "zh_tw"=>"其他"}, "3"=>{"en"=>"Not public", "zh_tw"=>"不公開"}}
af.markup = "select"
af.locale = true
af.save
end
task :setup_status_options => :environment do
data_set = {
:teacher=>{:status=>{:markup=>"select",:markup_value=>{"1"=>{"en"=>"Fulltime", "zh_tw"=>"全職"}, "2"=>{"en"=>"Adjunct", "zh_tw"=>"兼職"}, "3"=>{"en"=>"Co Hiring", "zh_tw"=>"合聘"}, "3"=>{"en"=>"Distinguished", "zh_tw"=>"特聘"}}}},
:student=>{:status=>{:markup=>"select",:markup_value=>{"1"=>{"en"=>"Studying", "zh_tw"=>"在學"}, "2"=>{"en"=>"Drop-out", "zh_tw"=>"休學"}, "3"=>{"en"=>"Alumi", "zh_tw"=>"校友"}, "3"=>{"en"=>"Suspended", "zh_tw"=>"未完成"}}}},
:staff=>{:staff=>{:markup=>"select",:markup_value=>nil}}
}
data_set.each do |key,data|
role = Role.first({conditions:{key: key}})
role.sub_roles.each do |sr|
sr.attribute_fields.each do |af|
if af.key == "status"
# binding.pry
af.markup = data[:status][:markup]
af.markup_value = data[:status][:markup_value]
af.save
# binding.pry
end
end
end
end
end
task :sub_role_tags_generate => :environment do
SubRoleTag.destroy_all
role_keys = %w{teacher staff student}