From e2ee75d8c1ee3a5e8d92d5d3fd0190304c0c54c4 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 13 Oct 2016 10:52:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=AE=BD=E7=89=88?= =?UTF-8?q?=E6=9E=B6=E6=9E=84=E4=BC=98=E5=8C=96=EF=BC=88=E4=B8=BB=E8=A6=81?= =?UTF-8?q?=E6=98=AFmodel=E5=8F=8A=E4=B8=8E=E8=AF=BE=E7=A8=8B=E7=AD=89?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=E5=88=86=E7=A6=BB=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_project_top.html.erb | 13 +- app/views/layouts/base_projects.html.erb | 25 ++-- app/views/projects/_act_attachments.html.erb | 46 +++++++ app/views/projects/_act_issues.html.erb | 108 +++++++++++++++ app/views/projects/_act_messages.html.erb | 129 ++++++++++++++++++ .../projects/_project_activities.html.erb | 30 +--- public/stylesheets/css/project.css | 4 +- 7 files changed, 307 insertions(+), 48 deletions(-) create mode 100644 app/views/projects/_act_attachments.html.erb create mode 100644 app/views/projects/_act_issues.html.erb create mode 100644 app/views/projects/_act_messages.html.erb diff --git a/app/views/layouts/_base_project_top.html.erb b/app/views/layouts/_base_project_top.html.erb index 2400219f9..5029c8245 100644 --- a/app/views/layouts/_base_project_top.html.erb +++ b/app/views/layouts/_base_project_top.html.erb @@ -74,8 +74,19 @@ <%= link_to l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname" %> 25 + + <% unless @project.enabled_modules.where("name = 'calendar'").empty? %> +
  • + <%= link_to l(:project_module_calendar),project_calendar_path(@project) %> +
  • + <% end %> + + <% unless @project.enabled_modules.where("name = 'gantt'").empty? %> +
  • + <%= link_to l(:project_module_gantt) ,project_gantt_path(@project) %> +
  • + <% end %> -
  • 更多
  • <% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %>
  • <%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "pro_new_proname" %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 1395f975f..7bdecd750 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -1,6 +1,3 @@ -<% @nav_dispaly_project_label = 1 - @nav_dispaly_forum_label = 1 %> -<%#@nav_dispaly_project_label = 1 %> @@ -13,35 +10,27 @@ <%= javascript_heads %> <%= heads_for_theme %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository','css/gantt', 'css/calendar' %> - <%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> - + - + - +
    +
    <%= render :partial => 'layouts/base_project_top' %> @@ -54,7 +43,7 @@
    -
    +
    <%= render :partial => 'layouts/footer' %> @@ -73,5 +62,7 @@ <%= call_hook :view_layouts_base_body_bottom %> + +<%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %> diff --git a/app/views/projects/_act_attachments.html.erb b/app/views/projects/_act_attachments.html.erb new file mode 100644 index 000000000..3a5a29a6e --- /dev/null +++ b/app/views/projects/_act_attachments.html.erb @@ -0,0 +1,46 @@ +
    +
    +
    + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> +
    +
    +
    + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> + TO + <%= link_to activity.project.name.to_s+" | 项目资源", project_files_path(activity.course), :class => "newsBlue ml15" %> +
    +
    + <%= link_to activity.filename, project_files_path(activity.course), :class => "postGrey" %> +
    +
    +
    + 文件大小: + <%= number_to_human_size activity.filesize%> +
    +
    上传时间:<%= format_time(activity.created_on) %>
    +
    + +
    +
    +
    +
    + diff --git a/app/views/projects/_act_issues.html.erb b/app/views/projects/_act_issues.html.erb new file mode 100644 index 000000000..db90c2f55 --- /dev/null +++ b/app/views/projects/_act_issues.html.erb @@ -0,0 +1,108 @@ +<% unless activity.author.nil? %> +
    +
    +
    + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> +
    +
    +
    + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%> +
    + <% if User.current.logged? %> +
    +
      +
    • +
        +
      • + <%= link_to l(:button_edit), issue_path(activity.id, :edit => 'true'), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %> +
      • +
      • + <% if !defined?(project_id) && !defined?(user_id) %> + <%= link_to l(:button_delete), issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% elsif defined?(project_id) %> + <%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "project_page", :page_id => project_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% elsif defined?(user_id) %> + <%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "user_page", :page_id => user_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% end %> +
      • +
      • + <%= link_to l(:button_copy), project_copy_issue_path(activity.project, activity), :class => 'postOptionLink' if User.current.allowed_to?(:add_issues, activity.project) %> +
      • +
      +
    • +
    +
    + <% end %> +
    + <% case activity.tracker_id %> + <% when 1%> + 【缺陷】 + <% when 2%> + 【功能】 + <% when 3%> + 【支持】 + <% when 4%> + 【任务】 + <% when 5%> + 【周报】 + <% end %> + <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey ml5", :target => "_blank" %> + + <%= get_issue_priority(activity.priority_id)[1] %> + +
    +
    +
    指派给   + <% unless activity.assigned_to_id.nil? %> + <% if activity.try(:assigned_to).try(:realname) == ' ' %> + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% end %> + <% end %> +
    +
    + 发布时间: + <%=format_time(activity.created_on) %> +
    +
    + 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %> +
    +
    +
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id => user_activity_id, :content => activity.description} %> + + +
    + <%# 局部刷新:修改xissue属性 %> + <% if User.current.member_of?(activity.project) && !activity.nil? && !activity.status.nil? %> + <% unless params[:action] == "index" %> +
    + <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> +
    + <% end %> + <% end %> +
    +
    + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %> +
    +
    +
    +
    +
    + <%= render :partial => 'users/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %> +
    +
    + +<% end %> + diff --git a/app/views/projects/_act_messages.html.erb b/app/views/projects/_act_messages.html.erb new file mode 100644 index 000000000..783e740f1 --- /dev/null +++ b/app/views/projects/_act_messages.html.erb @@ -0,0 +1,129 @@ +
    +
    +
    + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> +
    +
    +
    + <%= link_to activity.author.show_name, user_path(activity.author_id), :class => "newsBlue mr15" %> + TO + <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%> + +
    +
    + <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey fl" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey fl" %> + <% end %> + <% if activity.sticky == 1%> + 置顶 + <% end%> + <% if activity.locked %> +        + <% end%> +
    +
    +
    + 发帖时间:<%= format_time(activity.created_on) %> +
    +
    + 更新时间:<%= get_forge_act_message(activity, activity.class.to_s) %> +
    +
    + <% if activity.parent_id.nil? %> + <% content = activity.content%> + <% else %> + <% content = activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %> +
    + + +
    +
    + <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %> +
    + <% if User.current.logged? %> +
    +
      +
    • +
        + <% if activity.author.id == User.current.id%> +
      • + <%= link_to( + l(:button_edit), + edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board), + :class => 'postOptionLink' + ) if activity.editable_by?(User.current) %> +
      • +
      • + <%= link_to( + l(:button_delete), + delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board), + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if activity.destroyable_by?(User.current) %> +
      • + <% end %> + <% if hidden_unproject_infos %> +
      • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
      • + <% else %> +
      • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
      • + <% end %> +
      +
    • +
    +
    + <% end %> +
    +
    +
    + <% all_comments = []%> + <% all_replies = get_all_children(all_comments, activity) %> + <% count = all_replies.count %> + <%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %> + <%# count = fetch_user_leaveWord_reply(activity).count %> +
    + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %> + + <% comments = all_replies[0..2] %> + <% if count > 0 %> +
    + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => is_course, :is_board =>is_board}%> +
    + <% end %> + + <% if !activity.locked? %> +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    + <% if User.current.logged? %> +
    + <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id,:is_course => is_course, :is_board => 'true'},:method => "post", :remote => true) do |f|%> + + +
    + + +
    +

    + <% end%> +
    + <% else %> + <%= render :partial => "users/show_unlogged" %> + <% end %> +
    +
    +
    +
    + <% end %> +
    +
    + diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index 3660b5986..c555758a3 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -9,27 +9,6 @@ $("#relateProject,.relatePInfo").mouseout(function(){ $(".relatePInfo").css("display","none"); }); -// $(".homepagePostPortrait").mouseover(function(){ -// onImage = true; -// $(this).children(".userCard").css("display","block"); -// }); -// $(".homepagePostPortrait").mouseout(function(){ -// var cur = $(this); -// onImage = false; -// setTimeout(function(){ -// if (onUserCard == false && onImage == false) { -// $(cur).children(".userCard").css("display", "none"); -// } -// }, 500); -// }); -// $(".userCard").mouseover(function(){ -// onUserCard = true; -// $(this).css("display","block"); -// }); -// $(".userCard").mouseout(function(){ -// onUserCard = false; -// $(this).css("display","none"); -// }); $(".coursesLineGrey").mouseover(function(){ $(this).css("color","#ffffff"); }); @@ -60,15 +39,10 @@ <%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %> <% when "Issue" %> - <%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %> + <%= render :partial => 'projects/act_issues', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %> <% when "Message" %> - <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %> - - <% when "News" %> - <% if !activity.forge_act.nil? and activity.forge_act.project %> - <%= render :partial => 'projects/project_news', :locals => {:activity=>activity.forge_act, :user_activity_id=>activity.id} %> - <% end %> + <%= render :partial => 'projects/act_messages', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %> <% when "Attachment" %> <%= render :partial => 'users/project_attachment', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %> diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index eace25316..6c9f04294 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -859,7 +859,7 @@ a.pro_new_topbtn{ padding: 3px 7px; font-size: 12px; line-height: 20px; color: a.pro_new_topbtn_left { padding: 3px 10px; font-size: 12px;line-height: 20px; background-image: linear-gradient(#fcfcfc, #eee); border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #333; } a:hover.pro_new_topbtn_left{background-image: linear-gradient(#ededed, #dddddd);} .pro_new_topnav ul{border-bottom: 3px solid #ddd; height: 30px; line-height: 30px;} -.pro_new_topnav ul li{ float: left; width: 110px; height: 30px; line-height: 30px;text-align: center; } +.pro_new_topnav ul li{ float: left;padding:0 15px; height: 30px; line-height: 30px;text-align: center; } .pro_new_topnav ul li:hover{border-bottom: 3px solid #3b94d6;} .pro_new_topnav_active{border-bottom: 3px solid #3b94d6; } /* 翻页 新版缺陷列表*/ @@ -911,4 +911,4 @@ a:hover.btn_newpro_grey,a:active.btn_newpro_grey{ background: #eaeaea;} .pro_newsetting_con p,.pro_newsetting_con { line-height: 30px;} .w650{ width: 650px;} .pro_new_prompt{ border:1px solid #f6d0b1; padding:10px; background: #fff9e9; color: #ee4a20; text-align: center;} -p.pro_new_grey{ line-height: 1.9; } +p.pro_new_grey{ line-height: 1.9; } From dcbeea6dfff4f78547b56f892faec4d4800b3025 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 14 Oct 2016 09:01:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E6=9D=83=E9=99=90=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 22 +++++++++----------- app/views/layouts/_base_project_top.html.erb | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6474a0eae..bcc95d721 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -878,20 +878,18 @@ module ApplicationHelper Project.project_tree(projects, &block) end - # 项目版本库可见权限判断 - # 条件:1、modules中设置不可见或项目没有版本库;2、如果项目是私有或者项目版本库隐藏则必须是项目成员才可见 + # 项目版本库可见权限判断: + # modules中设置可见 + # 版本库存在 + # 版本库设置了隐藏则仅仅项目成员可见(hidden_repo:1 隐藏版本库) + # return -> true 可见 def visible_repository?(project) - @result = false - unless project.enabled_modules.where("name = 'repository'").empty? || project.repositories.count == 0 - if (project.hidden_repo || !project.is_public?) - if User.current.member_of?(project) - @result = true - end - else - @result = true - end + repository = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first + if project.enabled_modules.where("name = 'repository'").empty? || repository.nil? + result = false + else + result = (project.hidden_repo == 1 && !User.current.member_of?(project)) ? false : true end - return @result end def show_attachment_tip container_id, container_type diff --git a/app/views/layouts/_base_project_top.html.erb b/app/views/layouts/_base_project_top.html.erb index 5029c8245..a5e1e2a45 100644 --- a/app/views/layouts/_base_project_top.html.erb +++ b/app/views/layouts/_base_project_top.html.erb @@ -56,7 +56,7 @@ <% end %> <% if visible_repository?(@project) %> -
  • <%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "pro_new_proname" %> +
  • <%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname" %> <% unless @project.project_score.changeset_num == 0 %> <%= @project.project_score.changeset_num %> <% end %> From 0760836f29620cf35968596329d554cff4832ec0 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 14 Oct 2016 17:23:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=A1=B9=E7=9B=AEbase=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 6 ++- app/helpers/application_helper.rb | 7 ++- app/views/layouts/_base_project_top.html.erb | 27 +++++----- app/views/layouts/base_projects.html.erb | 6 +-- app/views/pull_requests/index.html.erb | 49 ++++++++++--------- ...6_add_pull_request_num_to_project_score.rb | 5 ++ db/schema.rb | 14 +++++- 7 files changed, 70 insertions(+), 44 deletions(-) create mode 100644 db/migrate/20161014085016_add_pull_request_num_to_project_score.rb diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index e1c7c6d19..1056b8b54 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -11,13 +11,17 @@ class PullRequestsController < ApplicationController # 返回json格式 def index - # 顶部导航 + # project_menu_type 为了控制base顶部导航 @project_menu_type = 6 + # 不符合pullrequest条件的给出提示 + @allow_to_pull_request = allow_pull_request(@project) > 0 && allow_show_pull_request(@project) > 0 type = params[:type] case type when nil, "1" @requests = @g.merge_requests(@project.gpid).select{|request| request.state == "opened" || request.state == "reopened"} + # 更新统计数字 + project_score = @project.project_score.update_column(:pull_request_num, @requests.count) when "2" @requests = @g.merge_requests(@project.gpid).select{|request| request.state == "merged"} when "3" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bcc95d721..5f471d950 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -888,7 +888,7 @@ module ApplicationHelper if project.enabled_modules.where("name = 'repository'").empty? || repository.nil? result = false else - result = (project.hidden_repo == 1 && !User.current.member_of?(project)) ? false : true + result = (project.hidden_repo && !User.current.member_of?(project)) ? false : true end end @@ -986,6 +986,11 @@ module ApplicationHelper s.html_safe end + # 判断模块是否可见 + def project_modules_allow project + @project.enabled_modules.where("name = 'issue_tracking'").empty? + end + # 计算Pull Request的请求数目 def pull_request_count project g = Gitlab.client diff --git a/app/views/layouts/_base_project_top.html.erb b/app/views/layouts/_base_project_top.html.erb index a5e1e2a45..b2ca55d88 100644 --- a/app/views/layouts/_base_project_top.html.erb +++ b/app/views/layouts/_base_project_top.html.erb @@ -2,6 +2,8 @@ <% project_issue_count = @project.issues.count %> <% project_acts = ForgeActivity.where("project_id = ?", @project.id).count %> <% raodmaps = Version.where("project_id = ?", @project.id).count %> +<% project_score = @project.project_score %> +<% project_modules = @project.enabled_modules.where("name = 'issue_tracking'") %> <%# 更新访问数,刷新的时候更新访问次数 %> <% update_visiti_count @project %> @@ -11,13 +13,12 @@ <%=link_to "#{@project.owner.try(:show_name)}/".html_safe, user_path(@project.owner), :class => "pro_new_username" %> <%=link_to @project.name, project_path(@project), :class => "pro_new_proname" %> -
    -
      - - <%= render :partial => "projects/applied_status" %> -
    + +
    +
      <%= render :partial => "projects/applied_status" %>
    +
      @@ -40,8 +41,8 @@ <% unless @project.enabled_modules.where("name = 'boards'").empty? %>
    • <%= link_to l(:project_module_boards), project_boards_path(@project), :class => "pro_new_proname" %> - <% unless @project.project_score.board_num == 0 %> - <%= @project.project_score.board_num %> + <% unless project_score.board_num == 0 %> + <%= project_score.board_num %> <% end %>
    • <% end %> @@ -58,17 +59,15 @@ <% if visible_repository?(@project) %>
    • <%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname" %> <% unless @project.project_score.changeset_num == 0 %> - <%= @project.project_score.changeset_num %> + <%= project_score.changeset_num %> <% end %>
    • <% end %> - <% if allow_pull_request(@project) > 0 && allow_show_pull_request(@project) > 0 %> -
    • - <%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname" %> - <%= pull_request_count(@project) %> -
    • - <% end %> +
    • + <%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname" %> + <%= project_score.pull_request_num %> +
    • <%= link_to l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname" %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 7bdecd750..c37c589f1 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -9,8 +9,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository','css/gantt', 'css/calendar' %> - + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar' %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> @@ -48,11 +47,9 @@
      <%= render :partial => 'layouts/footer' %>
      - <% if hidden_unproject_infos %> <%= render :partial => 'layouts/new_feedback' %> <% end %> - @@ -62,7 +59,6 @@
    <%= call_hook :view_layouts_base_body_bottom %> - <%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %> diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb index 1001557ae..aefbfefcf 100644 --- a/app/views/pull_requests/index.html.erb +++ b/app/views/pull_requests/index.html.erb @@ -1,26 +1,31 @@ -<%#= render :partial => "pull_requests/pull_request_container" %> -
      -
    • <%= 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 %>
    • - <% if allow_pull_request(@project) && User.current.member_of?(@project) %> - <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %> - <% end %> -
      -
    -
    +<% if @allow_to_pull_request %> + <%#= render :partial => "pull_requests/pull_request_container" %> +
      +
    • <%= 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 %>
    • + <% if allow_pull_request(@project) && User.current.member_of?(@project) %> + <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %> + <% end %> +
      +
    +
    -
      - <%= render "pull_requests/pull_requests_list" %> -
    +
      + <%= render "pull_requests/pull_requests_list" %> +
    - +<% else %> +

    不符合条件,内容待补充

    +<% end %> - $(".project-merge-banner li").click(function(){ - $(".project-merge-banner li").removeClass("active"); - $(this).addClass("active"); - }); - \ No newline at end of file diff --git a/db/migrate/20161014085016_add_pull_request_num_to_project_score.rb b/db/migrate/20161014085016_add_pull_request_num_to_project_score.rb new file mode 100644 index 000000000..4308d0d2a --- /dev/null +++ b/db/migrate/20161014085016_add_pull_request_num_to_project_score.rb @@ -0,0 +1,5 @@ +class AddPullRequestNumToProjectScore < ActiveRecord::Migration + def change + add_column :project_scores, :pull_request_num, :integer, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 131f50c29..fbb4711e0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20161009053958) do +ActiveRecord::Schema.define(:version => 20161014085016) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -285,8 +285,11 @@ ActiveRecord::Schema.define(:version => 20161009053958) do t.integer "reply_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "root_id" end + add_index "blog_comments", ["root_id"], :name => "index_blog_comments_on_root_id" + create_table "blogs", :force => true do |t| t.string "name", :default => "", :null => false t.text "description" @@ -1223,8 +1226,11 @@ ActiveRecord::Schema.define(:version => 20161009053958) do t.integer "m_reply_id" t.integer "is_comprehensive_evaluation" t.integer "private", :default => 0 + t.integer "root_id" end + add_index "journals_for_messages", ["root_id"], :name => "index_journals_for_messages_on_root_id" + create_table "keys", :force => true do |t| t.integer "user_id" t.datetime "created_at" @@ -1391,6 +1397,7 @@ ActiveRecord::Schema.define(:version => 20161009053958) do t.integer "reply_id" t.integer "quotes" t.integer "status", :default => 0 + t.integer "root_id" end add_index "messages", ["author_id"], :name => "index_messages_on_author_id" @@ -1398,6 +1405,7 @@ ActiveRecord::Schema.define(:version => 20161009053958) do add_index "messages", ["created_on"], :name => "index_messages_on_created_on" add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" + add_index "messages", ["root_id"], :name => "index_messages_on_root_id" create_table "milestones", :force => true do |t| t.string "title", :null => false @@ -1625,8 +1633,11 @@ ActiveRecord::Schema.define(:version => 20161009053958) do t.integer "sticky", :default => 0 t.integer "org_subfield_id" t.integer "status", :default => 0 + t.integer "root_id" end + add_index "org_document_comments", ["root_id"], :name => "index_org_document_comments_on_root_id" + create_table "org_member_roles", :force => true do |t| t.integer "org_member_id" t.integer "role_id" @@ -1816,6 +1827,7 @@ ActiveRecord::Schema.define(:version => 20161009053958) do t.integer "board_num", :default => 0 t.integer "attach_num", :default => 0 t.datetime "commit_time" + t.integer "pull_request_num", :default => 0 end create_table "project_statuses", :force => true do |t|