Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-05-05 17:19:18 +08:00
commit b6993e78a6
9 changed files with 79 additions and 39 deletions

View File

@ -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")

View File

@ -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

View File

@ -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 %>
<!-- page specific tags -->
<%= yield :header_tags -%>

View File

@ -30,13 +30,13 @@
</p>
</div>
</div>
<div class="repos_more"><a id="showgithelp" value="hide_help" onclick ="showhelpAndScrollTo('repos_git_more','repos_git_more'); return false;" class="c_dblue lh23">收起Git操作指南</a></div>
<div class="repos_more"><a id="showgithelp" value="hide_help" onclick ="showhelpAndScrollTo('repos_git_more'); " class="c_dblue lh23">收起Git操作指南</a></div>
<div id="repos_git_more">
<br>
<div class=" c_dark f14">
<p>项目代码请设置好正确的编码方式utf-8否则中文会出现乱码</p>
<p>建立版本库文件夹,打开命令行执行如下</p>
<p>项目代码请设置好正确的编码方式utf-8否则中文会出现乱码</p>
<p>通过cmd命令提示符进入代码对应文件夹的根目录假设当前用户的登录名为user版本库名称为demo需要操作的版本库分支为branch。
如果是首次提交代码,执行如下命令</p>
</div>
<div class="repos_explain">
<p>git init</p>
@ -46,19 +46,19 @@
<p>git commit -m "first commit"</p>
<p>git remote add origin
http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git
http://user_demo@repository.trustie.net/user/demo.git
</p>
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
<p>git push -u origin master:master</p>
<p>git push -u origin branch:branch</p>
</div>
<!--repos_explain end-->
<div class="c_dark f14">
<p>已经有本地库,还没有配置远程地址,打开命令行执行如下:</p>
</div>
<div class="repos_explain">
<p>git remote add origin http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git</p>
<p>git remote add origin http://user_demo@repository.trustie.net/user/demo.git</p>
<p>git add .</p>
@ -66,14 +66,14 @@
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
<p>git push -u origin master:master</p>
<p>git push -u origin branch:branch</p>
</div>
<!--repos_explain end-->
<div class="c_dark f14">
<p>已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:</p>
</div>
<div class="repos_explain">
<p>git clone http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git</p>
<p>git clone http://user_demo@repository.trustie.net/user/demo.git</p>
<p>git push</p>
@ -87,7 +87,7 @@
</div>
<div class="repos_explain">
<p>git remote add trustie
http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git
http://user_demo@repository.trustie.net/user/demo.git
</p>
<p>git add .</p>
@ -96,7 +96,7 @@
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
<p>git push -u trustie master:master</p>
<p>git push -u trustie branch:branch</p>
<p><a href="/users/646" class="c_orange">李海</a>提供</p>
</div>

View File

@ -39,9 +39,9 @@
</tr>
</table></td>
</tr>
</table>
</li>
<% end %>
</ul>

View File

@ -415,3 +415,4 @@ zh:
#
field_sharing: 共享
label_title_code_review: 代码评审
label_home_non_project: 您还没有创建项目,您可能对系统的其它项目感兴趣!

View File

@ -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"

View File

@ -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<ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(name) == 0){
return c.substring(name.length,c.length);}
}
return false;
}

View File

@ -61,25 +61,25 @@ function show_more_msg() {
//项目版本库git帮助文档显示
function showhelpAndScrollTo(id, focus) {
var information = $("#showgithelp");
var val = information.attr("value");
if (val == "show_help") {
$("#showgithelp").text("收起Git操作指南");
information.attr("value", "hide_help");
$('#' + id).show();
if (focus !== null) {
$('#' + focus).focus();
}
$('html, body').animate({scrollTop: $('#' + id).offset().top}, 400);
function showhelpAndScrollTo(id) {
$('#' + id).toggle();
if(cookieget("repositories_visiable") == "true")
{
cookiesave("repositories_visiable", false,'','','');
}
else {
$("#showgithelp").text("显示Git操作指南");
information.attr("value", "show_help");
$('#' + id).hide();
else
{
cookiesave("repositories_visiable", true,'','','');
}
}
$(function(){
if(cookieget("repositories_visiable") == "true")
{
$('#repos_git_more').hide();
}
});
///////////////////////////////////////////////////////////////