Merge branch 'develop' into yuanke_org

This commit is contained in:
yuanke 2016-07-04 08:58:29 +08:00
commit 1da4c7bebf
17 changed files with 47 additions and 39 deletions

View File

@ -653,12 +653,12 @@ class ProjectsController < ApplicationController
def update
@project.safe_attributes = params[:project]
@project.organization_id = params[:organization_id]
params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0
params[:project][:hidden_repo] ? @project.hidden_repo = 1 : @project.hidden_repo = 0
params[:project][:is_public] == "on" ? @project.is_public = 1 : @project.is_public = 0
params[:project][:hidden_repo] == "on" ? @project.hidden_repo = 1 : @project.hidden_repo = 0
# 更新公开私有时同步gitlab公开私有
if !@project.gpid.nil? && @project.is_public != (params[:project][:is_public] == "on" ? true : false)
if !@project.gpid.nil? && @project.is_public != (params[:project][:is_public] == "on" ? 1 : 0)
g = Gitlab.client
params[:project][:is_public] ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
params[:project][:is_public] == "on" ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
end
# end
if validate_parent_id && @project.save

View File

@ -165,6 +165,7 @@ class QualityAnalysisController < ApplicationController
# resource_id: login + @repository.id
def index
begin
@branch = params[:branch]
@resource_id = params[:resource_id]
@sonar_address = Redmine::Configuration['sonar_address']
@jenkins_address = Redmine::Configuration['jenkins_address']
@ -177,7 +178,7 @@ class QualityAnalysisController < ApplicationController
else
if params[:current_build_status] == "failure"
job_name = params[:job_name]
@console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')
@console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"]
end
complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read
@complexity =JSON.parse(complexity_date).first

View File

@ -48,17 +48,17 @@ module SyllabusesHelper
option6 = []
option1 << "请选择"
option1 << 1
option1 << 0
option2 << "公共必修课"
option2 << 2
option2 << 1
option3 << "学科必修课"
option3 << 3
option3 << 2
option4 << "专业选修课"
option4 << 4
option4 << 3
option5 << "实践必修课"
option5 << 5
option5 << 4
option6 << "实践选修课"
option6 << 6
option6 << 5
type << option1
type << option2

View File

@ -324,15 +324,15 @@ class CoursesService
define_error [
0, '加入成功',
1, '密码错误',
2, '课程已过期 请联系课程管理员重启课程。',
3, '您已经加入了课程',
4, '您加入的课程不存在',
2, '班级已过期 请联系班级管理员重启班级。',
3, '您已经加入了班级',
4, '您加入的班级不存在',
5, '您还未登录',
6, '申请成功,请等待审核完毕',
7, '您已经发送过申请了,请耐心等待',
8, '您已经是该课程的教师了',
9, '您已经是该课程的教辅了',
10, '您已经是该课程的管理员了',
8, '您已经是该班级的教师了',
9, '您已经是该班级的教辅了',
10, '您已经是该班级的管理员了',
'未知错误,请稍后再试'
]
end

View File

@ -10,12 +10,12 @@ window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/co
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
<% elsif @state == 3 %>
alert("您已经加入了课程");
alert("您已经加入了班级");
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 4 %>
alert("您加入的课程不存在");
alert("您加入的班级不存在");
<% elsif @state == 5 %>
alert("您还未登录");
<% elsif @state == 6 %>
@ -25,15 +25,15 @@ hidden_join_course_form();
alert("您已经发送过申请了,请耐心等待");
hidden_join_course_form();
<% elsif @state == 8%>
alert("您已经是该课程的教师了");
alert("您已经是该班级的教师了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 9%>
alert("您已经是该课程的教辅了");
alert("您已经是该班级的教辅了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 10%>
alert("您已经是该课程的管理员了");
alert("您已经是该班级的管理员了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% else %>

View File

@ -9,9 +9,9 @@
}
<% else %>
<% if @course.is_public? %>
$("#show_course_<%= @course.id %>").attr("title","公开课程<%= @course.name %><%= @course.time.to_s+ @course.term %>");
$("#show_course_<%= @course.id %>").attr("title","公开班级<%= @course.name %><%= @course.time.to_s+ @course.term %>");
<% else %>
$("#show_course_<%= @course.id %>").attr("title","私有课程<%= @course.name %><%= @course.time.to_s+ @course.term %>");
$("#show_course_<%= @course.id %>").attr("title","私有班级<%= @course.name %><%= @course.time.to_s+ @course.term %>");
<% end %>
$("#set_course_public_<%= @course.id %>").replaceWith('<%= escape_javascript(link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => "courses", :action => "private_or_public", :id => @course,:user_page => true},
:id => "set_course_public_#{@course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗") %>');

View File

@ -4,7 +4,7 @@
<% end %>
<div class="cl"></div>
<li><label >创建教师:</label><span><%=syllabus.user.show_name %></span></li>
<% unless syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 %>
<% unless syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %>
<li><label>课程性质:</label><%=syllabus.syllabus_type_str %></li>
<% end %>
<% unless syllabus.credit.nil? || syllabus.credit == '' %>
@ -26,7 +26,7 @@
<li><label>先修课程:</label><%=syllabus.pre_course %></li>
<% end %>
<% if syllabus.syllabus_type.nil? || syllabus.syllabus_type == '' %>
<% if syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %>
<li class="none none_attr"><label>课程性质:</label><span class="fontGrey3">空</span></li>
<% end %>
<% if syllabus.credit.nil? || syllabus.credit == '' %>
@ -48,7 +48,7 @@
<li class="none none_attr"><label>先修课程:</label><span class="fontGrey3">空</span></li>
<% end %>
</ul>
<% if User.current.logged? && (User.current == syllabus.user || User.current.admin?)&&(syllabus.syllabus_type.nil? || syllabus.syllabus_type == ''||syllabus.credit.nil? || syllabus.credit == ''||syllabus.hours.nil? || syllabus.hours == ''||syllabus.theory_hours.nil? || syllabus.theory_hours == ''||syllabus.practice_hours.nil? || syllabus.practice_hours == ''||syllabus.applicable_major.nil? || syllabus.applicable_major == ''||syllabus.pre_course.nil? || syllabus.pre_course == '')%>
<% if User.current.logged? && (User.current == syllabus.user || User.current.admin?)&&(syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == ''||syllabus.credit.nil? || syllabus.credit == ''||syllabus.hours.nil? || syllabus.hours == ''||syllabus.theory_hours.nil? || syllabus.theory_hours == ''||syllabus.practice_hours.nil? || syllabus.practice_hours == ''||syllabus.applicable_major.nil? || syllabus.applicable_major == ''||syllabus.pre_course.nil? || syllabus.pre_course == '')%>
<span class="homepageLeftMenuMore"><a href="javascript:void(0);" data-init="0" onclick="toggle_all_syllabus_attr();" class="homepageLeftMenuMoreIcon" id="show_all_syllabus_attr"></a></span>
<% end %>
<script>

View File

@ -2,7 +2,7 @@
<div class="project_r_h">
<h2 class="project_h2" style="width:180px;">质量分析</h2>
</div>
<p>
<%= h @console_build.to_json.html_safe %>
</p>
<div>
<%=h @console_build %>
</div>

View File

@ -21,7 +21,13 @@
<li class="analysis-result-version fl fontBlue2" title="分支名"><%= qa.branch %></li>
<li class="analysis-result-loc fl fontBlue2" title="语言"><%= qa.language %></li>
<li class="analysis-result-debt fl fontBlue2" title="时间"><%= qa.path %></li>
<li class="analysis-result-time fl fontBlue2" title="编辑"><%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true %></li>
<% if User.current.try(:login) == qa.author_login %>
<li class="analysis-result-time fl" title="编辑">
<%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %>
</li>
<% else %>
<li class="analysis-result-time fl" style="color: #888" title="编辑">编辑</li>
<% end %>
<div class="cl"></div>
</ul>
<% end %>

View File

@ -2,7 +2,7 @@
<%= render :partial => "result_list" %>
<% else %>
<% if params[:current_build_status].nil? || params[:current_build_status] == "success" %>
<%= render :partial => "show", :locals => {:branch => params[:branch]} %>
<%= render :partial => "show", :locals => {:branch => @branch} %>
<% else %>
<% if params[:build_console_result] %>
运行结果超时

View File

@ -5,7 +5,7 @@
<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? && is_project_manager?(User.current.id, @project.id) && @project.is_public? %>
<% if quality_analysis(User.current.try(:login), @repository.id).nil? && User.current.member_of?(@project) && @project.is_public? %>
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %>
<% end %>
<%# end %>

View File

@ -23,7 +23,7 @@
<li>
<span class="item_list fl"></span>
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "list-title fl #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程")+course.name+""+current_time_and_term(course)+""%>
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级")+course.name+""+current_time_and_term(course)+""%>
<% teacher = User.where("id=?",course.tea_id).first%>
<span class="fr grayTxt">
<%='主讲老师:'+(teacher.try(:realname) != " " ? teacher.lastname + teacher.firstname : teacher.try(:login)) %>

View File

@ -2,7 +2,7 @@
<% if users_results.try(:size).to_i > 0 %>
<hr />
<% users_results.each do |user| %>
<p class="font_description2">
<p class="font_description2" style="padding: 10px 5px">
<strong><%= l(:label_tags_user_name) %><%= link_to ("#{user.name}"),
:controller => "users",:action => "show",:id => user.id%></strong>
<br />

View File

@ -16,7 +16,7 @@
<% content_for :content do %>
<div>
<h3><strong><%= l(:label_tags_search_result) %></strong></h3>
<div align="right">
<div class="mb5">
<%= l(:label_tags_numbers) %>
<%= l(:label_issue_plural) %>(<%= @issues_tags_num %>) |
<%= l(:label_project_plural) %>(<%= @projects_tags_num %>) |

View File

@ -20,7 +20,7 @@
<li>
<span class="item_list fl"></span>
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "list-title fl #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程")+course.name+""+current_time_and_term(course)+""%>
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级")+course.name+""+current_time_and_term(course)+""%>
<% teacher = User.where("id=?",course.tea_id).first%>
<span class="fr grayTxt">
<%='主讲老师:'+(teacher.try(:realname) != " " ? teacher.lastname + teacher.firstname : teacher.try(:login)) %>

View File

@ -74,7 +74,7 @@
<%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
</li>
<% if User.current == syllabus.user %>
<li><%=link_to '删除', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%></li>
<li><%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%></li>
<% end %>
</ul>
</li>

View File

@ -1429,3 +1429,4 @@ a.pages-big{ width:50px;}
.W600{ width:600px;}
.syllabus_input {width: 290px; border: 1px solid #64bdd9; height: 30px;}
.syllabus_input option {max-width:260px;}