From 920e470f6d487764a3480d5eb053b712020fdc01 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 5 Aug 2016 17:51:39 +0800 Subject: [PATCH 01/55] =?UTF-8?q?pull=20request=E5=88=97=E8=A1=A8=E7=9C=81?= =?UTF-8?q?=E7=95=A5=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/pull_requests/_pull_requests_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pull_requests/_pull_requests_list.html.erb b/app/views/pull_requests/_pull_requests_list.html.erb index db9059710..e32940ca3 100644 --- a/app/views/pull_requests/_pull_requests_list.html.erb +++ b/app/views/pull_requests/_pull_requests_list.html.erb @@ -4,7 +4,7 @@ <% @requests.each do |request| %>
  • <% request %> - <%=link_to request.title, project_pull_request_path(request.id, :project_id => @project.id), :class => "linkGrey3 fb fl"%> + <%=link_to request.title, project_pull_request_path(request.id, :project_id => @project.id), :class => "linkGrey3 fb fl hidden", :style => "width:100%;"%>
    由 <%= link_to request.author.try(:username), user_path(get_user_by_login_and(request.author.try(:username))), :class => "link-blue" %> 创建于<%= time_tag(request.created_at) %> From 518d6bacbeef22ba7cb5a8be5b5800a668fbe156 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 8 Aug 2016 15:23:55 +0800 Subject: [PATCH 02/55] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=B3=E9=97=ADpull?= =?UTF-8?q?=20request=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 14 +++++++++++++- app/helpers/pull_requests_helper.rb | 11 +++++++++++ app/views/pull_requests/_show.html.erb | 6 ++++-- config/locales/projects/zh.yml | 7 ++++++- config/routes.rb | 1 + 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 58d1cb3b2..c365a8b37 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -1,7 +1,7 @@ class PullRequestsController < ApplicationController before_filter :find_project_and_repository - before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new] + before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, :update_pull_request] layout "base_projects" include PullRequestsHelper include ApplicationHelper @@ -107,6 +107,18 @@ class PullRequestsController < ApplicationController end end + # 更新请求的状态state => cloesed + def update_pull_request + begin + @g.update_merge_request(@project.gpid, params[:id], :state_event => params[:state]) + respond_to do |format| + format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)} + end + rescue Exception => e + @message = e.message + end + end + # 获取某次请求的提交次数 def pull_request_commits @type = parms[:type] diff --git a/app/helpers/pull_requests_helper.rb b/app/helpers/pull_requests_helper.rb index 82d4edc0f..c33100ea8 100644 --- a/app/helpers/pull_requests_helper.rb +++ b/app/helpers/pull_requests_helper.rb @@ -14,4 +14,15 @@ module PullRequestsHelper User.find(user_id).try(:login) end + def get_state state + case state + when "open","reopened" + l(:label_state_open) + when "closed" + l(:label_state_closed) + when "merged" + l(:label_state_merged) + end + end + end diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index 7bcf296a3..bb3cefc9f 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -4,8 +4,10 @@
    - <%= @request.state == "merged" ? "已合并" : "待处理" %>合并请求 由<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %>提交 · 最后编辑时间<%= time_tag(@request.updated_at) %> - + <%= get_state(@request.state) %>合并请求 由<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %>提交 · 最后编辑时间<%= time_tag(@request.updated_at) %> + <% unless @request.state == "merged" %> + <%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %> + <% end %>
    <%= @request.title %>

    <%= @request.description %>

    diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 91cc96791..792ff35fd 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -456,4 +456,9 @@ zh: # 版本库迁移 label_repository_migrate_dec: 注意:Trustie版本库近期进行了一次大的改造,历史版本需要转换成新的版本,输入新的版本库名,即可完成转换。 转换过程可能需要等待一段时间。 - label_repository_name_dec: 版本库名仅小写字母(a-z)、数字、破折号(-)和下划线(_)可以使用,长度必须在 1 到 254 个字符之间,一旦保存,标识无法修改。 \ No newline at end of file + label_repository_name_dec: 版本库名仅小写字母(a-z)、数字、破折号(-)和下划线(_)可以使用,长度必须在 1 到 254 个字符之间,一旦保存,标识无法修改。 + + # pull requests + label_state_open: 待处理 + label_state_closed: 关闭 + label_state_merged: 已合并 diff --git a/config/routes.rb b/config/routes.rb index 5527212fd..eb822d27e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -816,6 +816,7 @@ RedmineApp::Application.routes.draw do get 'accept_pull_request' get 'pull_request_commits' get 'pull_request_changes' + get 'update_pull_request' end end From 53dd41ec37fe9592e11b5d297199b356f691923a Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 8 Aug 2016 16:33:39 +0800 Subject: [PATCH 03/55] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=95=99=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/pull_requests/_show.html.erb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index b3d6dd314..e1d54dce4 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -4,7 +4,7 @@
    - <%= @request.state == "merged" ? "已合并" : "待处理" %>合并请求 由<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %>提交 · 最后编辑时间<%= time_tag(@request.updated_at) %> + <%= @request.state == "merged" ? "已合并" : "待处理" %>合并请求 由 <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %> 于 <%= time_tag(@request.created_at) %> 提交 · 最后编辑时间 <%= time_tag(@request.updated_at) %>
    @@ -25,14 +25,18 @@
      -
    • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %>
    • +
    • <%= link_to "留言#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 0), :remote => true, :class => "active" %>
    • +
    • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true %>
    • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %>
    根据最近提交时间排列
    - <%= render :partial => "pull_requests/pull_request_commits" %> + 留言
    + <%= render :partial => "pull_requests/pull_request_commits" %> +
    +
    <%= render :partial => "pull_requests/pull_request_changes" %>
    <% end %> @@ -54,7 +58,7 @@ var index = $(".merge-record li a").index(this); - $("#merge_record_0, #merge_record_1").hide(); + $("#merge_record_0, #merge_record_1,#merge_record_2").hide(); $("#merge_record_" + index).show(); }); \ No newline at end of file From d1b4e83fee2e5a22de0c6d412444ee941933c27d Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 9 Aug 2016 10:29:18 +0800 Subject: [PATCH 04/55] =?UTF-8?q?=E5=AE=8C=E6=88=90pull=20request=20?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 5 ++++- app/views/pull_requests/index.html.erb | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index c365a8b37..7233bdfe7 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -14,9 +14,12 @@ class PullRequestsController < ApplicationController @requests = @g.merge_requests(@project.gpid).select{|request| request.state == "opened" || request.state == "reopened"} when "2" @requests = @g.merge_requests(@project.gpid).select{|request| request.state == "merged"} + when "3" + @requests = @g.merge_requests(@project.gpid).select{|request| request.state == "closed"} end @requests_opened_count = @requests.count - @requests_merged_count = params[:type] ? @requests.count : @g.merge_requests(@project.gpid).select{|request| request.state == "merged"}.count + @requests_merged_count = @g.merge_requests(@project.gpid).select{|request| request.state == "merged"}.count + @requests_closed_count = @g.merge_requests(@project.gpid).select{|request| request.state == "closed"}.count respond_to do |format| format.html format.js diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb index f9f7fe4db..23ca13178 100644 --- a/app/views/pull_requests/index.html.erb +++ b/app/views/pull_requests/index.html.erb @@ -2,6 +2,7 @@
    • <%= link_to "待处理#{@requests_opened_count}".html_safe, project_pull_requests_path(:type => "1"), :remote => true %>
    • <%= link_to "已处理#{@requests_merged_count}".html_safe, project_pull_requests_path(:type => "2"), :remote => true %>
    • +
    • <%= link_to "已关闭#{@requests_closed_count}".html_safe, project_pull_requests_path(:type => "3"), :remote => true %>
    • <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %>
      From 5dd6244a347b506d8c1b1fe8286f9fe38125f5f0 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 9 Aug 2016 10:45:14 +0800 Subject: [PATCH 05/55] =?UTF-8?q?pull=20request=E6=B7=BB=E5=8A=A0=E7=95=99?= =?UTF-8?q?=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_pull_request_commits.html.erb | 3 +- app/views/pull_requests/_show.html.erb | 32 ++++++++++++------- public/stylesheets/css/project.css | 7 +++- public/stylesheets/css/structure.css | 1 + 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/app/views/pull_requests/_pull_request_commits.html.erb b/app/views/pull_requests/_pull_request_commits.html.erb index a7f6b5aa7..b7b47ede2 100644 --- a/app/views/pull_requests/_pull_request_commits.html.erb +++ b/app/views/pull_requests/_pull_request_commits.html.erb @@ -1,9 +1,10 @@ +
      根据最近提交时间排列
      <% @commits.each do |commit| %>
      <%= format_date(commit.created_at) %> -

      <%= link_to commit.author_name, user_path(get_user_by_mail(commit.author_email)), :class => "link-blue" %>创建于<%= time_tag(commit.created_at) %>前

      +

      <%= link_to commit.author_name, user_path(get_user_by_mail(commit.author_email)), :class => "link-blue" %> 创建于<%= time_tag(commit.created_at) %>前

      <%= commit.title %> diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index bb3cefc9f..ce0c633c6 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -4,7 +4,7 @@
      - <%= get_state(@request.state) %>合并请求 由<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %>提交 · 最后编辑时间<%= time_tag(@request.updated_at) %> + <%= get_state(@request.state) %>合并请求 由 <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %> 于 <%= time_tag(@request.created_at) %> 前提交 · 最后编辑时间 <%= time_tag(@request.updated_at) %> 前 <% unless @request.state == "merged" %> <%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %> <% end %> @@ -36,14 +36,30 @@
        -
      • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %>
      • +
      • <%= link_to "留言#{@commits_count}".html_safe, :class => "active" %>
      • +
      • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true %>
      • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %>
      -
      根据最近提交时间排列
      - <%= render :partial => "pull_requests/pull_request_commits" %> +
      + Hjqreturn20小时前 +
      +
      回复内容
      +
      +
      + Hjqreturn20小时前 +
      +
      已关闭请求/重新审核请求
      +
      +
      + + 提 交 +
      + <%= render :partial => "pull_requests/pull_request_commits" %> +
      +
      <%= render :partial => "pull_requests/pull_request_changes" %>
      <% end %> @@ -53,19 +69,13 @@ \ No newline at end of file diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index 4c4019593..3653cf799 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -540,4 +540,9 @@ a:hover.upload_btn_grey{background:#8a8a8a;} .merge-commit-code {width:150px; float:left; text-align:right;} .merge-show {margin:-10px -10px 0 -10px; padding:10px; line-height:36px; border-bottom:1px solid #ddd;} .open-status {color:#fff; padding:0 16px; background-color:#3b94d6; border-radius:2px; display:inline-block;} -.merge-commit-option {padding:12px; border:1px solid #ddd; background-color:#f9f9f9; border-radius:2px;} \ No newline at end of file +.merge-commit-option {padding:12px; border:1px solid #ddd; background-color:#f9f9f9; border-radius:2px;} +.merge-discussion-content {font-size:13px; color: #484848; margin:0 -10px; padding:10px; border-bottom:1px solid #ddd;} +.merge-discussion-detail {font-size:13px; line-height:1.5em; color:#484848; margin-top:10px;} +.merge-discussion-automatic {background-color:#fdfdfd;} +.merge-discussion-input {margin:0 -10px; padding:10px; background-color:#f8f8f8;} +.merge-discussion-input textarea {width:720px; height:80px; font-size:13px; line-height:16px; color:#484848; margin-bottom:10px; padding:5px;} \ No newline at end of file diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index 44b1165c6..c9a4059e0 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -474,6 +474,7 @@ a.f_grey:hover {color:#000000;} .shadowbox_news_list{ max-height:400px; overflow:hidden;} .shadowbox_news_list a{ color:#999;} .shadowbox_news_list li{ height:40px; border-bottom:1px dashed #ebebeb; line-height:40px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis; padding:0 10px;} +.shadowbox_news_list li:last-child {border-bottom:none;} .shadowbox_news_list li:hover{ background-color:#eee;} span.shadowbox_news_user{ color:#3b94d6;} a.shadowbox_news_all{ display:block; width:305px; height:40px; line-height:40px; color:#3b94d6; text-align:center;border-top:1px solid #eee;} From 6319a1bac6236f3570f5aa8fefec07f6aec6429f Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 9 Aug 2016 10:53:44 +0800 Subject: [PATCH 06/55] =?UTF-8?q?PR=E6=B7=BB=E5=8A=A0=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 68 ++++++++++++++++++--- config/routes.rb | 1 + 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 7233bdfe7..8d11e7279 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -110,7 +110,20 @@ class PullRequestsController < ApplicationController end end - # 更新请求的状态state => cloesed + # Updates a merge request. + # + # @example + # Gitlab.update_merge_request(5, 42, :title => 'New title') + # + # @param [Integer] project The ID of a project. + # @param [Integer] id The ID of a merge request. + # @param [Hash] options A customizable set of options. + # @option options [String] :title The title of a merge request. + # @option options [String] :source_branch The source branch name. + # @option options [String] :target_branch The target branch name. + # @option options [Integer] :assignee_id The ID of a user to assign merge request. + # @option options [String] :state_event New state (close|reopen|merge). + # @return [Gitlab::ObjectifiedHash] Information about updated merge request. def update_pull_request begin @g.update_merge_request(@project.gpid, params[:id], :state_event => params[:state]) @@ -122,16 +135,57 @@ class PullRequestsController < ApplicationController end end - # 获取某次请求的提交次数 + # Creates a merge request. + # + # @example + # Gitlab.create_merge_request(5, 'New merge request', + # :source_branch => 'source_branch', :target_branch => 'target_branch') + # Gitlab.create_merge_request(5, 'New merge request', + # :source_branch => 'source_branch', :target_branch => 'target_branch', :assignee_id => 42) + def create_pull_request_comment + content = params[:content] + begin + @comments = @g.create_merge_request_comment(@project.gpid, params[:id], content) + rescue Exception => e + @message = e.message + end + end + + # Gets the comments on a merge request. + # + # @example + # Gitlab.merge_request_comments(5, 1) + def pull_request_comments + begin + @comments = @g.merge_request_comments(@project.gpid, params[:id]) + rescue Exception => e + @message = e.message + end + end + + # Get a list of merge request commits. + # Parameters: + # id (required) - The ID of a project + # merge_request_id (required) - The ID of MR def pull_request_commits - @type = parms[:type] - @commits = @g.merge_request_commits(@project.gpid, params[:id].to_i) + begin + @commits = @g.merge_request_commits(@project.gpid, params[:id]) + rescue Exception => e + @message = e.message + end end - # 获取某次请求的改动 + # Shows information about the merge request including its files and changes. With GitLab 8.2 the return fields upvotes and downvotes are deprecated and always return 0. + # Parameters: + # id (required) - The ID of a project + # merge_request_id (required) - The ID of MR def pull_request_changes - @changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes) - @changes_count = @changes.count + begin + @changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes) + @changes_count = @changes.count + rescue Exception => e + @message = e.message + end end private diff --git a/config/routes.rb b/config/routes.rb index eb822d27e..b50ee9c65 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -817,6 +817,7 @@ RedmineApp::Application.routes.draw do get 'pull_request_commits' get 'pull_request_changes' get 'update_pull_request' + get 'pull_request_comments' end end From b7bccc7d227b22e83c99b8c911e540e439510919 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 9 Aug 2016 14:00:36 +0800 Subject: [PATCH 07/55] =?UTF-8?q?PR=E6=B7=BB=E5=8A=A0=E8=AF=84=E8=AE=BA=20?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 5 +++- .../_pull_request_comments.html.erb | 19 +++++++++++++ app/views/pull_requests/_show.html.erb | 27 +++++-------------- .../pull_requests/pull_request_changes.js.erb | 2 +- .../pull_request_comments.js.erb | 1 + .../pull_requests/pull_request_commits.js.erb | 2 +- 6 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 app/views/pull_requests/_pull_request_comments.html.erb create mode 100644 app/views/pull_requests/pull_request_comments.js.erb diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 8d11e7279..f63f1dc17 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -1,7 +1,7 @@ class PullRequestsController < ApplicationController before_filter :find_project_and_repository - before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, :update_pull_request] + before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, :update_pull_request, :pull_request_comments] layout "base_projects" include PullRequestsHelper include ApplicationHelper @@ -87,6 +87,8 @@ class PullRequestsController < ApplicationController @commits_count = @commits.count @changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes) @changes_count = @changes.count + @comments = @g.merge_request_comments(@project.gpid, params[:id]) + @comments_count = @comments.count end # Accept a merge request. @@ -170,6 +172,7 @@ class PullRequestsController < ApplicationController def pull_request_commits begin @commits = @g.merge_request_commits(@project.gpid, params[:id]) + @commits_count = @commits.count rescue Exception => e @message = e.message end diff --git a/app/views/pull_requests/_pull_request_comments.html.erb b/app/views/pull_requests/_pull_request_comments.html.erb new file mode 100644 index 000000000..e5fa3a052 --- /dev/null +++ b/app/views/pull_requests/_pull_request_comments.html.erb @@ -0,0 +1,19 @@ + + + + + +<% @comments.each do |comment| %> +
      + <%= link_to comment.author.try(:username), user_path(get_user_by_login_and(comment.author.try(:username))), :class => "link-blue mr15 fl" %> + <%#= time_tag(comment.author.try(:created_at)) %>前 +
      +
      <%= comment.note %>
      +
      +<% end %> + +
      + + + 提 交 +
      \ No newline at end of file diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index ce0c633c6..31d337faf 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -7,13 +7,13 @@ <%= get_state(@request.state) %>合并请求 由 <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %> 于 <%= time_tag(@request.created_at) %> 前提交 · 最后编辑时间 <%= time_tag(@request.updated_at) %> 前 <% unless @request.state == "merged" %> <%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %> - <% end %> + <% end %>
      <%= @request.title %>

      <%= @request.description %>

      +
      请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> - <% if @commits_count == 0 && @changes_count == 0 %>
      <%= @request.source_branch %>没有新内容可以合并至<%= @request.target_branch %>
      @@ -33,28 +33,15 @@
      <% end %> <% end %> -
      +
        -
      • <%= link_to "留言#{@commits_count}".html_safe, :class => "active" %>
      • -
      • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true %>
      • -
      • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %>
      • +
      • <%= link_to "留言#{@comments_count}".html_safe, pull_request_comments_project_pull_request_path(@request.id, :project_id => @project.id), :remote => true, :class => "active" %>
      • +
      • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id), :remote => true %>
      • +
      • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id), :remote => true %>
      -
      - Hjqreturn20小时前 -
      -
      回复内容
      -
      -
      - Hjqreturn20小时前 -
      -
      已关闭请求/重新审核请求
      -
      -
      - - 提 交 -
      + <%= render :partial => "pull_requests/pull_request_comments" %>
      <%= render :partial => "pull_requests/pull_request_commits" %> diff --git a/app/views/pull_requests/pull_request_changes.js.erb b/app/views/pull_requests/pull_request_changes.js.erb index 2b3d77537..d1cf90c2f 100644 --- a/app/views/pull_requests/pull_request_changes.js.erb +++ b/app/views/pull_requests/pull_request_changes.js.erb @@ -1 +1 @@ -$("#merge_record_1").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_changes", :locals => {:type => @type} ) %>'); \ No newline at end of file +$("#merge_record_2").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_changes", :locals => {:type => @type} ) %>'); \ No newline at end of file diff --git a/app/views/pull_requests/pull_request_comments.js.erb b/app/views/pull_requests/pull_request_comments.js.erb new file mode 100644 index 000000000..5a7e6683c --- /dev/null +++ b/app/views/pull_requests/pull_request_comments.js.erb @@ -0,0 +1 @@ +$("#merge_record_0").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_comments") %>'); \ No newline at end of file diff --git a/app/views/pull_requests/pull_request_commits.js.erb b/app/views/pull_requests/pull_request_commits.js.erb index 0833b1e8a..217198291 100644 --- a/app/views/pull_requests/pull_request_commits.js.erb +++ b/app/views/pull_requests/pull_request_commits.js.erb @@ -1 +1 @@ -$("#merge_record_0").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_commits", :locals => {:type => @type} ) %>'); \ No newline at end of file +$("#merge_record_1").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_commits", :locals => {:type => @type} ) %>'); \ No newline at end of file From 87c5f5054501dacac6d3d3dfaeb9cedc39c89e8d Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 9 Aug 2016 14:51:48 +0800 Subject: [PATCH 08/55] =?UTF-8?q?PULL=20request=20=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=8F=8A=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 8 +++- .../_pull_request_comments.html.erb | 42 ++++++++++++++----- .../pull_requests/pull_request_changes.js.erb | 2 +- .../pull_requests/pull_request_commits.js.erb | 2 +- config/routes.rb | 1 + public/stylesheets/css/project.css | 2 +- 6 files changed, 42 insertions(+), 15 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index f63f1dc17..7dc6b7b53 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -1,7 +1,8 @@ class PullRequestsController < ApplicationController before_filter :find_project_and_repository - before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, :update_pull_request, :pull_request_comments] + before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, + :update_pull_request, :pull_request_comments, :create_pull_request_comment] layout "base_projects" include PullRequestsHelper include ApplicationHelper @@ -145,9 +146,12 @@ class PullRequestsController < ApplicationController # Gitlab.create_merge_request(5, 'New merge request', # :source_branch => 'source_branch', :target_branch => 'target_branch', :assignee_id => 42) def create_pull_request_comment - content = params[:content] + content = params[:pull_request_comment] begin @comments = @g.create_merge_request_comment(@project.gpid, params[:id], content) + respond_to do |format| + format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)} + end rescue Exception => e @message = e.message end diff --git a/app/views/pull_requests/_pull_request_comments.html.erb b/app/views/pull_requests/_pull_request_comments.html.erb index e5fa3a052..5d1c2e6ad 100644 --- a/app/views/pull_requests/_pull_request_comments.html.erb +++ b/app/views/pull_requests/_pull_request_comments.html.erb @@ -1,8 +1,3 @@ - - - - - <% @comments.each do |comment| %>
      <%= link_to comment.author.try(:username), user_path(get_user_by_login_and(comment.author.try(:username))), :class => "link-blue mr15 fl" %> @@ -11,9 +6,36 @@
      <%= comment.note %>
      <% end %> -
      - - - 提 交 -
      \ No newline at end of file + <%= form_tag(url_for(:controller => 'pull_requests', :action => 'create_pull_request_comment', :project_id => @project.id), :id => 'pull_request_comment_form', :method => "post", :remote => true) do %> + + + 提交请求 + <% end %> +
      + + \ No newline at end of file diff --git a/app/views/pull_requests/pull_request_changes.js.erb b/app/views/pull_requests/pull_request_changes.js.erb index d1cf90c2f..9021c498d 100644 --- a/app/views/pull_requests/pull_request_changes.js.erb +++ b/app/views/pull_requests/pull_request_changes.js.erb @@ -1 +1 @@ -$("#merge_record_2").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_changes", :locals => {:type => @type} ) %>'); \ No newline at end of file +$("#merge_record_2").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_changes") %>'); \ No newline at end of file diff --git a/app/views/pull_requests/pull_request_commits.js.erb b/app/views/pull_requests/pull_request_commits.js.erb index 217198291..cc0a82010 100644 --- a/app/views/pull_requests/pull_request_commits.js.erb +++ b/app/views/pull_requests/pull_request_commits.js.erb @@ -1 +1 @@ -$("#merge_record_1").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_commits", :locals => {:type => @type} ) %>'); \ No newline at end of file +$("#merge_record_1").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_commits") %>'); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index b50ee9c65..58a48ebad 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -818,6 +818,7 @@ RedmineApp::Application.routes.draw do get 'pull_request_changes' get 'update_pull_request' get 'pull_request_comments' + post 'create_pull_request_comment' end end diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index 3653cf799..6b5bdffdb 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -545,4 +545,4 @@ a:hover.upload_btn_grey{background:#8a8a8a;} .merge-discussion-detail {font-size:13px; line-height:1.5em; color:#484848; margin-top:10px;} .merge-discussion-automatic {background-color:#fdfdfd;} .merge-discussion-input {margin:0 -10px; padding:10px; background-color:#f8f8f8;} -.merge-discussion-input textarea {width:720px; height:80px; font-size:13px; line-height:16px; color:#484848; margin-bottom:10px; padding:5px;} \ No newline at end of file +.merge-discussion-input textarea {width:720px; height:80px; font-size:13px; line-height:16px; color:#484848; padding:5px;} \ No newline at end of file From dcdc09d864e30a1cd47d308f17858ac92821495f Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 9 Aug 2016 15:02:15 +0800 Subject: [PATCH 09/55] =?UTF-8?q?=E4=BF=AE=E6=94=B9gitlab=20api=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 2 +- lib/gitlab-cli/lib/gitlab/client/merge_requests.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 7dc6b7b53..a1f77dffa 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -148,7 +148,7 @@ class PullRequestsController < ApplicationController def create_pull_request_comment content = params[:pull_request_comment] begin - @comments = @g.create_merge_request_comment(@project.gpid, params[:id], content) + @comments = @g.create_merge_request_comment(@project.gpid, params[:id], content, User.current.gid) respond_to do |format| format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)} end diff --git a/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb b/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb index 2006c58bf..b6a9ed051 100644 --- a/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb +++ b/lib/gitlab-cli/lib/gitlab/client/merge_requests.rb @@ -78,8 +78,8 @@ class Gitlab::Client # @param [Integer] id The ID of a merge request. # @param [String] note The content of a comment. # @return [Gitlab::ObjectifiedHash] Information about created merge request comment. - def create_merge_request_comment(project, id, note) - post("/projects/#{project}/merge_request/#{id}/comments", :body => {:note => note}) + def create_merge_request_comment(project, id, note, gid) + post("/projects/#{project}/merge_request/#{id}/comments?user_id=#{gid}", :body => {:note => note}) end # Get a list of merge request commits. From 867434531d81a616ead01b2db7a643694cb9f150 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 9 Aug 2016 15:28:06 +0800 Subject: [PATCH 10/55] =?UTF-8?q?pull=20request=20=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 7 +++++++ app/helpers/pull_requests_helper.rb | 11 +++++++++++ app/views/pull_requests/_pull_requests_list.html.erb | 9 +++++++++ app/views/pull_requests/index.html.erb | 1 + public/stylesheets/css/project.css | 2 +- 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index a1f77dffa..d65c00722 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -21,6 +21,13 @@ class PullRequestsController < ApplicationController @requests_opened_count = @requests.count @requests_merged_count = @g.merge_requests(@project.gpid).select{|request| request.state == "merged"}.count @requests_closed_count = @g.merge_requests(@project.gpid).select{|request| request.state == "closed"}.count + + @limit = 10 + @is_remote = true + @count = type_count(type, @requests_opened_count, @requests_merged_count, @requests_closed_count) + @pages = Paginator.new @count, @limit, params['page'] || 1 + @offset ||= @pages.offset + @requests = paginateHelper @requests, 10 respond_to do |format| format.html format.js diff --git a/app/helpers/pull_requests_helper.rb b/app/helpers/pull_requests_helper.rb index c33100ea8..fc9e7b4c8 100644 --- a/app/helpers/pull_requests_helper.rb +++ b/app/helpers/pull_requests_helper.rb @@ -25,4 +25,15 @@ module PullRequestsHelper end end + def type_count type, requests_opened_count, requests_merged_count, requests_closed_count + case type + when nil, "1" + requests_opened_count + when "2" + requests_merged_count + when "3" + requests_closed_count + end + end + end diff --git a/app/views/pull_requests/_pull_requests_list.html.erb b/app/views/pull_requests/_pull_requests_list.html.erb index e32940ca3..80866afca 100644 --- a/app/views/pull_requests/_pull_requests_list.html.erb +++ b/app/views/pull_requests/_pull_requests_list.html.erb @@ -12,4 +12,13 @@
      <% end %> + +
      +
      +
        + <%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%> +
      +
      +
      +
      <% end %> \ No newline at end of file diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb index 23ca13178..78c4759aa 100644 --- a/app/views/pull_requests/index.html.erb +++ b/app/views/pull_requests/index.html.erb @@ -13,6 +13,7 @@ <%= render "pull_requests/pull_requests_list" %>
    + \ No newline at end of file +
    \ No newline at end of file diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 3f6836614..99b9812cc 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -10,6 +10,9 @@ } else { $("#anonymous_comment").attr('checked',false); } + if($.trim($("#base_on_project").val()) == 1) { + $("#base_on_project").attr('checked','checked'); + } <% if edit_mode && homework.is_program_homework? %> $("#BluePopupBox a.BlueCirBtn").click(); <% end %> From bae0562b9761a5ef9a3f240566266093e2cbf343 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 11 Aug 2016 10:32:57 +0800 Subject: [PATCH 29/55] =?UTF-8?q?=E9=80=82=E7=94=A8=E4=B8=93=E4=B8=9A?= =?UTF-8?q?=E5=92=8C=E5=85=88=E4=BF=AE=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=8D=A2?= =?UTF-8?q?=E8=A1=8C=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_syllabus_base_info.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/layouts/_syllabus_base_info.html.erb b/app/views/layouts/_syllabus_base_info.html.erb index 335dc3335..0cc88dcf1 100644 --- a/app/views/layouts/_syllabus_base_info.html.erb +++ b/app/views/layouts/_syllabus_base_info.html.erb @@ -5,27 +5,27 @@
      -
    • <%=syllabus.user.show_name %>
    • +
    • <%=syllabus.user.show_name %>
    • <% unless syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %> -
    • <%=syllabus.syllabus_type_str %>
    • +
    • <%=syllabus.syllabus_type_str %>
    • <% end %> <% unless syllabus.credit.nil? || syllabus.credit == '' %> -
    • <%=syllabus.credit %>学分
    • +
    • <%=syllabus.credit %>学分
    • <% end %> <% unless syllabus.hours.nil? || syllabus.hours == '' %> -
    • <%=syllabus.hours %>学时
    • +
    • <%=syllabus.hours %>学时
    • <% end %> <% unless syllabus.theory_hours.nil? || syllabus.theory_hours == '' %> -
    • <%=syllabus.theory_hours %>学时
    • +
    • <%=syllabus.theory_hours %>学时
    • <% end %> <% unless syllabus.practice_hours.nil? || syllabus.practice_hours == '' %> -
    • <%=syllabus.practice_hours %>学时
    • +
    • <%=syllabus.practice_hours %>学时
    • <% end %> <% unless syllabus.applicable_major.nil? || syllabus.applicable_major == '' %> -
    • <%=syllabus.applicable_major %>
    • +
    • <%=syllabus.applicable_major %>
    • <% end %> <% unless syllabus.pre_course.nil? || syllabus.pre_course == '' %> -
    • <%=syllabus.pre_course %>
    • +
    • <%=syllabus.pre_course %>
    • <% end %> <% if syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %> From a9942fd4b3ae9d08a1648aee5a81cd17638b1818 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 11 Aug 2016 10:48:48 +0800 Subject: [PATCH 30/55] change integer to A --- app/helpers/quality_analysis_helper.rb | 5 +++++ app/views/quality_analysis/_show.html.erb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/helpers/quality_analysis_helper.rb b/app/helpers/quality_analysis_helper.rb index 5940dd255..dc7db673e 100644 --- a/app/helpers/quality_analysis_helper.rb +++ b/app/helpers/quality_analysis_helper.rb @@ -6,18 +6,23 @@ module QualityAnalysisHelper if val <= 5 arr << "很好" arr << "b_green2" + arr << "A" elsif val. > 5 && val <= 10 arr << "较好" arr << "b_slow_yellow" + arr << "B" elsif val > 10 && val <= 20 arr << "中等" arr << "b_yellow" + arr << "C" elsif val > 20 && val <= 50 arr << "较差" arr << "b_slow_red" + arr << "D" elsif val > 20 arr << "很差" arr << "b_red" + arr << "E" end end diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index 7901c6be0..f9dbfc510 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -12,7 +12,7 @@

      质量等级

      -

      <%= @ha["sqale_rating"] %> +

      <%= sqale_rating_status(@ha["sqale_rating"].to_i)[2] %> borderRadius"> <%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %> From 41ad5ca444a81462d41a80f00a2fbbdbb9e9bd5d Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 11 Aug 2016 11:11:49 +0800 Subject: [PATCH 31/55] =?UTF-8?q?=E4=BF=AE=E6=94=B9Gitlab=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=9B=9E=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/pull_requests/_pull_request_comments.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pull_requests/_pull_request_comments.html.erb b/app/views/pull_requests/_pull_request_comments.html.erb index 01cfe7cf2..2a02cb8db 100644 --- a/app/views/pull_requests/_pull_request_comments.html.erb +++ b/app/views/pull_requests/_pull_request_comments.html.erb @@ -8,7 +8,7 @@ <% @comments.reverse.each do |comment| %>

      <%= link_to comment.author.try(:username), user_path(get_user_by_login_and(comment.author.try(:username))), :class => "link-blue mr15 fl" %> - <%#= time_tag(comment.author.try(:created_at)) %>前 + <%= time_tag(comment.created_at) %>前
      <%= comment.note %>
      From 3df8a4663441aba3c8ba36ec3549402e0f549ba9 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 11 Aug 2016 14:16:13 +0800 Subject: [PATCH 32/55] =?UTF-8?q?PUll=20request=E4=BB=A3=E7=A0=81=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E5=8F=8Areverse=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 6 ++- .../_pull_request_changes.html.erb | 2 +- .../_pull_request_comments.html.erb | 2 +- .../_pull_request_commits.html.erb | 45 ++++++++++--------- app/views/pull_requests/_show.html.erb | 15 ++++--- 5 files changed, 39 insertions(+), 31 deletions(-) diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 2592421a6..56dc0839f 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -95,7 +95,7 @@ class PullRequestsController < ApplicationController @commits_count = @commits.count @changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes) @changes_count = @changes.count - @comments = @g.merge_request_comments(@project.gpid, params[:id]) + @comments = @g.merge_request_comments(@project.gpid, params[:id]).reverse @comments_count = @comments.count @limit = 10 @@ -178,7 +178,7 @@ class PullRequestsController < ApplicationController # Gitlab.merge_request_comments(5, 1) def pull_request_comments begin - @comments = @g.merge_request_comments(@project.gpid, params[:id]) + @comments = @g.merge_request_comments(@project.gpid, params[:id]).reverse @comments_count = @comments.count @limit = 10 @@ -198,6 +198,7 @@ class PullRequestsController < ApplicationController # merge_request_id (required) - The ID of MR def pull_request_commits begin + @type = params[:type] @commits = @g.merge_request_commits(@project.gpid, params[:id]) @commits_count = @commits.count @@ -218,6 +219,7 @@ class PullRequestsController < ApplicationController # merge_request_id (required) - The ID of MR def pull_request_changes begin + @type = params[:type] @changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes) @changes_count = @changes.count diff --git a/app/views/pull_requests/_pull_request_changes.html.erb b/app/views/pull_requests/_pull_request_changes.html.erb index d56702533..07e891ec6 100644 --- a/app/views/pull_requests/_pull_request_changes.html.erb +++ b/app/views/pull_requests/_pull_request_changes.html.erb @@ -1,4 +1,4 @@ -<% unless @changes.blank? %> +<% if !@changes.blank? && @type == "3" %> <% @changes.each do |cd| %> -<% @comments.reverse.each do |comment| %> +<% @comments.each do |comment| %>
      <%= link_to comment.author.try(:username), user_path(get_user_by_login_and(comment.author.try(:username))), :class => "link-blue mr15 fl" %> <%= time_tag(comment.created_at) %>前 diff --git a/app/views/pull_requests/_pull_request_commits.html.erb b/app/views/pull_requests/_pull_request_commits.html.erb index 44670f91f..0351f6919 100644 --- a/app/views/pull_requests/_pull_request_commits.html.erb +++ b/app/views/pull_requests/_pull_request_commits.html.erb @@ -1,29 +1,32 @@
      根据最近提交时间排列
      -<% @commits.each do |commit| %> -
      -
      - <%= format_date(commit.created_at) %> - -

      <%= link_to commit.author_name, user_path(get_user_by_mail(commit.author_email)), :class => "link-blue" %> 创建于<%= time_tag(commit.created_at) %>前

      -
      -
      - <%= commit.title %> +<% if !@commits.blank? && @type == "2" %> + <% @commits.each do |commit| %> +
      +
      + <%= format_date(commit.created_at) %> + +

      <%= link_to commit.author_name, user_path(get_user_by_mail(commit.author_email)), :class => "link-blue" %> 创建于<%= time_tag(commit.created_at) %>前

      +
      +
      + <%= commit.title %> -
      -
      +
      +
      <%= link_to truncate(commit.short_id, :length => 20), {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit.id}, :target => "_blank" %> +
      +
      +
      + <% end %> +
      +
      +
        + <%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%> +
      +
      +
      -
      -
      <% end %> -
      -
      -
        - <%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%> -
      -
      -
      -
      + diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index d792dc823..3edb9c874 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -40,19 +40,22 @@
        -
      • <%= link_to "留言#{@comments_count}".html_safe, pull_request_comments_project_pull_request_path(@request.id, :project_id => @project.id), :remote => true, :class => "active" %>
      • -
      • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id), :remote => true %>
      • -
      • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id), :remote => true %>
      • +
      • <%= link_to "留言#{@comments_count}".html_safe, pull_request_comments_project_pull_request_path(@request.id, :project_id => @project.id, :type => "1"), :remote => true, :class => "active" %>
      • +
      • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => "2"), :remote => true %>
      • +
      • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => "3"), :remote => true %>
      -
      - <%= render :partial => "pull_requests/pull_request_comments" %> -
      + <% if @type == nil || @type == "1" %> +
      + <%= render :partial => "pull_requests/pull_request_comments" %> +
      + <% end %>
      <%= render :partial => "pull_requests/pull_request_commits" %>
      <%= render :partial => "pull_requests/pull_request_changes" %>
      + <% end %>
      From 80b8fc4444de90c3c8a3ba64ed7f32c106324161 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 11 Aug 2016 14:44:43 +0800 Subject: [PATCH 33/55] =?UTF-8?q?=E2=80=9C=E6=88=91=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E2=80=9D=E4=B8=AD=E6=9C=89=E6=8C=82=E8=B5=B7=E7=9A=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=B6=E4=BC=9A=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3b9324d6a..5dc736c48 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1534,7 +1534,7 @@ class UsersController < ApplicationController stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)} stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")" @receive_homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc").limit(5) - if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.publish_time > @receive_homeworks.first.publish_time) + if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.created_at > @receive_homeworks.first.created_at) @manage_pre = true else @manage_pre = false From 8eaeea299ae7ca7f5ff5e784faf9f0c7c1544e19 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 11 Aug 2016 15:19:58 +0800 Subject: [PATCH 34/55] =?UTF-8?q?=E7=9B=B8=E5=90=8C=E5=88=86=E6=94=AF?= =?UTF-8?q?=E5=92=8C=E9=A1=B9=E7=9B=AE=E6=B6=88=E6=81=AFJS=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/pull_requests_helper.rb | 6 ++++++ app/views/pull_requests/_form.html.erb | 15 +++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/helpers/pull_requests_helper.rb b/app/helpers/pull_requests_helper.rb index 03c8358ab..07b022358 100644 --- a/app/helpers/pull_requests_helper.rb +++ b/app/helpers/pull_requests_helper.rb @@ -41,4 +41,10 @@ module PullRequestsHelper end end + # 判断是否允许创建Pull Request + # 如果分支相同,并且项目相同则提示 + def judge_pr_allow + + end + end diff --git a/app/views/pull_requests/_form.html.erb b/app/views/pull_requests/_form.html.erb index d5de31723..a276ea65c 100644 --- a/app/views/pull_requests/_form.html.erb +++ b/app/views/pull_requests/_form.html.erb @@ -15,9 +15,9 @@ <% if @forked_project.nil? %> <%= select_tag :branch, options_for_select(@source_rev), :id => "pull_request_branch", :name => "target_branch", :value => "target_branch",:class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %> <% else %> - + + <% end %> +
      - +
      @@ -56,7 +57,9 @@ { var source_branch = $.trim($("#source_branch").val()); var target_branch = $.trim($("#pull_request_branch").val()); - if(source_branch == target_branch) + var target_project = $.trim($("#pull_request_project").children().attr("name")); + var target_forked_project = $.trim($("#pull_request_project_hidden").text()); + if(target_project == target_forked_project && source_branch == target_branch) { $("#pull_request_branch_error").show(); return false; @@ -71,7 +74,7 @@ //提交pull request function pull_request_commit() { - if(regex_pr_name()) + if(regex_pr_name() && regex_branch()) { $("#pull_request_form").submit(); } From 322868f063c7c69d2540915fc7afe2fcbac0bed6 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 11 Aug 2016 15:58:49 +0800 Subject: [PATCH 35/55] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E7=A8=8Bid=E5=8F=98=E4=B8=BA=E7=A9=BA=E6=97=B6=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 6 ++---- app/models/course.rb | 7 +++++++ app/services/courses_service.rb | 2 -- app/services/syllabuses_service.rb | 3 --- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 0463e08e8..3c012fce7 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -61,8 +61,7 @@ class AdminController < ApplicationController if params[:syllabus_id] && params[:course_id] course = Course.where("id = #{params[:course_id].to_i}").first unless course.nil? - course.update_column('syllabus_id', params[:syllabus_id].to_i) - Rails.logger.error "update_syllabus_id: admin_controller/select_scourse_syllabus" + course.update_attribute(:syllabus_id, params[:syllabus_id].to_i) @flag = true end end @@ -83,8 +82,7 @@ class AdminController < ApplicationController syllabus.update_attributes(:title => params[:title], :eng_name => params[:eng_name], :user_id => @user.id) syllabus.description = Message.where("id = 19412").first.nil? ? nil : Message.where("id = 19412").first.content if syllabus.save - course.update_column('syllabus_id', syllabus.id) - Rails.logger.error "update_syllabus_id: admin_controller/create_syllabus" + course.update_attribute(:syllabus_id, params[:syllabus_id].to_i) @flag = params[:flag].to_i @course = course respond_to do |format| diff --git a/app/models/course.rb b/app/models/course.rb index 561a031ae..93cc6ab26 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -80,6 +80,7 @@ class Course < ActiveRecord::Base after_update :update_files_public,:update_course_ealasticsearch_index after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index before_destroy :delete_all_members,:delete_course_ealasticsearch_index + after_save :log_infor safe_attributes 'extra', 'time', @@ -504,6 +505,12 @@ class Course < ActiveRecord::Base ticket end + def log_infor + if self.syllabus_id.nil? + Rails.logger.info "##########################################################course's syllabus_id is null." + end + end + end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index e9253ff90..c6854f3dd 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -353,7 +353,6 @@ class CoursesService #@course.password = params[:course][:password] @course.tea_id = current_user.id @course.syllabus_id = params[:syllabus_id].to_i - Rails.logger.error "update_syllabus_id: courses_service/create_course" @course.term = params[:term] @course.time = params[:time] @course.end_term = params[:end_term] @@ -413,7 +412,6 @@ class CoursesService #course.safe_attributes = params[:course] #course.password = params[:course][:password] course.syllabus_id = params[:syllabus_id].to_i - Rails.logger.error "update_syllabus_id: courses_service/edit_course" course.time = params[:time] course.term = params[:term] course.end_time = params[:end_time] diff --git a/app/services/syllabuses_service.rb b/app/services/syllabuses_service.rb index 4681917fc..fcb70653b 100644 --- a/app/services/syllabuses_service.rb +++ b/app/services/syllabuses_service.rb @@ -86,14 +86,12 @@ class SyllabusesService courses.each do |course| if ::Course === course course.syllabus_id = sy.id - Rails.logger.error "update_syllabus_id: syllabus_service/create" course.save! send_wechat_create_class_notice user,course elsif Hash === course c = ::Course.new(course) c.tea_id = user.id c.syllabus_id = sy.id - Rails.logger.error "update_syllabus_id: syllabus_service/create" c.update_default_value c.is_public = 0 c.save! @@ -138,7 +136,6 @@ class SyllabusesService course.name = c course.tea_id = user.id course.syllabus_id = sy.id - Rails.logger.error "update_syllabus_id: syllabus_service/edit" course.update_default_value course.is_public = 0 course.save! From 951390092b63fad5298cc0ecae29f0d9702dfe81 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 11 Aug 2016 15:59:38 +0800 Subject: [PATCH 36/55] =?UTF-8?q?=E6=88=91=E7=9A=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c9cea575e..35bd93678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1534,7 +1534,7 @@ class UsersController < ApplicationController stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)} stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")" @receive_homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc").limit(5) - if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.publish_time > @receive_homeworks.first.publish_time) + if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.created_at > @receive_homeworks.first.created_at) @manage_pre = true else @manage_pre = false From 4a25b6357bcc029ef5373a855bd8ad418e076826 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 11 Aug 2016 16:12:48 +0800 Subject: [PATCH 37/55] =?UTF-8?q?=E6=88=91=E7=9A=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b225c3099..86babf1fb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2841,7 +2841,7 @@ module ApplicationHelper #获取当前作业的提交截止时间/互评截止时间 def cur_homework_end_time homework str = "" - if homework.anonymous_comment == 0 && homework.end_time < Date.today && homework.homework_detail_manual + if homework.anonymous_comment == 0 && homework.end_time && homework.end_time < Date.today && homework.homework_detail_manual str = "互评截止:#{format_date homework.homework_detail_manual.evaluation_end}" else str = "提交截止:#{homework.end_time ? (format_date homework.end_time) : '       --       '}" From 03c093fb138b5fab528c949080c0ab048ca25dc4 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 11 Aug 2016 16:34:00 +0800 Subject: [PATCH 38/55] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=AD=E2=80=9C=E8=B5=9E=E2=80=9D=E5=92=8C?= =?UTF-8?q?=E2=80=9C=E5=8F=96=E6=B6=88=E7=82=B9=E8=B5=9E=E2=80=9D=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_homework_detail.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index aee307963..3f73f3b9d 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -302,7 +302,7 @@ <% count=homework_common.journals_for_messages.count %>
      - <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => homework_common, :user_activity_id => -1, :is_in_course => is_in_course,:course_activity=>-1} %> + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => homework_common, :user_activity_id => homework_common.id, :is_in_course => is_in_course,:course_activity=>-1} %> <% comments = homework_common.journals_for_messages.reorder("created_on desc").limit(3) %> <% if count > 0 %> From 85cd113cf9a413a6717758b54233a4b13ae1d582 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 12 Aug 2016 10:20:58 +0800 Subject: [PATCH 39/55] =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index 93cc6ab26..659f9fcec 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -506,9 +506,7 @@ class Course < ActiveRecord::Base end def log_infor - if self.syllabus_id.nil? - Rails.logger.info "##########################################################course's syllabus_id is null." - end + Rails.logger.info "##########################################################course's syllabus_id is #{self.syllabus_id}." end end From 7efc8ccac6d444d93532a8f07b4ff9faf9231c2b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 12 Aug 2016 14:11:15 +0800 Subject: [PATCH 40/55] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index ff7a2d0fb..95d505d62 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -11,7 +11,7 @@ - +
      From 047eea125d8db96fc7110b414c0ddb6f288e0263 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 12 Aug 2016 17:05:46 +0800 Subject: [PATCH 41/55] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=8F=8A=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 23 ++++++++++++++++-- app/views/files/_course_list.html.erb | 25 ++++++++------------ app/views/files/index.js.erb | 3 ++- app/views/files/search.js.erb | 4 ++-- app/views/files/search_tag_attachment.js.erb | 5 ++-- 5 files changed, 37 insertions(+), 23 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index ed2b2ebfa..a46e6e555 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -86,7 +86,16 @@ class FilesController < ApplicationController else @result = find_course_attache q,@course,sort @result = visable_attachemnts @result - @searched_attach = paginateHelper @result,10 + + @all_attachments = @result + @limit = 10 + @feedback_count = @all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + #@curse_attachments_all = @all_attachments[@offset, @limit] + @obj_attachments = paginateHelper @all_attachments,10 + + # @searched_attach = paginateHelper @result,10 @tag_list = get_course_tag_list @course end @@ -867,7 +876,17 @@ class FilesController < ApplicationController else @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank? end - @searched_attach = paginateHelper @result,10 + + @all_attachments = @result + @limit = 10 + @feedback_count = @all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + #@curse_attachments_all = @all_attachments[@offset, @limit] + @obj_attachments = paginateHelper @all_attachments,10 + + + # @searched_attach = paginateHelper @result,10 if @project @tag_list = get_project_tag_list @project @result_search_project = @result diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 7724bb861..be7da4732 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,19 +1,14 @@ - <% curse_attachments.each do |file| %> - <% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %> +<% curse_attachments.each do |file| %> + <% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %>
      - <%=render :partial=>'files/resource_detail',:locals => {:file => file} %> + <%=render :partial=>'files/resource_detail',:locals => {:file => file} %>
      - <% else %> -
      <%= file.filename %>是私有资源
      - <% end %> - <% end %> - -<% if curse_attachments.count == 10%> - <% if params[:action] == 'search' %> - <%=link_to "点击展开更多", search_course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %> <% else %> - - <%=link_to "点击展开更多", course_files_path(:course_id => course.id, :page => @page), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %> - <%end%> -<% end%> +
      <%= file.filename %>是私有资源
      + <% end %> +<% end %> + +
        + <%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true%> +
      diff --git a/app/views/files/index.js.erb b/app/views/files/index.js.erb index 49e7ac714..134598bf7 100644 --- a/app/views/files/index.js.erb +++ b/app/views/files/index.js.erb @@ -1,5 +1,6 @@ <% if @course %> - $("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); + $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); + $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); <% elsif @project %> $("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/project_list', :locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments})%>"); <% elsif @org_subfield %> diff --git a/app/views/files/search.js.erb b/app/views/files/search.js.erb index fd88b3f9e..6cfe0f673 100644 --- a/app/views/files/search.js.erb +++ b/app/views/files/search.js.erb @@ -1,6 +1,6 @@ <% if (@obj_pages &&( @obj_pages.page > 1)) || (@feedback_pages && (@feedback_pages.page > 1)) %> //搜索的时候有时候是需要加载下一页,有时候是直接替换当前 #course_list。这个根据 page来判定 $("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach} )%>"); <% else %> - $("#course_list").html("<%= escape_javascript(render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>"); - $("#attachment_count").html("<%= @result.count%>") + $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); + $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); <% end %> \ No newline at end of file diff --git a/app/views/files/search_tag_attachment.js.erb b/app/views/files/search_tag_attachment.js.erb index 3003d8b98..8d2b29fe9 100644 --- a/app/views/files/search_tag_attachment.js.erb +++ b/app/views/files/search_tag_attachment.js.erb @@ -1,7 +1,6 @@ <% if @course %> - $("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>"); - $("#course_filter_order").html("<%= escape_javascript(render :partial => 'course_file_filter_order', :locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach, tag_name: @tag_name, q: @q})%>"); - $("#attachment_count").html("<%= @result.count%>") + $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); + $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); <% else %> $("#course_list").html("<%= escape_javascript(render :partial => 'project_list',:locals => {project:@project, all_attachments:@result_search_project, sort:@sort, order:@order, project_attachments:@searched_attach}) %>"); $("#attachment_count").html("<%= @result_search_project.count%>") From ce9c2d3d060391dfa99749ba11a4b5255ff96c21 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 12 Aug 2016 17:25:20 +0800 Subject: [PATCH 42/55] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E5=88=86=E9=A1=B5=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/search.js.erb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/files/search.js.erb b/app/views/files/search.js.erb index 6cfe0f673..011b3bb25 100644 --- a/app/views/files/search.js.erb +++ b/app/views/files/search.js.erb @@ -1,6 +1,3 @@ -<% if (@obj_pages &&( @obj_pages.page > 1)) || (@feedback_pages && (@feedback_pages.page > 1)) %> //搜索的时候有时候是需要加载下一页,有时候是直接替换当前 #course_list。这个根据 page来判定 - $("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach} )%>"); -<% else %> + $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); -<% end %> \ No newline at end of file From 083d5453d4cbebe1b1868109c1565b538eb07629 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 13 Aug 2016 10:00:31 +0800 Subject: [PATCH 43/55] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E3=80=81=E9=A1=B9=E7=9B=AE=E5=BC=B9=E6=A1=86=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E9=83=A8=E5=88=86=E4=B8=8D=E8=83=BD=E6=8B=96?= =?UTF-8?q?=E6=8B=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 632e4ab49..504fea3cb 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1552,7 +1552,10 @@ function pop_box_new(value, Width, Height){ document.onmousemove = null; } - new Drag("popupWrap"); + $(".sy_popup_con").mousedown(function(event){ + event.stopPropagation(); + new Drag("popupWrap"); + }); } // 公共提示弹框样式 From 1b19d227f94d58ff94779a25ff8d43d616342cb0 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 13 Aug 2016 10:17:38 +0800 Subject: [PATCH 44/55] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=8F=8A=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_project_list.html.erb | 83 +++++++++++++++++++++ public/stylesheets/css/project.css | 35 ++++++++- 2 files changed, 117 insertions(+), 1 deletion(-) diff --git a/app/views/users/_user_project_list.html.erb b/app/views/users/_user_project_list.html.erb index 6124b82d8..77db8bc3e 100644 --- a/app/views/users/_user_project_list.html.erb +++ b/app/views/users/_user_project_list.html.erb @@ -1,3 +1,86 @@ +
      +

      项目列表

      +
      + 人气 + 时间 + 我创建的项目 +
      +
      +
      + <% @projects.each do |project|%> +
      +
      + +

      <%= link_to "#{project.name}", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>

      + <% unless project.is_public? %> + + <% end %> + <% projectUser = User.where("id=?",project.user_id).first %> + <%=link_to "创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}".html_safe, user_path(projectUser) %> +
      +
      +
      +

      更新时间:<%= format_date(project.updated_on) %>

      +
      +

      + <%= link_to project.members.count, member_project_path(project), :class => "c_blue" %>成员  | + <%= link_to project.project_score.issue_num, project_issues_path(project), :class => "c_blue" %>问题  | + <%= link_to project.project_score.attach_num, file_project_path(project), :class => "c_blue" %>资源 +

      +
      +
      +
      +
      + <% end %> + + +
      +
      + +
      +
      +
      + 人气 + 时间 + 我参与的项目 +
      +
      +
      + <% @projects.each do |project| %> +
      +
      + +

      <%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>

      + <% unless project.is_public? %> + + <% end %> + <% projectUser = User.where("id=?",project.user_id).first %> + <%=link_to "创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}".html_safe, user_path(projectUser) %> +
      +
      +
      +

      更新时间:<%= format_date(project.updated_on) %>

      +
      +

      + <%= link_to project.members.count, member_project_path(project), :class => "c_blue" %>成员  | + <%= link_to project.project_score.issue_num, project_issues_path(project), :class => "c_blue" %>问题  | + <%= link_to project.project_score.attach_num, file_project_path(project), :class => "c_blue" %>资源 +

      +
      +
      +
      +
      + <% end %> + +
      +
      + + +

      项目列表

      diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index c594c81fa..93f278269 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -546,4 +546,37 @@ a:hover.upload_btn_grey{background:#8a8a8a;} .merge-discussion-detail {font-size:13px; line-height:1.5em; color:#484848; margin-top:10px;} .merge-discussion-automatic {background-color:#fdfdfd;} .merge-discussion-input {margin:0 -10px; padding:10px; background-color:#f8f8f8;} -.merge-discussion-input textarea {width:720px; height:80px; font-size:13px; line-height:16px; color:#484848; padding:5px;} \ No newline at end of file +.merge-discussion-input textarea {width:720px; height:80px; font-size:13px; line-height:16px; color:#484848; padding:5px;} + +/*新版项目列表新增*/ +.new_project_title{ font-size:16px; color:#333; max-width:560px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +.icons_project_list{ width:8px; height:8px; border:2px solid #fff; background:#3b94d6;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;-webkit-box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5);-moz-box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5);box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5); } +.new_projectlist_more{ text-align:center;} +.new_projectlist_more a:hover{ color:#3b94d6;} +/*新版项目引用的新版课程大纲中的公共样式*/ +.icons_tishi{ + width: 110px; + height: 110px; + margin: 135px auto 20px; +} +.sy_tab_con_p{ + font-size: 16px; + text-align: center; + margin-bottom:100px; + color:#888; +} +a.sy_btn_green{ + display:inline-block; + color: #fff; + background: #60b25e; + text-align: center; + font-size: 12px; + padding:0 15px; + height: 30px; + line-height: 30px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + -o-border-radius:3px; + border-radius:3px; +} +a:hover.sy_btn_green{ background: #51a74f;} \ No newline at end of file From 37df98300932c35b0ac323ff74857b0fcf2b08c7 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 13 Aug 2016 11:13:11 +0800 Subject: [PATCH 45/55] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 ++ app/views/users/_my_joined_projects.html.erb | 38 ++++++++++++++++++++ app/views/users/_my_projects.html.erb | 37 +++++++++++++++++++ app/views/users/user_projectlist.html.erb | 13 ++++++- 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 app/views/users/_my_joined_projects.html.erb create mode 100644 app/views/users/_my_projects.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 35bd93678..73dfabb08 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3432,6 +3432,8 @@ class UsersController < ApplicationController #@projects = @user.projects.visible.order("#{sort_name} #{sort_type}") @projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS #{sort_name} ").order("#{sort_name} #{sort_type}") + @my_joined_projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS #{sort_name} where user_id != #{@user.id}").order("#{sort_name} #{sort_type}") + @my_projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS #{sort_name} where user_id = #{@user.id}").order("#{sort_name} #{sort_type}") #根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num if @order.to_i == 2 diff --git a/app/views/users/_my_joined_projects.html.erb b/app/views/users/_my_joined_projects.html.erb new file mode 100644 index 000000000..8a940d9a7 --- /dev/null +++ b/app/views/users/_my_joined_projects.html.erb @@ -0,0 +1,38 @@ +
      +
      + 人气 + 时间 + 我参与的项目 +
      +
      +
      + <% @projects.each do |project| %> +
      +
      + +

      <%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>

      + <% unless project.is_public? %> + + <% end %> + <% projectUser = User.where("id=?",project.user_id).first %> + <%=link_to "创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}".html_safe, user_path(projectUser) %> +
      +
      +
      +

      更新时间:<%= format_date(project.updated_on) %>

      +
      +

      + <%= link_to project.members.count, member_project_path(project), :class => "c_blue" %>成员  | + <%= link_to project.project_score.issue_num, project_issues_path(project), :class => "c_blue" %>问题  | + <%= link_to project.project_score.attach_num, file_project_path(project), :class => "c_blue" %>资源 +

      +
      +
      +
      +
      + <% end %> + +
      +
      \ No newline at end of file diff --git a/app/views/users/_my_projects.html.erb b/app/views/users/_my_projects.html.erb new file mode 100644 index 000000000..365830611 --- /dev/null +++ b/app/views/users/_my_projects.html.erb @@ -0,0 +1,37 @@ +
      + 人气 + 时间 + 我创建的项目 +
      +
      +
      + <% @projects.each do |project|%> +
      +
      + +

      <%= link_to "#{project.name}", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>

      + <% unless project.is_public? %> + + <% end %> + <% projectUser = User.where("id=?",project.user_id).first %> + <%=link_to "创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}".html_safe, user_path(projectUser) %> +
      +
      +
      +

      更新时间:<%= format_date(project.updated_on) %>

      +
      +

      + <%= link_to project.members.count, member_project_path(project), :class => "c_blue" %>成员  | + <%= link_to project.project_score.issue_num, project_issues_path(project), :class => "c_blue" %>问题  | + <%= link_to project.project_score.attach_num, file_project_path(project), :class => "c_blue" %>资源 +

      +
      +
      +
      +
      + <% end %> + + +
      \ No newline at end of file diff --git a/app/views/users/user_projectlist.html.erb b/app/views/users/user_projectlist.html.erb index fb1b5b501..92f9a9d66 100644 --- a/app/views/users/user_projectlist.html.erb +++ b/app/views/users/user_projectlist.html.erb @@ -1 +1,12 @@ -<%= render :partial => 'users/user_project_list'%> +
      +

      项目列表

      +
      + <%= render :partial => 'users/my_projects'%> +
      + +
      +
      + <%= render :partial => 'users/my_joined_projects'%> +
      +
      + From 00f032816cb2cfa3e56a5b4ee558d350cdc3bd07 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 13 Aug 2016 13:48:23 +0800 Subject: [PATCH 46/55] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/repositories_helper.rb | 5 +++-- app/views/repositories/_dir_list_content.html.erb | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index ef637d3ee..576bd4efd 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -47,9 +47,10 @@ module RepositoriesHelper end # 获取文件目录的最新动态 - def get_trees_last_changes(project_id, rev, ent_name, g) + def get_trees_last_changes(gpid, rev, ent_name, g) begin - tree_changes = g.rep_last_changes(project_id, :rev => rev, :path => ent_name) + tree_changes = g.rep_last_changes(gpid, :rev => rev, :path => ent_name) + commits = g.commit(gpid, tree_changes.commit_id) rescue Exception => e puts e end diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb index 068ae0a1b..dd3f8bfa0 100644 --- a/app/views/repositories/_dir_list_content.html.erb +++ b/app/views/repositories/_dir_list_content.html.erb @@ -26,19 +26,19 @@
      -