diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index f35210f01..6e067fb83 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -58,12 +58,18 @@ class WelcomeController < ApplicationController else case @first_page.sort_type when 0 + @my_projects = find_my_projects + @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] @projects = find_miracle_project(10, 3,"created_on desc") #@projects = @projects_all.order("created_on desc") when 1 + @my_projects = find_my_projects + @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] @projects = find_miracle_project(10, 3,"score desc") #@projects = @projects_all.order("grade desc") when 2 + @my_projects = find_my_projects + @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] @projects = find_miracle_project(10, 3,"watchers_count desc") #@projects = @projects_all.order("watchers_count desc") diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index f6e205e82..4800a949a 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -443,6 +443,10 @@ module WelcomeHelper resultSet.take(limit) end + def find_my_projects + my_projects = User.current.memberships.all(conditions: "projects.project_type = 0") + end + def sort_project_by_hot_rails project_type=0, order_by='score DESC', limit=15 # Project.find_by_sql(" # SELECT p.id, p.name, p.description, p.identifier, t.project_id diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 64a9111e0..958d62975 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -13,7 +13,7 @@ <%= javascript_heads %> <%= heads_for_theme %> <%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %> - <%= javascript_include_tag 'project', 'header','select_list_move' %> + <%= javascript_include_tag 'cookie','project', 'header','select_list_move' %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 077bccdad..96e3b84be 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -30,13 +30,13 @@

-
收起Git操作指南
+
收起Git操作指南

-

项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码

- -

建立版本库文件夹,打开命令行执行如下:

+

项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码。

+

通过cmd命令提示符进入代码对应文件夹的根目录,假设当前用户的登录名为user,版本库名称为demo,需要操作的版本库分支为branch。 + 如果是首次提交代码,执行如下命令:

git init

@@ -46,19 +46,19 @@

git commit -m "first commit"

git remote add origin - http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git + http://user_demo@repository.trustie.net/user/demo.git

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u origin master:master

+

git push -u origin branch:branch

已经有本地库,还没有配置远程地址,打开命令行执行如下:

-

git remote add origin http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git

+

git remote add origin http://user_demo@repository.trustie.net/user/demo.git

git add .

@@ -66,14 +66,14 @@

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u origin master:master

+

git push -u origin branch:branch

已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:

-

git clone http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git

+

git clone http://user_demo@repository.trustie.net/user/demo.git

git push

@@ -87,7 +87,7 @@

git remote add trustie - http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git + http://user_demo@repository.trustie.net/user/demo.git

git add .

@@ -96,7 +96,7 @@

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u trustie master:master

+

git push -u trustie branch:branch

李海提供

diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 31b66727f..69dda693e 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -39,9 +39,9 @@ - + - + <% end %> diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index e371296a5..d89fc33ee 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -415,3 +415,4 @@ zh: # field_sharing: 共享 label_title_code_review: 代码评审 + label_home_non_project: 您还没有创建项目,您可能对系统的其它项目感兴趣! \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 006b26e91..dcbe017fb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -654,16 +654,6 @@ ActiveRecord::Schema.define(:version => 20150428021035) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" diff --git a/public/javascripts/cookie.js b/public/javascripts/cookie.js new file mode 100644 index 000000000..9e14ed810 --- /dev/null +++ b/public/javascripts/cookie.js @@ -0,0 +1,39 @@ +//保存cookie +//n:cookie的名字 +//v:cookie的值 +//mins:时间(分钟) +//dn: +//path:保存路径 +function cookiesave(n, v, mins, dn, path) +{ + if(n) + { + + if(!mins) mins = 365 * 24 * 60; + if(!path) path = "/"; + var date = new Date(); + + date.setTime(date.getTime() + (mins * 60 * 1000)); + + var expires = "; expires=" + date.toGMTString(); + + if(dn) dn = "domain=" + dn + "; "; + document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path; + + } +} + +//获取cookie +function cookieget(n) +{ + var name = n + "="; + var ca = document.cookie.split(';'); + for(var i=0;i