From cfa553259813461ab5502eb90da11679a75eadf3 Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Tue, 1 Apr 2014 08:51:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=BA=E7=AB=8B=E4=BA=86open=20source=20proj?= =?UTF-8?q?ect=E9=83=A8=E5=88=86=E7=9A=84=E6=A1=86=E6=9E=B6=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E5=BB=BA=E7=AB=8B=E4=BA=86=E7=9B=B8=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E5=B8=96=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/open_source_project.rb | 4 + app/models/relative_memo.rb | 3 + app/views/layouts/base_opensource_p.html.erb | 15 +- .../open_source_projects/_os_project.html.erb | 16 +- app/views/open_source_projects/index.html.erb | 2 +- .../20140401004102_create_relative_memos.rb | 18 ++ db/schema.rb | 199 +++++++++++++++++- test/fixtures/relative_memos.yml | 11 + test/unit/relative_memo_test.rb | 7 + 9 files changed, 264 insertions(+), 11 deletions(-) create mode 100644 app/models/relative_memo.rb create mode 100644 db/migrate/20140401004102_create_relative_memos.rb create mode 100644 test/fixtures/relative_memos.yml create mode 100644 test/unit/relative_memo_test.rb diff --git a/app/models/open_source_project.rb b/app/models/open_source_project.rb index 61b734f2..39ab5fc4 100644 --- a/app/models/open_source_project.rb +++ b/app/models/open_source_project.rb @@ -1,5 +1,9 @@ class OpenSourceProject < ActiveRecord::Base attr_accessible :String + + has_many :tags, :through => :project_tags, :class_name => 'Tag' + has_many :project_tags, :class_name => 'ProjectTags' + acts_as_taggable def short_description(length = 255) description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description end diff --git a/app/models/relative_memo.rb b/app/models/relative_memo.rb new file mode 100644 index 00000000..a8b745f6 --- /dev/null +++ b/app/models/relative_memo.rb @@ -0,0 +1,3 @@ +class RelativeMemo < ActiveRecord::Base + # attr_accessible :title, :body +end diff --git a/app/views/layouts/base_opensource_p.html.erb b/app/views/layouts/base_opensource_p.html.erb index 64232ff9..dc5efe05 100644 --- a/app/views/layouts/base_opensource_p.html.erb +++ b/app/views/layouts/base_opensource_p.html.erb @@ -26,7 +26,7 @@
- + - - + + @@ -90,6 +90,10 @@
<%= l(:label_create_time) %>:<%= format_time(@open_source_project.created_at) %>
+
+ 项目来源:<%= link_to @open_source_project.url, @open_source_project.url %> + +
@@ -97,6 +101,11 @@
+
+
+ <%= render :partial => 'tags/tag', :locals => {:obj => @open_source_project,:object_flag => "2"}%> +
+
diff --git a/app/views/open_source_projects/_os_project.html.erb b/app/views/open_source_projects/_os_project.html.erb index ab52b0e3..010b4fb5 100644 --- a/app/views/open_source_projects/_os_project.html.erb +++ b/app/views/open_source_projects/_os_project.html.erb @@ -1,4 +1,3 @@ -
图片 @@ -28,7 +27,7 @@

<%= 1 %> - <%= content_tag('span', l(:label_commit_on)) %> + <%= content_tag('span', "行代码") %>

@@ -45,12 +44,17 @@
+
+
+ <%= content_tag('span', "项目来源:")%><%= link_to project.url, project.url %> +
+
+ <%= content_tag('span', "数据更新时间") %><%= content_tag('span', format_time(project.created_at)) %> +
+
-
- <%= image_tag( "/images/sidebar/tags.png") %> - - + <%= render :partial => 'tags/tag_name', :locals => {:obj => project,:object_flag => "2",:non_list_all => true }%>
diff --git a/app/views/open_source_projects/index.html.erb b/app/views/open_source_projects/index.html.erb index 67c6f48c..5cb93ea6 100644 --- a/app/views/open_source_projects/index.html.erb +++ b/app/views/open_source_projects/index.html.erb @@ -26,7 +26,7 @@ <% @open_source_projects.each do |project| %>
  • - <%= link_to project.name, open_source_projects_path(project), :class=>"project root leaf"%> + <%= link_to project.name, open_source_project_path(project), :class=>"project root leaf"%> <%= render :partial => 'open_source_projects/os_project', :locals => {:project => project}%>
    diff --git a/db/migrate/20140401004102_create_relative_memos.rb b/db/migrate/20140401004102_create_relative_memos.rb new file mode 100644 index 00000000..6654b8fe --- /dev/null +++ b/db/migrate/20140401004102_create_relative_memos.rb @@ -0,0 +1,18 @@ +class CreateRelativeMemos < ActiveRecord::Migration + def change + create_table :relative_memos do |t| + t.integer :osp_id, :null => false + t.integer :parent_id, null: true + t.string :subject, null: false + t.text :content, null: false + t.integer :author_id + t.integer :replies_count, default: 0 + t.integer :last_reply_id + t.boolean :lock, default: false + t.boolean :sticky, default: false + t.boolean :is_quote, default: false + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 22a57460..6544ba9d 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 => 20140324015819) do +ActiveRecord::Schema.define(:version => 20140401004102) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -62,6 +62,20 @@ ActiveRecord::Schema.define(:version => 20140324015819) do add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" + create_table "bak_mentioned", :primary_key => "Id", :force => true do |t| + t.string "this_real_name", :limit => 1000 + t.integer "is_mentioned_in" + t.string "context", :limit => 2000 + end + + add_index "bak_mentioned", ["this_real_name", "is_mentioned_in"], :name => "name_mention", :length => {"this_real_name"=>900, "is_mentioned_in"=>nil} + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name" + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_2" + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_3", :length => {"this_real_name"=>900} + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_4" + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_5" + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_6" + create_table "biding_projects", :force => true do |t| t.integer "project_id" t.integer "bid_id" @@ -101,6 +115,11 @@ ActiveRecord::Schema.define(:version => 20140324015819) do add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["project_id"], :name => "boards_project_id" + create_table "categories", :primary_key => "Id", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "proj_categories" + end + create_table "changes", :force => true do |t| t.integer "changeset_id", :null => false t.string "action", :limit => 1, :default => "", :null => false @@ -232,6 +251,14 @@ ActiveRecord::Schema.define(:version => 20140324015819) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" + create_table "eco_projects", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.integer "eco_proj_id" + t.datetime "date_collected" + end + + add_index "eco_projects", ["proj_id"], :name => "proj_id" + create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -253,6 +280,137 @@ ActiveRecord::Schema.define(:version => 20140324015819) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + create_table "events", :primary_key => "event_id", :force => true do |t| + t.string "job_name" + t.datetime "event_time" + t.string "event_type", :limit => 20 + end + + create_table "fm_article", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "article_title", :limit => 16777215 + t.text "article_link", :limit => 16777215 + t.text "article_time", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_article", ["proj_id"], :name => "proj_id" + + create_table "fm_bugtracker_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_bugtracker_link", ["proj_id"], :name => "proj_id" + + create_table "fm_datametric_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_datametric_link", ["proj_id"], :name => "proj_id" + + create_table "fm_dependency_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_dependency_link", ["proj_id"], :name => "proj_id" + + create_table "fm_download_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "download_link", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_download_link", ["proj_id"], :name => "proj_id" + + create_table "fm_heartbeat", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.float "popularity_score", :limit => 12 + t.float "vitality_score", :limit => 12 + t.integer "subscription" + t.integer "voting_score" + t.integer "voting_count" + t.datetime "date_collected" + end + + add_index "fm_heartbeat", ["proj_id"], :name => "proj_id" + + create_table "fm_license", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_license", ["proj_id"], :name => "proj_id" + + create_table "fm_mailinglist_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_mailinglist_link", ["proj_id"], :name => "proj_id" + + create_table "fm_operating_system", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_operating_system", ["proj_id"], :name => "proj_id" + + create_table "fm_programming_language", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_programming_language", ["proj_id"], :name => "proj_id" + + create_table "fm_project_spotlight", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.text "project_name", :limit => 16777215 + t.text "project_spotlight_link", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_project_spotlight", ["proj_id"], :name => "proj_id" + + create_table "fm_release", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.text "release_version", :limit => 16777215 + t.text "release_time", :limit => 16777215 + t.text "release_tag", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_release", ["proj_id"], :name => "proj_id" + + create_table "fm_submit", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "submitter", :limit => 16777215 + t.text "submitter_link", :limit => 16777215 + t.text "submit_time", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_submit", ["proj_id"], :name => "proj_id" + + create_table "fm_summary", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_summary", ["proj_id"], :name => "proj_id" + create_table "forums", :force => true do |t| t.string "name", :null => false t.string "description", :default => "" @@ -478,6 +636,14 @@ ActiveRecord::Schema.define(:version => 20140324015819) do add_index "news", ["created_on"], :name => "index_news_on_created_on" add_index "news", ["project_id"], :name => "news_project_id" + create_table "ohloh_tagged", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.string "description", :limit => 100, :null => false + t.datetime "date_collected" + end + + add_index "ohloh_tagged", ["proj_id"], :name => "proj_id" + create_table "open_id_authentication_associations", :force => true do |t| t.integer "issued" t.integer "lifetime" @@ -585,6 +751,21 @@ ActiveRecord::Schema.define(:version => 20140324015819) do add_index "queries", ["project_id"], :name => "index_queries_on_project_id" add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + create_table "relative_memos", :force => true do |t| + t.integer "osp_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "repositories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "url", :default => "", :null => false @@ -720,6 +901,22 @@ ActiveRecord::Schema.define(:version => 20140324015819) do add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" add_index "tokens", ["value"], :name => "tokens_value", :unique => true + create_table "tprojects", :force => true do |t| + t.string "name", :limit => 1000, :default => "0" + t.text "description", :limit => 16777215 + t.string "commit_count", :limit => 100, :default => "0" + t.string "code_line", :limit => 100 + t.string "last_commit_time", :limit => 100 + t.string "url", :limit => 1000 + t.datetime "date_collected" + t.string "created_at", :limit => 100 + t.string "updated_at", :limit => 100 + t.integer "proj_id", :null => false + t.string "user_count", :limit => 100 + end + + add_index "tprojects", ["proj_id"], :name => "proj_id" + create_table "trackers", :force => true do |t| t.string "name", :limit => 30, :default => "", :null => false t.boolean "is_in_chlog", :default => false, :null => false diff --git a/test/fixtures/relative_memos.yml b/test/fixtures/relative_memos.yml new file mode 100644 index 00000000..c63aac0b --- /dev/null +++ b/test/fixtures/relative_memos.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/unit/relative_memo_test.rb b/test/unit/relative_memo_test.rb new file mode 100644 index 00000000..5f835a2a --- /dev/null +++ b/test/unit/relative_memo_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class RelativeMemoTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end
  • 软件项目托管社区开源项目社区 <%= l(:label_user_location) %> :
    <%= l(:label_member) %><%= l(:label_user_watchered) %> 贡献者讨论 <%= l(:label_project_issues) %>