This commit is contained in:
Your Name 2016-06-29 09:59:21 +08:00
parent e887ac5c7c
commit c8178fc023
4 changed files with 20 additions and 7 deletions

View File

@ -26,7 +26,7 @@ class QualityAnalysisController < ApplicationController
unless @client.job.exists?(job_name)
@g = Gitlab.client
branch = params[:branch]
language = params[:language]
language = swith_language_type(params[:language])
path = params[:path].blank? ? "./" : params[:path]
qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
version = qa.nil? ? 1 : qa.sonar_version + 1
@ -72,6 +72,19 @@ class QualityAnalysisController < ApplicationController
# end
end
# get language type
def swith_language_type language
if language = "c#"
"cs"
elsif language = "python"
"py"
elsif language = "c"
"c++"
else
language
end
end
# resource_id: login + @repository.id
def index
begin

View File

@ -1 +1 @@
<% %>
alert("dengdai")

View File

@ -1,6 +1,6 @@
<div class="f16 fb fontBlue mb10">代码质量分析</div>
<div>
<%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id), :id => 'quality_analyses_form') do %>
<%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier, :rep_id => @repository.id, :remote => true), :id => 'quality_analyses_form') do %>
<div class="ui form">
<div class="mb10" style="margin-right:13px;">
<textarea id="path_description" name="path" rows="8" placeholder="目录相对于根目录,用半角逗号隔开。如:src/main/java,libs,res/script" style="height: 87px; resize:vertical;" class="analysis-option-box"></textarea>
@ -12,7 +12,7 @@
</div>
<div class="mb10">
<div>
<%= select_tag :language, options_for_select(["java","python","ruby","c++","c#", "Web"]), :id => 'branch', :class => "analysis-option-box" %>
<%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"]), :id => 'branch', :class => "analysis-option-box" %>
</div>
</div>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="$('#quality_analyses_form').submit();hideModal()">提交</a></div>

View File

@ -5,9 +5,9 @@
<a href="<%= @zip_path %>" class="btn_zipdown fr" onclick="">ZIP下载</a>
<%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %>
<%# if User.current.member_of?(@project) %>
<%# if quality_analysis(User.current.try(:login), @repository.id).nil? %>
<% if quality_analysis(User.current.try(:login), @repository.id).nil? %>
<%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %>
<%# end %>
<% end %>
<%# end %>
<%# else %>
<%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %>