From ef2c732d2e2757cb1a30f48c560ef27ffceaac09 Mon Sep 17 00:00:00 2001 From: "Matt K. Fu" Date: Tue, 14 May 2013 11:26:35 +0800 Subject: [PATCH] make blank site working better --- app/controllers/pages_controller.rb | 3 ++- app/views/admin/designs/index.html.erb | 1 + app/views/admin/designs/upload_package.html.erb | 3 ++- config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + lib/tasks/site.rake | 9 ++++----- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 6e72a960..f22adb2a 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -17,7 +17,8 @@ class PagesController < ApplicationController impressionist(@item) render_page else - render :text => t(:need_home) + redirect_to '/admin/dashboards',:notice=>t(:need_home) + # render :text => t(:need_home) end end diff --git a/app/views/admin/designs/index.html.erb b/app/views/admin/designs/index.html.erb index 6facd66b..e12402fe 100644 --- a/app/views/admin/designs/index.html.erb +++ b/app/views/admin/designs/index.html.erb @@ -9,4 +9,5 @@
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_admin_design_path, :class => 'btn btn-primary pull-right' %> + <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:upload), upload_package_admin_designs_path, :class => 'btn btn-primary pull-right' %>
\ No newline at end of file diff --git a/app/views/admin/designs/upload_package.html.erb b/app/views/admin/designs/upload_package.html.erb index 9dc0efa9..671f81ab 100644 --- a/app/views/admin/designs/upload_package.html.erb +++ b/app/views/admin/designs/upload_package.html.erb @@ -1,7 +1,8 @@ <% content_for :side_bar do %> - <%= render 'admin/sites/side_bar' %> + <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :side_bar_content => 'admin/sites/side_bar'} %> <% end %> +
<%= form_tag '',:multipart => true,:action=>"post" do |f| %> diff --git a/config/locales/en.yml b/config/locales/en.yml index f1e1097d..2bafb863 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -461,6 +461,7 @@ en: success_: Successfully updated update_: Update update_at: Update at + upload: Upload url: URL use_status: Use Statue user: User diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 223e69a0..96aa7c43 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -462,6 +462,7 @@ zh_tw: success_: 使用者已更新成功 update_: 更新 update_at: 最後更新時間 + upload: 上傳 url: 網址 use_status: 使用狀態 user: 使用者 diff --git a/lib/tasks/site.rake b/lib/tasks/site.rake index 8186c1eb..fcce06dc 100644 --- a/lib/tasks/site.rake +++ b/lib/tasks/site.rake @@ -3,15 +3,14 @@ namespace :site do task :build => :environment do - Site.destroy_all Purchase.destroy_all - + Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ]) User.create!(:email=>'chris@rulingcom.com',:admin=>true,:user_id=>'chris',:password=>'password') - - put "Run ensureIndex on chunks before you upload something. If You start DB from nothing." - puts 'Please upload design package and run rake site:necessary_data' + `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' end task :necessary_data => :environment do