From 95eab901a9a0592c4d62cce09f3ec6c06b1877a1 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 26 Oct 2016 14:54:55 +0800 Subject: [PATCH 1/2] modified analysis quality show --- app/views/quality_analysis/_show.html.erb | 325 +++++++++++----------- public/stylesheets/css/project.css | 4 +- 2 files changed, 162 insertions(+), 167 deletions(-) diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index e127b635e..7dfbea0e3 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -1,167 +1,162 @@ <%= javascript_include_tag 'highcharts','highcharts-more' %> -
-

质量分析

+
+
+

质量分析

+
+ +
当前分支:<%= params[:branch] %>
+
+
项目代码质量分析报告
+
概要信息
+ <%= render :partial => "hightchars" %> +
+
+
+

+

质量等级

+

<%= sqale_rating_status(@ha["sqale_rating"].to_i)[2] %> + borderRadius"> + <%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %> + +

+
+
+

+

复杂度

+

<%= @ha["function_complexity"].to_i == 0 ? 0 : @ha["function_complexity"] %> + borderRadius"> + <%= @ha["function_complexity"].nil? ? "良好" : complexity_status(@ha["function_complexity"].to_i)[0] %> + +

+
+
+

+

代码重复度

+

<%= @ha["duplicated_lines_density"].to_i == 0 ? 0 : @ha["duplicated_lines_density"] %> + borderRadius"> + <%= @ha["duplicated_lines_density"].nil? ? "良好" : duplicated_lines_density_status(@ha["duplicated_lines_density"].to_i)[0] %> + +

+
+
+

+

注释率

+

<%= @ha["comment_lines_density"].to_i == 0 ? 0 : @ha["comment_lines_density"] %> + borderRadius"> + <%= @ha["comment_lines_density"].nil? ? "较低" : comment_lines_density_status(@ha["comment_lines_density"].to_i)[0] %> + +

+
+
+
+ + +
+ + 质量等级 + <%= @ha["sqale_rating"].nil? ? 0 : score_sqale_rating(@ha["sqale_rating"].to_i) %>/5分 + 可定性评价为:质量<%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %>
+
+
技术债务 + + <% if @ha["sqale_index"].to_i == 0 %> + 0天 + <% else %> + <%= /[0-9]*/.match(@ha["sqale_index"])[0] %>天 + <%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? "" : (/ [0-9]*/.match(@ha["sqale_index"]).to_s + "小时") %> + <% end %> + + 查看详情
+
 质量问题 + + + <%= @ha["violations"].to_i %> + +  问题分类如下:
+ +
+
+ + 代码规模可定性评价为:<%= @ha["lines"].nil? ? 0 : lines_scale(@ha["lines"].to_i) %>
+
+
+

代码行数

+

<%= @ha["lines"].to_i %>

+
+
+

文件

+

<%= @ha["files"].to_i %>

+
+
+

目录

+

<%= @ha["directories"].to_i %>

+
+
+

+

<%= @ha["classes"].to_i %>

+
+
+

方法

+

<%= @ha["functions"].to_i %>

+
+
+ <% if !@user_quality_infos.blank? %> +
贡献统计
+
+
    +
  •  
  • +
  • 代码行数
  • +
  • 引入质量问题总数
  • +
  • 未解决质量问题数
  • +
  • 引入质量问题数/代码行数
  • +
    +
+ + <% @user_quality_infos.each do |author_info| %> + <% user = get_user_by_mail(author_info[:email]) %> + <%# unless author_info[:changes] == 0 %> +
    +
  • +
    + <%=link_to image_tag(url_to_avatar(user), :width => "50", :height => "50", :class => "image-cir"), user_path(user), :target => '_blank' %> + +
    +
  • +
  • <%= author_info[:changes] %>
  • +
  • <%= author_info[:all_issue_count] %>
  • +
  • <%= author_info[:unresolved_issue_count] %>
  • +
  • <%= author_info[:ratio] %>
  • +
    +
+ <%# end %> + <% end %> + +
+ <% end %>
- -
当前分支:<%= params[:branch] %>
-
-
项目代码质量分析报告
-
概要信息
-<%= render :partial => "hightchars" %> -
-
-
-

-

质量等级

-

<%= sqale_rating_status(@ha["sqale_rating"].to_i)[2] %> - borderRadius"> - <%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %> - -

-
-
-

-

复杂度

-

<%= @ha["function_complexity"].to_i == 0 ? 0 : @ha["function_complexity"] %> - borderRadius"> - <%= @ha["function_complexity"].nil? ? "良好" : complexity_status(@ha["function_complexity"].to_i)[0] %> - -

-
-
-
-
-

-

代码重复度

-

<%= @ha["duplicated_lines_density"].to_i == 0 ? 0 : @ha["duplicated_lines_density"] %> - borderRadius"> - <%= @ha["duplicated_lines_density"].nil? ? "良好" : duplicated_lines_density_status(@ha["duplicated_lines_density"].to_i)[0] %> - -

-
-
-

-

注释率

-

<%= @ha["comment_lines_density"].to_i == 0 ? 0 : @ha["comment_lines_density"] %> - borderRadius"> - <%= @ha["comment_lines_density"].nil? ? "较低" : comment_lines_density_status(@ha["comment_lines_density"].to_i)[0] %> - -

-
-
-
- - -
- - 质量等级 - <%= @ha["sqale_rating"].nil? ? 0 : score_sqale_rating(@ha["sqale_rating"].to_i) %>/5分 - 可定性评价为:质量<%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %>
-
-
技术债务 - - <% if @ha["sqale_index"].to_i == 0 %> - 0天 - <% else %> - <%= /[0-9]*/.match(@ha["sqale_index"])[0] %>天 - <%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? "" : (/ [0-9]*/.match(@ha["sqale_index"]).to_s + "小时") %> - <% end %> - - 查看详情
-
 质量问题 - - - <%= @ha["violations"].to_i %> - -  问题分类如下:
- -
-
- - 代码规模可定性评价为:<%= @ha["lines"].nil? ? 0 : lines_scale(@ha["lines"].to_i) %>
-
-
-

代码行数

-

<%= @ha["lines"].to_i %>

-
-
-

文件

-

<%= @ha["files"].to_i %>

-
-
-

目录

-

<%= @ha["directories"].to_i %>

-
-
-

-

<%= @ha["classes"].to_i %>

-
-
-

方法

-

<%= @ha["functions"].to_i %>

-
-
-<% if !@user_quality_infos.blank? %> -
贡献统计
-
-
    -
  •  
  • -
  • 代码行数
  • -
  • 引入质量问题总数
  • -
  • 未解决质量问题数
  • -
  • 引入质量问题数/代码行数
  • -
    -
- - <% @user_quality_infos.each do |author_info| %> - <% user = get_user_by_mail(author_info[:email]) %> - <%# unless author_info[:changes] == 0 %> -
    -
  • -
    - <%=link_to image_tag(url_to_avatar(user), :width => "50", :height => "50", :class => "image-cir"), user_path(user), :target => '_blank' %> - -
    -
  • -
  • <%= author_info[:changes] %>
  • -
  • <%= author_info[:all_issue_count] %>
  • -
  • <%= author_info[:unresolved_issue_count] %>
  • -
  • <%= author_info[:ratio] %>
  • -
    -
- <%# end %> - <% end %> - -
-<% end %> - - - diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index 38789d4c1..347082f0f 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -497,8 +497,8 @@ a:hover.upload_btn_grey{background:#8a8a8a;} .image-cir {border-radius:50%;} .analysis-genral-icon {position:absolute; padding:1px 5px; display:inline-block; top:5px;} .contribute-list-avatar {width:80px; vertical-align:middle; text-align:center;} -.contribute-list-code {width:130px; vertical-align:middle; text-align:center;} -.contribute-list-problem {width:130px; vertical-align:middle; text-align:center;} +.contribute-list-code {width:200px; vertical-align:middle; text-align:center;} +.contribute-list-problem {width:200px; vertical-align:middle; text-align:center;} .contribute-list-rate {width:168px; vertical-align:middle; text-align:center;} .contribute-list-height {height:80px;} .contribute-list-line-height {line-height:80px;} From 3229277737c15a510be79e58c0c26fe648437d48 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 26 Oct 2016 15:18:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=87=8C=E7=A8=8B=E7=A2=91=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/versions_controller.rb | 7 ++++++- app/views/projects/settings/_new_versions.html.erb | 9 ++++++--- app/views/versions/_edit.html.erb | 5 +++-- app/views/versions/_list.html.erb | 3 ++- app/views/versions/_overview.html.erb | 3 ++- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index 89061a2a2..23b5b3c69 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -182,6 +182,7 @@ class VersionsController < ApplicationController end def edit + @@is_index = params[:is_index] end def update @@ -219,7 +220,11 @@ class VersionsController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to settings_project_path(@project, :tab => 'versions') } - format.js + format.js{ + if @@is_index + redirect_to project_versions_path(@project) + end + } format.api { render_api_ok } end else diff --git a/app/views/projects/settings/_new_versions.html.erb b/app/views/projects/settings/_new_versions.html.erb index 94ae93614..dc69887ba 100644 --- a/app/views/projects/settings/_new_versions.html.erb +++ b/app/views/projects/settings/_new_versions.html.erb @@ -13,11 +13,11 @@
  • - <%= f.text_field :description, :maxlength => 60, :class=>"w650 fl", :style=>"height:28px;"%> + <%= f.text_field :description, :maxlength => 60, :class=>"w650 fl", :style=>"height:28px;", :id => "setting_version_description" %>
  • - <%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>"issues_calendar_input fl", :placeholder=>"结束日期", :style=>"height:28px;" %> + <%= f.text_field :effective_date, :size => 10, :readonly => true, :class=>"issues_calendar_input fl", :placeholder=>"结束日期", :style=>"height:28px;", :id => "setting_version_effective_date" %> <%= calendar_for('version_effective_date') %>
  • @@ -54,7 +54,7 @@ <%= l("version_status_#{version.status}") %> <% if version.project == @project && User.current.allowed_to?(:manage_versions, @project) %> - <%= link_to l(:button_edit), edit_version_path(version, :is_setting => true), :class => 'sy_btn_blue mr5', :remote => true %> + <%= link_to l(:button_edit), edit_version_path(version, :is_setting => true), :class => 'sy_btn_blue mr5', :remote => true %> <%= delete_link_version version_path(version, :is_setting => true), :class=>"sy_btn_grey mr5", :remote => true %> <% end %> @@ -93,6 +93,9 @@ function pro_st_show_ban1() { $("#pro_st_edit_ban1").toggle(); + $("#setting_version_name").val(""); + $("#setting_version_description").val(""); + $("#setting_version_effective_date").val(""); } function pro_st_show_ban() { diff --git a/app/views/versions/_edit.html.erb b/app/views/versions/_edit.html.erb index e05516f66..26f03074d 100644 --- a/app/views/versions/_edit.html.erb +++ b/app/views/versions/_edit.html.erb @@ -7,8 +7,9 @@
    - <%#= form_tag( url_for(:controller => 'versions', :action => 'update', :is_setting => true), :remote => true, :id => 'project_applied_form') do %> - <%= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => true, :is_setting => true, } do |f| %> + <%#= form_tag( url_for(:controller => 'versions', :action => 'update', :is_setting => true, :is_index => @is_index), :remote => true, :id => 'project_applied_form') do %> + + <%= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => true, :is_setting => true, :is_index => params[:is_index] } do |f| %>
    • diff --git a/app/views/versions/_list.html.erb b/app/views/versions/_list.html.erb index 7f1edcf21..43bceb1c9 100644 --- a/app/views/versions/_list.html.erb +++ b/app/views/versions/_list.html.erb @@ -7,7 +7,8 @@ :action => 'index', :project_id => version.project)), :class=>'roadmap_icons_del fr mt5 mr5' if User.current.allowed_to?(:manage_versions, version.project) %> - + + <%= link_to "", edit_version_path(version, :is_index => true), :class => 'roadmap_icons_edit fr mt5', :remote => true %>
    • 完成 <%= version.closed_percent.round %>%
    • diff --git a/app/views/versions/_overview.html.erb b/app/views/versions/_overview.html.erb index d62a70f99..8190750e9 100644 --- a/app/views/versions/_overview.html.erb +++ b/app/views/versions/_overview.html.erb @@ -20,7 +20,8 @@ <%= delete_version_link version_path(@version, :back_url => url_for(:controller => 'versions', :action => 'index', :project_id => @version.project)),:class=>'roadmap_icons_del fr mt5 mr5' if User.current.allowed_to?(:manage_versions, @version.project) %> -<%= link_to("", edit_version_path(@version), :class => 'roadmap_icons_edit fr mt5 ') if User.current.allowed_to?(:manage_versions, @version.project) %> +<%#= link_to("", edit_version_path(@version), :class => 'roadmap_icons_edit fr mt5 ') if User.current.allowed_to?(:manage_versions, @version.project) %> +<%= link_to( "", edit_version_path(@version), :class => 'roadmap_icons_edit fr mt5', :remote => true) if User.current.allowed_to?(:manage_versions, @version.project) %> <%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %> <% else %>
      <%= l(:label_roadmap_no_issues) %>