Permalink
Browse files

update to Rails3 and created tables

  • Loading branch information...
huacnlee committed Aug 24, 2010
0 parents commit 5520cba2d09b1758f43c60bbb7594239c0b948a2
Showing with 11,910 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. +30 −0 Gemfile
  3. +75 −0 Gemfile.lock
  4. +15 −0 README
  5. +7 −0 Rakefile
  6. +3 −0 app/controllers/application_controller.rb
  7. +83 −0 app/controllers/nodes_controller.rb
  8. +83 −0 app/controllers/replies_controller.rb
  9. +83 −0 app/controllers/sections_controller.rb
  10. +83 −0 app/controllers/topics_controller.rb
  11. +83 −0 app/controllers/users_controller.rb
  12. +2 −0 app/helpers/application_helper.rb
  13. +2 −0 app/helpers/nodes_helper.rb
  14. +2 −0 app/helpers/replies_helper.rb
  15. +2 −0 app/helpers/sections_helper.rb
  16. +2 −0 app/helpers/topics_helper.rb
  17. +2 −0 app/helpers/users_helper.rb
  18. +2 −0 app/models/counter.rb
  19. +2 −0 app/models/node.rb
  20. +2 −0 app/models/reply.rb
  21. +2 −0 app/models/section.rb
  22. +2 −0 app/models/topic.rb
  23. +2 −0 app/models/user.rb
  24. +14 −0 app/views/layouts/application.html.erb
  25. +33 −0 app/views/nodes/_form.html.erb
  26. +6 −0 app/views/nodes/edit.html.erb
  27. +29 −0 app/views/nodes/index.html.erb
  28. +5 −0 app/views/nodes/new.html.erb
  29. +25 −0 app/views/nodes/show.html.erb
  30. +37 −0 app/views/replies/_form.html.erb
  31. +6 −0 app/views/replies/edit.html.erb
  32. +31 −0 app/views/replies/index.html.erb
  33. +5 −0 app/views/replies/new.html.erb
  34. +30 −0 app/views/replies/show.html.erb
  35. +25 −0 app/views/sections/_form.html.erb
  36. +6 −0 app/views/sections/edit.html.erb
  37. +25 −0 app/views/sections/index.html.erb
  38. +5 −0 app/views/sections/new.html.erb
  39. +15 −0 app/views/sections/show.html.erb
  40. +49 −0 app/views/topics/_form.html.erb
  41. +6 −0 app/views/topics/edit.html.erb
  42. +37 −0 app/views/topics/index.html.erb
  43. +5 −0 app/views/topics/new.html.erb
  44. +45 −0 app/views/topics/show.html.erb
  45. +61 −0 app/views/users/_form.html.erb
  46. +6 −0 app/views/users/edit.html.erb
  47. +43 −0 app/views/users/index.html.erb
  48. +5 −0 app/views/users/new.html.erb
  49. +60 −0 app/views/users/show.html.erb
  50. +4 −0 config.ru
  51. +42 −0 config/application.rb
  52. +13 −0 config/boot.rb
  53. +26 −0 config/database.yml.default
  54. +5 −0 config/environment.rb
  55. +26 −0 config/environments/development.rb
  56. +49 −0 config/environments/production.rb
  57. +35 −0 config/environments/test.rb
  58. +7 −0 config/initializers/backtrace_silencers.rb
  59. +10 −0 config/initializers/inflections.rb
  60. +5 −0 config/initializers/mime_types.rb
  61. +7 −0 config/initializers/secret_token.rb
  62. +8 −0 config/initializers/session_store.rb
  63. +5 −0 config/locales/en.yml
  64. +147 −0 config/locales/zh-CN.yml
  65. +68 −0 config/routes.rb
  66. +25 −0 db/migrate/20100824055046_create_users.rb
  67. +14 −0 db/migrate/20100824055225_create_sections.rb
  68. +17 −0 db/migrate/20100824055320_create_nodes.rb
  69. +24 −0 db/migrate/20100824055700_create_topics.rb
  70. +20 −0 db/migrate/20100824055819_create_replies.rb
  71. +14 −0 db/migrate/20100824055944_create_counters.rb
  72. +86 −0 db/schema.rb
  73. +7 −0 db/seeds.rb
  74. +2 −0 doc/README_FOR_APP
  75. 0 lib/tasks/.gitkeep
  76. +26 −0 public/404.html
  77. +26 −0 public/422.html
  78. +26 −0 public/500.html
  79. 0 public/favicon.ico
  80. BIN public/images/rails.png
  81. +239 −0 public/index.html
  82. +2 −0 public/javascripts/application.js
  83. +965 −0 public/javascripts/controls.js
  84. +974 −0 public/javascripts/dragdrop.js
  85. +1,123 −0 public/javascripts/effects.js
  86. +6,001 −0 public/javascripts/prototype.js
  87. +175 −0 public/javascripts/rails.js
  88. +5 −0 public/robots.txt
  89. 0 public/stylesheets/.gitkeep
  90. +56 −0 public/stylesheets/scaffold.css
  91. +6 −0 script/rails
  92. +9 −0 test/fixtures/counters.yml
  93. +13 −0 test/fixtures/nodes.yml
  94. +15 −0 test/fixtures/replies.yml
  95. +9 −0 test/fixtures/sections.yml
  96. +21 −0 test/fixtures/topics.yml
  97. +27 −0 test/fixtures/users.yml
  98. +49 −0 test/functional/nodes_controller_test.rb
  99. +49 −0 test/functional/replies_controller_test.rb
  100. +49 −0 test/functional/sections_controller_test.rb
  101. +49 −0 test/functional/topics_controller_test.rb
  102. +49 −0 test/functional/users_controller_test.rb
  103. +9 −0 test/performance/browsing_test.rb
  104. +13 −0 test/test_helper.rb
  105. +8 −0 test/unit/counter_test.rb
  106. +4 −0 test/unit/helpers/nodes_helper_test.rb
  107. +4 −0 test/unit/helpers/replies_helper_test.rb
  108. +4 −0 test/unit/helpers/sections_helper_test.rb
  109. +4 −0 test/unit/helpers/topics_helper_test.rb
  110. +4 −0 test/unit/helpers/users_helper_test.rb
  111. +8 −0 test/unit/node_test.rb
  112. +8 −0 test/unit/reply_test.rb
  113. +8 −0 test/unit/section_test.rb
  114. +8 −0 test/unit/topic_test.rb
  115. +8 −0 test/unit/user_test.rb
  116. 0 vendor/plugins/.gitkeep
@@ -0,0 +1,8 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/**/*
+config/database.yml
+public/javascripts/cached_*
+public/stylesheets/cached_*
+
30 Gemfile
@@ -0,0 +1,30 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.0.rc2'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'mysql2'
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug'
+
+# Bundle the extra gems:
+# gem 'bj'
+# gem 'nokogiri'
+gem 'sqlite3-ruby', :require => 'sqlite3'
+# gem 'aws-s3', :require => 'aws/s3'
+
+# Bundle gems for the local environment. Make sure to
+# put test-only gems in this group so their generators
+# and rake tasks are available in development mode:
+# group :development, :test do
+# gem 'webrat'
+# end
@@ -0,0 +1,75 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.0.rc2)
+ actionpack (= 3.0.0.rc2)
+ mail (~> 2.2.5)
+ actionpack (3.0.0.rc2)
+ activemodel (= 3.0.0.rc2)
+ activesupport (= 3.0.0.rc2)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4.1)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.12)
+ rack-test (~> 0.5.4)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.0.rc2)
+ activesupport (= 3.0.0.rc2)
+ builder (~> 2.1.2)
+ i18n (~> 0.4.1)
+ activerecord (3.0.0.rc2)
+ activemodel (= 3.0.0.rc2)
+ activesupport (= 3.0.0.rc2)
+ arel (~> 1.0.0.rc1)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.0.rc2)
+ activemodel (= 3.0.0.rc2)
+ activesupport (= 3.0.0.rc2)
+ activesupport (3.0.0.rc2)
+ arel (1.0.0.rc1)
+ activesupport (>= 3.0.0.beta)
+ builder (2.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ i18n (0.4.1)
+ mail (2.2.5)
+ activesupport (>= 2.3.6)
+ mime-types
+ treetop (>= 1.4.5)
+ mime-types (1.16)
+ mysql2 (0.2.3)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.12)
+ rack (>= 1.0.0)
+ rack-test (0.5.4)
+ rack (>= 1.0)
+ rails (3.0.0.rc2)
+ actionmailer (= 3.0.0.rc2)
+ actionpack (= 3.0.0.rc2)
+ activerecord (= 3.0.0.rc2)
+ activeresource (= 3.0.0.rc2)
+ activesupport (= 3.0.0.rc2)
+ bundler (>= 1.0.0.rc.6)
+ railties (= 3.0.0.rc2)
+ railties (3.0.0.rc2)
+ actionpack (= 3.0.0.rc2)
+ activesupport (= 3.0.0.rc2)
+ rake (>= 0.8.3)
+ thor (~> 0.14.0)
+ rake (0.8.7)
+ sqlite3-ruby (1.3.1)
+ thor (0.14.0)
+ treetop (1.4.8)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.23)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ mysql2
+ rails (= 3.0.0.rc2)
+ sqlite3-ruby
15 README
@@ -0,0 +1,15 @@
+== 介绍
+
+我起名为“家园”,正如这个名字,这是一个为快速搭建小区论坛而做的开源项目。
+
+== 特色
+
+ 1. 简洁高效的论坛程序;
+ 2. 使用 Ruby on Rails 开发,具有良好的架构以便于后期维护和改进;
+ 3. Mobile 支持;
+
+
+== 演示
+
+ http://lanxs.com (楠香山,我住的小区)
+
@@ -0,0 +1,7 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+require 'rake'
+
+Homeland::Application.load_tasks
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
@@ -0,0 +1,83 @@
+class NodesController < ApplicationController
+ # GET /nodes
+ # GET /nodes.xml
+ def index
+ @nodes = Node.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @nodes }
+ end
+ end
+
+ # GET /nodes/1
+ # GET /nodes/1.xml
+ def show
+ @node = Node.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @node }
+ end
+ end
+
+ # GET /nodes/new
+ # GET /nodes/new.xml
+ def new
+ @node = Node.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @node }
+ end
+ end
+
+ # GET /nodes/1/edit
+ def edit
+ @node = Node.find(params[:id])
+ end
+
+ # POST /nodes
+ # POST /nodes.xml
+ def create
+ @node = Node.new(params[:node])
+
+ respond_to do |format|
+ if @node.save
+ format.html { redirect_to(@node, :notice => 'Node was successfully created.') }
+ format.xml { render :xml => @node, :status => :created, :location => @node }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @node.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /nodes/1
+ # PUT /nodes/1.xml
+ def update
+ @node = Node.find(params[:id])
+
+ respond_to do |format|
+ if @node.update_attributes(params[:node])
+ format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @node.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /nodes/1
+ # DELETE /nodes/1.xml
+ def destroy
+ @node = Node.find(params[:id])
+ @node.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(nodes_url) }
+ format.xml { head :ok }
+ end
+ end
+end
@@ -0,0 +1,83 @@
+class RepliesController < ApplicationController
+ # GET /replies
+ # GET /replies.xml
+ def index
+ @replies = Reply.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @replies }
+ end
+ end
+
+ # GET /replies/1
+ # GET /replies/1.xml
+ def show
+ @reply = Reply.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @reply }
+ end
+ end
+
+ # GET /replies/new
+ # GET /replies/new.xml
+ def new
+ @reply = Reply.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @reply }
+ end
+ end
+
+ # GET /replies/1/edit
+ def edit
+ @reply = Reply.find(params[:id])
+ end
+
+ # POST /replies
+ # POST /replies.xml
+ def create
+ @reply = Reply.new(params[:reply])
+
+ respond_to do |format|
+ if @reply.save
+ format.html { redirect_to(@reply, :notice => 'Reply was successfully created.') }
+ format.xml { render :xml => @reply, :status => :created, :location => @reply }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /replies/1
+ # PUT /replies/1.xml
+ def update
+ @reply = Reply.find(params[:id])
+
+ respond_to do |format|
+ if @reply.update_attributes(params[:reply])
+ format.html { redirect_to(@reply, :notice => 'Reply was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /replies/1
+ # DELETE /replies/1.xml
+ def destroy
+ @reply = Reply.find(params[:id])
+ @reply.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(replies_url) }
+ format.xml { head :ok }
+ end
+ end
+end
@@ -0,0 +1,83 @@
+class SectionsController < ApplicationController
+ # GET /sections
+ # GET /sections.xml
+ def index
+ @sections = Section.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @sections }
+ end
+ end
+
+ # GET /sections/1
+ # GET /sections/1.xml
+ def show
+ @section = Section.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @section }
+ end
+ end
+
+ # GET /sections/new
+ # GET /sections/new.xml
+ def new
+ @section = Section.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @section }
+ end
+ end
+
+ # GET /sections/1/edit
+ def edit
+ @section = Section.find(params[:id])
+ end
+
+ # POST /sections
+ # POST /sections.xml
+ def create
+ @section = Section.new(params[:section])
+
+ respond_to do |format|
+ if @section.save
+ format.html { redirect_to(@section, :notice => 'Section was successfully created.') }
+ format.xml { render :xml => @section, :status => :created, :location => @section }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @section.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /sections/1
+ # PUT /sections/1.xml
+ def update
+ @section = Section.find(params[:id])
+
+ respond_to do |format|
+ if @section.update_attributes(params[:section])
+ format.html { redirect_to(@section, :notice => 'Section was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @section.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /sections/1
+ # DELETE /sections/1.xml
+ def destroy
+ @section = Section.find(params[:id])
+ @section.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(sections_url) }
+ format.xml { head :ok }
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 5520cba

Please sign in to comment.