diff --git a/app/assets/javascripts/open_source_projects.js b/app/assets/javascripts/open_source_projects.js
new file mode 100644
index 000000000..dee720fac
--- /dev/null
+++ b/app/assets/javascripts/open_source_projects.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/stylesheets/open_source_projects.css b/app/assets/stylesheets/open_source_projects.css
new file mode 100644
index 000000000..afad32db0
--- /dev/null
+++ b/app/assets/stylesheets/open_source_projects.css
@@ -0,0 +1,4 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+*/
diff --git a/app/controllers/open_source_projects_controller.rb b/app/controllers/open_source_projects_controller.rb
new file mode 100644
index 000000000..41df7c409
--- /dev/null
+++ b/app/controllers/open_source_projects_controller.rb
@@ -0,0 +1,96 @@
+class OpenSourceProjectsController < ApplicationController
+ # GET /open_source_projects
+ # GET /open_source_projects.json
+ def index
+ per_page_option = 10
+
+ @open_source_projects = OpenSourceProject.all
+
+ @os_project_count = @open_source_projects.count
+ @os_project_pages = Paginator.new @os_project_count, per_page_option, params['page']
+
+ @open_source_projects = OpenSourceProject.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @open_source_projects }
+ end
+ end
+
+ # GET /open_source_projects/1
+ # GET /open_source_projects/1.json
+ def show
+ @open_source_project = OpenSourceProject.find(params[:id])
+
+ respond_to do |format|
+ format.html {
+ render :layout => "base_opensource_p"
+ }
+ format.json { render json: @open_source_project }
+ end
+ end
+
+ def search
+
+ end
+
+ # GET /open_source_projects/new
+ # GET /open_source_projects/new.json
+ def new
+ @open_source_project = OpenSourceProject.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @open_source_project }
+ end
+ end
+
+ # GET /open_source_projects/1/edit
+ def edit
+ @open_source_project = OpenSourceProject.find(params[:id])
+ end
+
+ # POST /open_source_projects
+ # POST /open_source_projects.json
+ def create
+ @open_source_project = OpenSourceProject.new(params[:open_source_project])
+
+ respond_to do |format|
+ if @open_source_project.save
+ format.html { redirect_to @open_source_project, notice: 'Open source project was successfully created.' }
+ format.json { render json: @open_source_project, status: :created, location: @open_source_project }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @open_source_project.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /open_source_projects/1
+ # PUT /open_source_projects/1.json
+ def update
+ @open_source_project = OpenSourceProject.find(params[:id])
+
+ respond_to do |format|
+ if @open_source_project.update_attributes(params[:open_source_project])
+ format.html { redirect_to @open_source_project, notice: 'Open source project was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @open_source_project.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /open_source_projects/1
+ # DELETE /open_source_projects/1.json
+ def destroy
+ @open_source_project = OpenSourceProject.find(params[:id])
+ @open_source_project.destroy
+
+ respond_to do |format|
+ format.html { redirect_to open_source_projects_url }
+ format.json { head :no_content }
+ end
+ end
+end
diff --git a/app/helpers/open_source_projects_helper.rb b/app/helpers/open_source_projects_helper.rb
new file mode 100644
index 000000000..f6735688b
--- /dev/null
+++ b/app/helpers/open_source_projects_helper.rb
@@ -0,0 +1,14 @@
+module OpenSourceProjectsHelper
+ def render_opensource_project(os_projects)
+ s=''
+ s << "
"
+ end
+end
diff --git a/app/models/open_source_project.rb b/app/models/open_source_project.rb
new file mode 100644
index 000000000..61b734f25
--- /dev/null
+++ b/app/models/open_source_project.rb
@@ -0,0 +1,6 @@
+class OpenSourceProject < ActiveRecord::Base
+ attr_accessible :String
+ def short_description(length = 255)
+ description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ end
+end
diff --git a/app/views/layouts/base_opensource_p.html.erb b/app/views/layouts/base_opensource_p.html.erb
new file mode 100644
index 000000000..64232ff9c
--- /dev/null
+++ b/app/views/layouts/base_opensource_p.html.erb
@@ -0,0 +1,130 @@
+<% @nav_dispaly_project_label = 1 %>
+
+
+
+
+ <%= h html_title %>
+
+
+ <%= csrf_meta_tag %>
+ <%= favicon %>
+ <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
+ <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
+ <%= javascript_heads %>
+ <%= heads_for_theme %>
+ <%= call_hook :view_layouts_base_html_head %>
+
+ <%= yield :header_tags -%>
+
+
+
+
+
+
+ <%= render :partial => 'layouts/base_header'%>
+
+
+
+
+ 软件项目托管社区 |
+ <%= l(:label_user_location) %> : |
+
+
+ <%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
+ <%= text_field_tag 'name', params[:name], :size => 20 %>
+ <%= hidden_field_tag 'project_type', params[:project_type] %>
+ <%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
+ <% end %>
+ |
+
+
+
+
+
+
+
+
+
+
+ <%= render_flash_messages %>
+ <%= yield %>
+ <%= call_hook :view_layouts_base_content %>
+
+
+ <%= render :partial => 'layouts/base_footer'%>
+
+
+
+ <%= l(:label_loading) %>
+
+
+
+
+ <%= call_hook :view_layouts_base_body_bottom %>
+
+
+
+
diff --git a/app/views/open_source_projects/_form.html.erb b/app/views/open_source_projects/_form.html.erb
new file mode 100644
index 000000000..3949754ac
--- /dev/null
+++ b/app/views/open_source_projects/_form.html.erb
@@ -0,0 +1,21 @@
+<%= form_for(@open_source_project) do |f| %>
+ <% if @open_source_project.errors.any? %>
+
+
<%= pluralize(@open_source_project.errors.count, "error") %> prohibited this open_source_project from being saved:
+
+
+ <% @open_source_project.errors.full_messages.each do |msg| %>
+ - <%= msg %>
+ <% end %>
+
+
+ <% end %>
+
+
+ <%= f.label :String %>
+ <%= f.text_field :String %>
+
+
+ <%= f.submit %>
+
+<% end %>
diff --git a/app/views/open_source_projects/_os_project.html.erb b/app/views/open_source_projects/_os_project.html.erb
new file mode 100644
index 000000000..ab52b0e3c
--- /dev/null
+++ b/app/views/open_source_projects/_os_project.html.erb
@@ -0,0 +1,56 @@
+
+
+
+ 图片
+
+
+
+ <%= textilizable(project.short_description, :project => project) %>
+
+
+
+
+
+
+
+
+
+
+ <%= content_tag('span', "#{l(:default_role_manager)}: ") %>
+
+
+
+ <%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(project.created_at)) %>
+
+
+
+
diff --git a/app/views/open_source_projects/edit.html.erb b/app/views/open_source_projects/edit.html.erb
new file mode 100644
index 000000000..bbe64cba8
--- /dev/null
+++ b/app/views/open_source_projects/edit.html.erb
@@ -0,0 +1,6 @@
+Editing open_source_project
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @open_source_project %> |
+<%= link_to 'Back', open_source_projects_path %>
diff --git a/app/views/open_source_projects/index.html.erb b/app/views/open_source_projects/index.html.erb
new file mode 100644
index 000000000..67c6f48c5
--- /dev/null
+++ b/app/views/open_source_projects/index.html.erb
@@ -0,0 +1,45 @@
+
+ <%= form_tag(:controller => 'open_source_projects', :action => "search", :method => :get) do %>
+
+
+ <%= l(:label_project_deposit) %> |
+ <%= l(:label_user_location) %> : |
+ |
+
+
+ <%= text_field_tag 'name', params[:name], :size => 30 %>
+ <%= hidden_field_tag 'project_type', params[:project_type] %>
+ <%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
+ |
+
+
+ <%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %> |
+ <%= link_to l(:field_homepage), home_path %> > <%= link_to l(:label_project_deposit), :controller => 'projects', :action => 'index', :project_type => 0 %> |
+
+
+ <% end %>
+
+
+
+
+
+ <% @open_source_projects.each do |project| %>
+ -
+
+ <%= link_to project.name, open_source_projects_path(project), :class=>"project root leaf"%>
+
+ <%= render :partial => 'open_source_projects/os_project', :locals => {:project => project}%>
+
+
+ <% end %>
+
+
+
+
+
+<% html_title(l(:label_project_plural)) -%>
+
diff --git a/app/views/open_source_projects/new.html.erb b/app/views/open_source_projects/new.html.erb
new file mode 100644
index 000000000..66de0a3f9
--- /dev/null
+++ b/app/views/open_source_projects/new.html.erb
@@ -0,0 +1,5 @@
+New open_source_project
+
+<%= render 'form' %>
+
+<%= link_to 'Back', open_source_projects_path %>
diff --git a/app/views/open_source_projects/show.html.erb b/app/views/open_source_projects/show.html.erb
new file mode 100644
index 000000000..f0657fc89
--- /dev/null
+++ b/app/views/open_source_projects/show.html.erb
@@ -0,0 +1,10 @@
+<%= notice %>
+
+
+ String:
+ <%= @open_source_project.name %>
+
+
+
+<%= link_to 'Edit', edit_open_source_project_path(@open_source_project) %> |
+<%= link_to 'Back', open_source_projects_path %>
diff --git a/config/routes.rb b/config/routes.rb
index 41106c0a7..67634b422 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -16,6 +16,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do
+ resources :open_source_projects do
+ collection do
+ match 'search', via: [:get, :post]
+ end
+ end
+
+
match 'course', :to => 'welcome#course', :via => :get
resources :stores do
collection do
diff --git a/db/migrate/20140324015819_create_open_source_projects.rb b/db/migrate/20140324015819_create_open_source_projects.rb
new file mode 100644
index 000000000..22034c3bb
--- /dev/null
+++ b/db/migrate/20140324015819_create_open_source_projects.rb
@@ -0,0 +1,15 @@
+class CreateOpenSourceProjects < ActiveRecord::Migration
+ def change
+ create_table :open_source_projects do |t|
+ t.column "name", :string, :default => nil, :null => true
+ t.column "description", :string, :default => '', :null => true
+ t.column "commit_count", :integer, :default => 0
+ t.column "code_line", :integer, :default => 0
+ t.column "users_count",:integer, :default => 0
+ t.column "last_commit_time", :date, :null => true
+ t.column "url", :string, :default => nil, :null => true
+ t.column "date_collected", :date, :null => true
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index effd13d81..22a574604 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140319092720) do
+ActiveRecord::Schema.define(:version => 20140324015819) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -493,6 +493,19 @@ ActiveRecord::Schema.define(:version => 20140319092720) do
t.string "salt", :null => false
end
+ create_table "open_source_projects", :force => true do |t|
+ t.string "name"
+ t.string "description", :default => ""
+ t.integer "commit_count", :default => 0
+ t.integer "code_line", :default => 0
+ t.integer "users_count", :default => 0
+ t.date "last_commit_time"
+ t.string "url"
+ t.date "date_collected"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "praise_tread_caches", :force => true do |t|
t.integer "object_id", :null => false
t.string "object_type"
diff --git a/test/fixtures/activities.yml b/test/fixtures/activities.yml
new file mode 100644
index 000000000..585b0e66f
--- /dev/null
+++ b/test/fixtures/activities.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ act_id:
+ act_type: MyString
+ user_id:
+
+two:
+ act_id:
+ act_type: MyString
+ user_id:
diff --git a/test/fixtures/forums.yml b/test/fixtures/forums.yml
new file mode 100644
index 000000000..c63aac0b6
--- /dev/null
+++ b/test/fixtures/forums.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
diff --git a/test/fixtures/journal_replies.yml b/test/fixtures/journal_replies.yml
new file mode 100644
index 000000000..1a8bb39c1
--- /dev/null
+++ b/test/fixtures/journal_replies.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ journal_id: 1
+ user_id: 1
+ reply_id: 1
+
+two:
+ journal_id: 1
+ user_id: 1
+ reply_id: 1
diff --git a/test/fixtures/open_source_projects.yml b/test/fixtures/open_source_projects.yml
new file mode 100644
index 000000000..a95f1d28f
--- /dev/null
+++ b/test/fixtures/open_source_projects.yml
@@ -0,0 +1,7 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ String:
+
+two:
+ String:
diff --git a/test/functional/forums_controller_test.rb b/test/functional/forums_controller_test.rb
new file mode 100644
index 000000000..9b0438bd2
--- /dev/null
+++ b/test/functional/forums_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class ForumsControllerTest < ActionController::TestCase
+ setup do
+ @forum = forums(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:forums)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create forum" do
+ assert_difference('Forum.count') do
+ post :create, forum: { }
+ end
+
+ assert_redirected_to forum_path(assigns(:forum))
+ end
+
+ test "should show forum" do
+ get :show, id: @forum
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @forum
+ assert_response :success
+ end
+
+ test "should update forum" do
+ put :update, id: @forum, forum: { }
+ assert_redirected_to forum_path(assigns(:forum))
+ end
+
+ test "should destroy forum" do
+ assert_difference('Forum.count', -1) do
+ delete :destroy, id: @forum
+ end
+
+ assert_redirected_to forums_path
+ end
+end
diff --git a/test/functional/open_source_projects_controller_test.rb b/test/functional/open_source_projects_controller_test.rb
new file mode 100644
index 000000000..9b33a8b1f
--- /dev/null
+++ b/test/functional/open_source_projects_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class OpenSourceProjectsControllerTest < ActionController::TestCase
+ setup do
+ @open_source_project = open_source_projects(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:open_source_projects)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create open_source_project" do
+ assert_difference('OpenSourceProject.count') do
+ post :create, open_source_project: { String: @open_source_project.String }
+ end
+
+ assert_redirected_to open_source_project_path(assigns(:open_source_project))
+ end
+
+ test "should show open_source_project" do
+ get :show, id: @open_source_project
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @open_source_project
+ assert_response :success
+ end
+
+ test "should update open_source_project" do
+ put :update, id: @open_source_project, open_source_project: { String: @open_source_project.String }
+ assert_redirected_to open_source_project_path(assigns(:open_source_project))
+ end
+
+ test "should destroy open_source_project" do
+ assert_difference('OpenSourceProject.count', -1) do
+ delete :destroy, id: @open_source_project
+ end
+
+ assert_redirected_to open_source_projects_path
+ end
+end
diff --git a/test/unit/activity_test.rb b/test/unit/activity_test.rb
new file mode 100644
index 000000000..eddcccdf7
--- /dev/null
+++ b/test/unit/activity_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class ActivityTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/unit/forum_test.rb b/test/unit/forum_test.rb
new file mode 100644
index 000000000..a6f90e493
--- /dev/null
+++ b/test/unit/forum_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class ForumTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/unit/helpers/forums_helper_test.rb b/test/unit/helpers/forums_helper_test.rb
new file mode 100644
index 000000000..deebfb03b
--- /dev/null
+++ b/test/unit/helpers/forums_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class ForumsHelperTest < ActionView::TestCase
+end
diff --git a/test/unit/helpers/open_source_projects_helper_test.rb b/test/unit/helpers/open_source_projects_helper_test.rb
new file mode 100644
index 000000000..8ecd58615
--- /dev/null
+++ b/test/unit/helpers/open_source_projects_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class OpenSourceProjectsHelperTest < ActionView::TestCase
+end
diff --git a/test/unit/journal_reply_test.rb b/test/unit/journal_reply_test.rb
new file mode 100644
index 000000000..500f11a6f
--- /dev/null
+++ b/test/unit/journal_reply_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class JournalReplyTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/unit/open_source_project_test.rb b/test/unit/open_source_project_test.rb
new file mode 100644
index 000000000..db44aad6e
--- /dev/null
+++ b/test/unit/open_source_project_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class OpenSourceProjectTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end