From 3e6c2b1ec2bda37e59bf5f99dd67a5e7d398ca6f Mon Sep 17 00:00:00 2001 From: "Matt K. Fu" Date: Tue, 14 May 2013 11:48:13 +0800 Subject: [PATCH] fix member error with blank database --- app/views/admin/users_new_interface/_side_bar.html.erb | 2 +- lib/tasks/site.rake | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/admin/users_new_interface/_side_bar.html.erb b/app/views/admin/users_new_interface/_side_bar.html.erb index 38ad19c4..b38cb880 100644 --- a/app/views/admin/users_new_interface/_side_bar.html.erb +++ b/app/views/admin/users_new_interface/_side_bar.html.erb @@ -6,7 +6,7 @@ <%= content_tag :li, link_to((t(:member_authorization) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((t(:member_registration) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((t(:member_role) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_roles_path ), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> - <%= content_tag :li, link_to((t(:member_info) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, edit_admin_info_path(Info.first.id.to_s)), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> + <%= content_tag :li, link_to((t(:member_info) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, edit_admin_info_path(Info.first.id.to_s)), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) and Info.first %> <% end -%> <% end -%> diff --git a/lib/tasks/site.rake b/lib/tasks/site.rake index fcce06dc..6defde52 100644 --- a/lib/tasks/site.rake +++ b/lib/tasks/site.rake @@ -11,6 +11,9 @@ namespace :site do `mongo #{Mongoid.config.database.name} --eval "db.fs.chunks.ensureIndex({files_id: 1, n: 1})"` puts "Congres you can now login within url" puts 'Please upload design package (/admin/designs/upload_package ) and run rake site:necessary_data' + I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' ) + I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' ) + end task :necessary_data => :environment do