commit
376ec39035
@ -0,0 +1 @@
|
||||
{"access_token":"oEEf8ZKAB8Y2G0o_xnTPkPJHKKk8iHkLC-f5ptvQ2nCMj9IpC86ivLD2-p38GfOkuG-HuQp3pWZqhs3NJXUMdPLWsr5k67hPZYuqg4ozLccx0xdLswapj0mn8ovZhK1tKIKiAFAOMO","expires_in":7200,"got_token_at":1467012449}
|
@ -0,0 +1,55 @@
|
||||
#coding=utf-8
|
||||
module Mobile
|
||||
module Apis
|
||||
class Resources < Grape::API
|
||||
|
||||
resource :resources do
|
||||
|
||||
desc '获取所有课件'
|
||||
params do
|
||||
requires :token, type: String
|
||||
end
|
||||
get do
|
||||
authenticate!
|
||||
data = current_user.course_attachments
|
||||
present :data, data, with: Mobile::Entities::Attachment
|
||||
present :status, 0
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
desc '获取所有作业'
|
||||
params do
|
||||
requires :token, type: String
|
||||
end
|
||||
get 'homeworks' do
|
||||
authenticate!
|
||||
|
||||
homeworks = current_user.homework_commons
|
||||
|
||||
present :data, homeworks, with: Mobile::Entities::Homework
|
||||
present :status, 0
|
||||
|
||||
end
|
||||
|
||||
desc '获取所有测验'
|
||||
params do
|
||||
requires :token, type: String
|
||||
end
|
||||
get 'exercies' do
|
||||
authenticate!
|
||||
|
||||
exercises = current_user.exercises
|
||||
present :data, exercises, with: Mobile::Entities::Exercise
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,8 @@
|
||||
module Mobile
|
||||
module Entities
|
||||
class Exercise < Grape::Entity
|
||||
expose :exercise_name
|
||||
expose :exercise_description
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the QualityAnalyses controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,99 @@
|
||||
class QualityAnalysisController < ApplicationController
|
||||
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||
before_filter :authorize
|
||||
layout "base_projects"
|
||||
include ApplicationHelper
|
||||
require 'jenkins_api_client'
|
||||
require 'nokogiri'
|
||||
require 'json'
|
||||
require 'open-uri'
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||
jenkins_address = Redmine::Configuration['jenkins_address']
|
||||
@client = JenkinsApi::Client.new(:server_url => jenkins_address,
|
||||
:username => "temp",
|
||||
:password => '123123')
|
||||
#@client.exists?(job_name)
|
||||
@g = Gitlab.client
|
||||
user_name = User.find(params[:user_id]).try(:login)
|
||||
branch = params[:branch].nil? ? "master" : params[:branch]
|
||||
language = params[:language]
|
||||
path = params[:path]
|
||||
identifier = params[:identifier]
|
||||
qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
|
||||
version = qa.nil? ? 1 : qa.sonar_version + 1
|
||||
properties = "sonar.projectKey=#{user_name}:#{identifier}
|
||||
sonar.projectName=#{user_name}:#{identifier}
|
||||
sonar.projectVersion=#{version}
|
||||
sonar.sources=#{path}
|
||||
sonar.language=#{language.downcase}
|
||||
sonar.sourceEncoding=utf-8"
|
||||
git_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git"
|
||||
|
||||
# # # modify config
|
||||
@doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml')))
|
||||
@doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url
|
||||
@doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}"
|
||||
@doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties #sonar-properties
|
||||
#
|
||||
# replace config.xml of jenkins
|
||||
@client = @client.job.create("#{user_name}_#{identifier}", @doc.to_xml)
|
||||
# relace gitlab hook
|
||||
# genkins address
|
||||
@g.add_project_hook(@project.gpid, jenkins_address + "/project/#{user_name}_#{identifier}")
|
||||
if qa.nil?
|
||||
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, :sonar_version => version, :path => path, :branch => branch, :language => language)
|
||||
|
||||
else
|
||||
qa.update_attribute(:sonar_version, version)
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
@sonar_address = Redmine::Configuration['sonar_address']
|
||||
# if params[:resource_id].nil?
|
||||
# @name_flag = true
|
||||
# @quality_analyses = QualityAnalysis.where(:project_id => @project.id)
|
||||
# # @quality_analyses.map {|qa| qa.}
|
||||
# # if @quality_analyses.count > 0
|
||||
# # @quality_analyses.each do |qa|
|
||||
# # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
|
||||
# #
|
||||
# # end
|
||||
# # end
|
||||
# # projects_date = open(@sonar_address + "/api/projects/index").read
|
||||
# # arr = JSON.parse(projects_date).map {|m| m["nm"]}
|
||||
# # arr.map
|
||||
# else
|
||||
qa = QualityAnalysis.where(:project_id => @project.id).first
|
||||
@resource_id = qa.author_login+":"+qa.rep_identifier
|
||||
@name_flag = false
|
||||
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
|
||||
issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
|
||||
@sonar_issues = JSON.parse(issue_date).first
|
||||
# end
|
||||
end
|
||||
|
||||
# Find project of id params[:project_id]
|
||||
def find_project_by_project_id
|
||||
@project = Project.find(params[:project_id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Authorize the user for the requested action
|
||||
def authorize(ctrl = params[:controller], action = params[:action], global = false)
|
||||
unless @project.archived? && @project.gpid.nil?
|
||||
true
|
||||
else
|
||||
render_403 :message => :notice_not_authorized_archived_project
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,97 @@
|
||||
# encoding: utf-8
|
||||
module QualityAnalysisHelper
|
||||
|
||||
def sqale_rating_status val
|
||||
arr = []
|
||||
if val.to_i > 0 && val.to_i < 5
|
||||
arr << "很好"
|
||||
arr << "b_green2"
|
||||
elsif val.to_i > 5 && val.to_i < 10
|
||||
arr << "较好"
|
||||
arr << "b_slow_yellow"
|
||||
elsif val.to_i > 10 && val.to_i < 20
|
||||
arr << "中等"
|
||||
arr << "b_yellow"
|
||||
elsif val.to_i > 20 && val.to_i < 50
|
||||
arr << "较差"
|
||||
arr << "b_slow_red"
|
||||
elsif val.to_i > 20
|
||||
arr << "很差"
|
||||
arr << "b_red"
|
||||
end
|
||||
end
|
||||
|
||||
def complexity_status val
|
||||
arr = []
|
||||
if val.to_i < 10
|
||||
arr << "良好"
|
||||
arr << "b_green2"
|
||||
elsif val.to_i > 10 && val.to_i < 15
|
||||
arr << "较高"
|
||||
arr << "b_yellow"
|
||||
elsif val.to_i > 15
|
||||
arr << "很高"
|
||||
arr << "b_red"
|
||||
end
|
||||
end
|
||||
|
||||
def duplicated_lines_density_status val
|
||||
arr = []
|
||||
if val.to_i < 30
|
||||
arr << "良好"
|
||||
arr << "b_green2"
|
||||
elsif val.to_i > 30 && val.to_i < 50
|
||||
arr << "较高"
|
||||
arr << "b_yellow"
|
||||
elsif val.to_i > 50
|
||||
arr << "很高"
|
||||
arr << "b_red"
|
||||
end
|
||||
end
|
||||
|
||||
def comment_lines_density_status val
|
||||
arr = []
|
||||
if val.to_i < 20
|
||||
arr << "较低"
|
||||
arr << "b_yellow"
|
||||
elsif val.to_i > 20 && val.to_i < 50
|
||||
arr << "正常"
|
||||
arr << "b_green2"
|
||||
elsif val.to_i > 50
|
||||
arr << "较高"
|
||||
arr << "b_red"
|
||||
end
|
||||
end
|
||||
|
||||
def score_sqale_rating val
|
||||
if val.to_i > 0 && val.to_i < 5
|
||||
"5"
|
||||
elsif val.to_i > 5 && val.to_i < 10
|
||||
"4"
|
||||
elsif val.to_i > 10 && val.to_i < 20
|
||||
"3"
|
||||
elsif val.to_i > 20 && val.to_i < 50
|
||||
"2"
|
||||
elsif val.to_i > 20
|
||||
"1"
|
||||
end
|
||||
end
|
||||
|
||||
def lines_scale val
|
||||
if val.to_i < 5000
|
||||
"小型"
|
||||
elsif val.to_i >5000 && val.to_i < 50000
|
||||
"中型"
|
||||
else
|
||||
"大型"
|
||||
end
|
||||
end
|
||||
|
||||
#统计答题百分比,统计结果保留两位小数
|
||||
def statistics_result_percentage(e, t)
|
||||
e = e.to_f
|
||||
t = t.to_f
|
||||
t == 0 ? 0 : format("%.2f", e*100/t)
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class QualityAnalysis < ActiveRecord::Base
|
||||
attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language
|
||||
|
||||
def user_rep_name
|
||||
self.author_login+":"+self.rep_identifier
|
||||
end
|
||||
end
|
@ -0,0 +1,3 @@
|
||||
class SonarAnalysis < ActiveRecord::Base
|
||||
attr_accessible :author_login, :project_id, :rep_identifier
|
||||
end
|
@ -1,7 +1,7 @@
|
||||
<%if @save_flag%>
|
||||
//$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();
|
||||
//$('#reorder_time').click();
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/forums/" + "<%= @forum.id%>"
|
||||
window.location.href= "<%= host_with_protocol %>"+"/forums/" + "<%= @forum.id%>"
|
||||
<%else%>
|
||||
$("#error").html("<%= @forum.errors.full_messages[0]%>").show();
|
||||
<%end %>
|
||||
|
@ -0,0 +1,3 @@
|
||||
$("#org_members_count_id").html("");
|
||||
$("#org_members_count_id").html("<%= @org.org_members.count %>")
|
||||
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
|
@ -0,0 +1,483 @@
|
||||
<script>
|
||||
// sqale_rating
|
||||
$(function () {
|
||||
$('#container_sqale_rating').highcharts({
|
||||
|
||||
chart: {
|
||||
type: 'gauge',
|
||||
plotBackgroundColor: null,
|
||||
plotBackgroundImage: null,
|
||||
plotBorderWidth: 0,
|
||||
plotShadow: false
|
||||
},
|
||||
title: false,
|
||||
pane: {
|
||||
startAngle: -150,
|
||||
endAngle: 150,
|
||||
background: [{
|
||||
backgroundColor: {
|
||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||
stops: [
|
||||
[0, '#FFF'],
|
||||
[1, '#333']
|
||||
]
|
||||
},
|
||||
borderWidth: 0,
|
||||
outerRadius: '109%'
|
||||
}, {
|
||||
backgroundColor: {
|
||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||
stops: [
|
||||
[0, '#333'],
|
||||
[1, '#FFF']
|
||||
]
|
||||
},
|
||||
borderWidth: 1,
|
||||
outerRadius: '107%'
|
||||
}, {
|
||||
// default background
|
||||
}, {
|
||||
backgroundColor: '#DDD',
|
||||
borderWidth: 0,
|
||||
outerRadius: '105%',
|
||||
innerRadius: '103%'
|
||||
}]
|
||||
},
|
||||
|
||||
// the value axis
|
||||
yAxis: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
minorTickInterval: 'auto',
|
||||
minorTickWidth: 1,
|
||||
minorTickLength: 10,
|
||||
minorTickPosition: 'inside',
|
||||
minorTickColor: '#666',
|
||||
tickPixelInterval: 30,
|
||||
tickWidth: 2,
|
||||
tickPosition: 'inside',
|
||||
tickLength: 10,
|
||||
tickColor: '#666',
|
||||
labels: {
|
||||
step: 2,
|
||||
rotation: 'auto'
|
||||
},
|
||||
// title: {
|
||||
// text: 'km/h'
|
||||
// },
|
||||
plotBands: [{
|
||||
from: 0,
|
||||
to: 5,
|
||||
color: '#55BF3B' // green
|
||||
}, {
|
||||
from: 6,
|
||||
to: 10,
|
||||
color: '#adde18' // yellow
|
||||
}, {
|
||||
from: 11,
|
||||
to: 20,
|
||||
color: '#DDDF0D' // red
|
||||
}, {
|
||||
from: 21,
|
||||
to: 50,
|
||||
color: '#df8538' // yellow
|
||||
}, {
|
||||
from: 51,
|
||||
to: 100,
|
||||
color: '#DF5353' // yellow
|
||||
}]
|
||||
},
|
||||
|
||||
// delete hightcharts.com
|
||||
credits:{
|
||||
enabled: false
|
||||
},
|
||||
series: [{
|
||||
name: '代码质量',
|
||||
data: [<%= @complexity["msr"][9]["val"] %>]
|
||||
// tooltip: {
|
||||
// valueSuffix: ' km/h'
|
||||
// }
|
||||
}]
|
||||
|
||||
},
|
||||
// Add some life
|
||||
function (chart) {
|
||||
// if (!chart.renderer.forExport) {
|
||||
// setInterval(function () {
|
||||
// var point = chart.series[0].points[0],
|
||||
// newVal,
|
||||
// inc = Math.round((Math.random() - 0.5) * 20);
|
||||
//
|
||||
// newVal = point.y + inc;
|
||||
// if (newVal < 0 || newVal > 200) {
|
||||
// newVal = point.y - inc;
|
||||
// }
|
||||
//
|
||||
// point.update(newVal);
|
||||
//
|
||||
// }, 3000);
|
||||
// }
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// function_complexity
|
||||
$(function () {
|
||||
$('#container_function_complexity').highcharts({
|
||||
|
||||
chart: {
|
||||
type: 'gauge',
|
||||
plotBackgroundColor: null,
|
||||
plotBackgroundImage: null,
|
||||
plotBorderWidth: 0,
|
||||
plotShadow: false
|
||||
},
|
||||
title: false,
|
||||
pane: {
|
||||
startAngle: -150,
|
||||
endAngle: 150,
|
||||
background: [{
|
||||
backgroundColor: {
|
||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||
stops: [
|
||||
[0, '#FFF'],
|
||||
[1, '#333']
|
||||
]
|
||||
},
|
||||
borderWidth: 0,
|
||||
outerRadius: '109%'
|
||||
}, {
|
||||
backgroundColor: {
|
||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||
stops: [
|
||||
[0, '#333'],
|
||||
[1, '#FFF']
|
||||
]
|
||||
},
|
||||
borderWidth: 1,
|
||||
outerRadius: '107%'
|
||||
}, {
|
||||
// default background
|
||||
}, {
|
||||
backgroundColor: '#DDD',
|
||||
borderWidth: 0,
|
||||
outerRadius: '105%',
|
||||
innerRadius: '103%'
|
||||
}]
|
||||
},
|
||||
|
||||
// the value axis
|
||||
yAxis: {
|
||||
min: 0,
|
||||
max: 30,
|
||||
minorTickInterval: 'auto',
|
||||
minorTickWidth: 1,
|
||||
minorTickLength: 10,
|
||||
minorTickPosition: 'inside',
|
||||
minorTickColor: '#666',
|
||||
tickPixelInterval: 30,
|
||||
tickWidth: 2,
|
||||
tickPosition: 'inside',
|
||||
tickLength: 10,
|
||||
tickColor: '#666',
|
||||
labels: {
|
||||
step: 2,
|
||||
rotation: 'auto'
|
||||
},
|
||||
// title: {
|
||||
// text: 'km/h'
|
||||
// },
|
||||
plotBands: [{
|
||||
from: 0,
|
||||
to: 10,
|
||||
color: '#55BF3B' // green
|
||||
}, {
|
||||
from: 11,
|
||||
to: 15,
|
||||
color: '#DDDF0D' // yellow
|
||||
}, {
|
||||
from: 16,
|
||||
to: 30,
|
||||
color: '#DF5353' // red
|
||||
}]
|
||||
},
|
||||
|
||||
// delete hightcharts.com
|
||||
credits:{
|
||||
enabled: false
|
||||
},
|
||||
series: [{
|
||||
name: '复杂度',
|
||||
data: [<%= @complexity["msr"][6]["val"] %>]
|
||||
// tooltip: {
|
||||
// valueSuffix: ' km/h'
|
||||
// }
|
||||
}]
|
||||
|
||||
},
|
||||
// Add some life
|
||||
function (chart) {
|
||||
// if (!chart.renderer.forExport) {
|
||||
// setInterval(function () {
|
||||
// var point = chart.series[0].points[0],
|
||||
//// newVal,
|
||||
//// inc = Math.round((Math.random() - 0.5) * 20);
|
||||
//
|
||||
//// newVal = point.y + inc;
|
||||
//// if (newVal < 0 || newVal > 200) {
|
||||
//// newVal = point.y - inc;
|
||||
//// }
|
||||
//
|
||||
//// point.update(newVal);
|
||||
//
|
||||
// }, 3000);
|
||||
// }
|
||||
});
|
||||
});
|
||||
|
||||
// duplicated_lines_density
|
||||
$(function () {
|
||||
$('#container_duplicated_lines_density').highcharts({
|
||||
|
||||
chart: {
|
||||
type: 'gauge',
|
||||
plotBackgroundColor: null,
|
||||
plotBackgroundImage: null,
|
||||
plotBorderWidth: 0,
|
||||
plotShadow: false
|
||||
},
|
||||
title: false,
|
||||
pane: {
|
||||
startAngle: -150,
|
||||
endAngle: 150,
|
||||
background: [{
|
||||
backgroundColor: {
|
||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||
stops: [
|
||||
[0, '#FFF'],
|
||||
[1, '#333']
|
||||
]
|
||||
},
|
||||
borderWidth: 0,
|
||||
outerRadius: '109%'
|
||||
}, {
|
||||
backgroundColor: {
|
||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||
stops: [
|
||||
[0, '#333'],
|
||||
[1, '#FFF']
|
||||
]
|
||||
},
|
||||
borderWidth: 1,
|
||||
outerRadius: '107%'
|
||||
}, {
|
||||
// default background
|
||||
}, {
|
||||
backgroundColor: '#DDD',
|
||||
borderWidth: 0,
|
||||
outerRadius: '105%',
|
||||
innerRadius: '103%'
|
||||
}]
|
||||
},
|
||||
|
||||
xAxis: {
|
||||
style:{
|
||||
fontSize: '18px'
|
||||
}
|
||||
},
|
||||
|
||||
// the value axis
|
||||
yAxis: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
minorTickInterval: 'auto',
|
||||
minorTickWidth: 1,
|
||||
minorTickLength: 10,
|
||||
minorTickPosition: 'inside',
|
||||
minorTickColor: '#666',
|
||||
tickPixelInterval: 30,
|
||||
tickWidth: 2,
|
||||
tickPosition: 'inside',
|
||||
tickLength: 10,
|
||||
tickColor: '#666',
|
||||
labels: {
|
||||
step: 2,
|
||||
rotation: 'auto'
|
||||
},
|
||||
// title: {
|
||||
// text: 'km/h'
|
||||
// },
|
||||
plotBands: [{
|
||||
from: 0,
|
||||
to: 30,
|
||||
color: '#55BF3B' // green
|
||||
}, {
|
||||
from: 31,
|
||||
to: 50,
|
||||
color: '#DDDF0D' // red
|
||||
}, {
|
||||
from: 51,
|
||||
to: 100,
|
||||
color: '#DF5353' // yellow
|
||||
}]
|
||||
},
|
||||
|
||||
// delete hightcharts.com
|
||||
credits:{
|
||||
enabled: false
|
||||
},
|
||||
series: [{
|
||||
name: '重复率',
|
||||
data: [<%= @complexity["msr"][7]["val"] %>]
|
||||
// tooltip: {
|
||||
// valueSuffix: ' km/h'
|
||||
// }
|
||||
}]
|
||||
|
||||
},
|
||||
// Add some life
|
||||
function (chart) {
|
||||
// if (!chart.renderer.forExport) {
|
||||
// setInterval(function () {
|
||||
// var point = chart.series[0].points[0],
|
||||
// newVal,
|
||||
// inc = Math.round((Math.random() - 0.5) * 20);
|
||||
//
|
||||
// newVal = point.y + inc;
|
||||
// if (newVal < 0 || newVal > 200) {
|
||||
// newVal = point.y - inc;
|
||||
// }
|
||||
//
|
||||
// point.update(newVal);
|
||||
//
|
||||
// }, 3000);
|
||||
// }
|
||||
});
|
||||
});
|
||||
|
||||
// comment_lines_density
|
||||
$(function () {
|
||||
$('#container_comment_lines_density').highcharts({
|
||||
|
||||
chart: {
|
||||
type: 'gauge',
|
||||
plotBackgroundColor: null,
|
||||
plotBackgroundImage: null,
|
||||
plotBorderWidth: 0,
|
||||
plotShadow: false
|
||||
},
|
||||
title: false,
|
||||
pane: {
|
||||
startAngle: -150,
|
||||
endAngle: 150,
|
||||
background: [{
|
||||
backgroundColor: {
|
||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||
stops: [
|
||||
[0, '#FFF'],
|
||||
[1, '#333']
|
||||
]
|
||||
},
|
||||
borderWidth: 0,
|
||||
outerRadius: '109%'
|
||||
}, {
|
||||
backgroundColor: {
|
||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||
stops: [
|
||||
[0, '#333'],
|
||||
[1, '#FFF']
|
||||
]
|
||||
},
|
||||
borderWidth: 1,
|
||||
outerRadius: '107%'
|
||||
}, {
|
||||
// default background
|
||||
}, {
|
||||
backgroundColor: '#DDD',
|
||||
borderWidth: 0,
|
||||
outerRadius: '105%',
|
||||
innerRadius: '103%'
|
||||
}]
|
||||
},
|
||||
|
||||
xAxis: {
|
||||
title: {
|
||||
text: '复杂度',
|
||||
x: -23, //center设置标题的位置
|
||||
y: 6
|
||||
},
|
||||
style:{
|
||||
fontSize: '18px'
|
||||
}
|
||||
},
|
||||
|
||||
// the value axis
|
||||
yAxis: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
minorTickInterval: 'auto',
|
||||
minorTickWidth: 1,
|
||||
minorTickLength: 10,
|
||||
minorTickPosition: 'inside',
|
||||
minorTickColor: '#666',
|
||||
tickPixelInterval: 30,
|
||||
tickWidth: 2,
|
||||
tickPosition: 'inside',
|
||||
tickLength: 10,
|
||||
tickColor: '#666',
|
||||
labels: {
|
||||
step: 2,
|
||||
rotation: 'auto'
|
||||
},
|
||||
// title: {
|
||||
// text: 'km/h'
|
||||
// },
|
||||
plotBands: [{
|
||||
from: 0,
|
||||
to: 20,
|
||||
color: '#DDDF0D' // green
|
||||
}, {
|
||||
from: 21,
|
||||
to: 50,
|
||||
color: '#55BF3B' // red
|
||||
}, {
|
||||
from: 51,
|
||||
to: 100,
|
||||
color: '#DF5353' // yellow
|
||||
}]
|
||||
},
|
||||
|
||||
// delete hightcharts.com
|
||||
credits:{
|
||||
enabled: false
|
||||
},
|
||||
series: [{
|
||||
name: '质量等级',
|
||||
data: [<%= @complexity["msr"][5]["val"] %>]
|
||||
// tooltip: {
|
||||
// valueSuffix: ' km/h'
|
||||
// }
|
||||
}]
|
||||
|
||||
},
|
||||
// Add some life
|
||||
function (chart) {
|
||||
// if (!chart.renderer.forExport) {
|
||||
// setInterval(function () {
|
||||
// var point = chart.series[0].points[0],
|
||||
// newVal,
|
||||
// inc = Math.round((Math.random() - 0.5) * 20);
|
||||
//
|
||||
// newVal = point.y + inc;
|
||||
// if (newVal < 0 || newVal > 200) {
|
||||
// newVal = point.y - inc;
|
||||
// }
|
||||
//
|
||||
// point.update(newVal);
|
||||
//
|
||||
// }, 3000);
|
||||
// }
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,25 @@
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">分析结果</h2>
|
||||
</div>
|
||||
<ul class="analysis-result-list">
|
||||
<li class="analysis-result-name fl fontBlue2" >名称</li>
|
||||
<li class="analysis-result-version fl fontBlue2" >版本</li>
|
||||
<li class="analysis-result-loc fl fontBlue2" >分支</li>
|
||||
<li class="analysis-result-debt fl fontBlue2" >语言</li>
|
||||
<li class="analysis-result-time fl fontBlue2" >时间</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% if @quality_analyses.count >0 %>
|
||||
<% @quality_analyses.each do |qa| %>
|
||||
<ul class="analysis-result-list">
|
||||
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.author_login+":"+qa.rep_identifier, :branch => qa.branch.nil? ? "master" : qa.branch), :class => "analysis-result-name fl fontBlue2" %></li>
|
||||
<li class="analysis-result-version fl fontBlue2" title="版本">1.0</li>
|
||||
<li class="analysis-result-loc fl fontBlue2" title="分支名"><%= qa.branch %></li>
|
||||
<li class="analysis-result-debt fl fontBlue2" title="语言"><%= qa.language %></li>
|
||||
<li class="analysis-result-time fl fontBlue2" title="时间"><%= format_time(qa.created_at) %></li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
@ -0,0 +1,114 @@
|
||||
<%= javascript_include_tag 'highcharts','highcharts-more' %>
|
||||
<%= render :partial => "hightchars" %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2" style="width:180px;">质量分析</h2>
|
||||
</div>
|
||||
<div class="button-rep">当前分支:<%= params[:branch] %></div>
|
||||
<div class="cl"></div>
|
||||
<div class="tac f20 fb mt35 mb30">项目代码质量分析报告</div>
|
||||
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl">概要信息</span></div>
|
||||
<div class="analysis-block mt10 mb40 f14">
|
||||
<div class="flex">
|
||||
<div class="analysis-genral">
|
||||
<p id="container_sqale_rating" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
|
||||
<p class="fontGrey3">质量等级</p>
|
||||
<p class="fontBlue2 pr"><%= @complexity["msr"][9]["frmt_val"] %><span class="f8 c_white analysis-genral-icon <%= sqale_rating_status(@complexity["msr"][9]["val"])[1] %> borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %></span></p>
|
||||
</div>
|
||||
<div class="analysis-genral" >
|
||||
<p id="container_function_complexity" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
|
||||
<p class="fontGrey3">复杂度</p>
|
||||
<p class="fontBlue2 pr"><%= @complexity["msr"][6]["val"] %><span class="f8 c_white analysis-genral-icon <%= complexity_status(@complexity["msr"][6]["val"])[1] %> borderRadius"><%= complexity_status(@complexity["msr"][6]["val"])[0] %></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="analysis-genral">
|
||||
<p id="container_duplicated_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
|
||||
<p class="fontGrey3">代码重复度</p>
|
||||
<p class="fontBlue2 pr"><%= @complexity["msr"][7]["frmt_val"] %><span class="f8 c_white analysis-genral-icon <%= duplicated_lines_density_status(@complexity["msr"][7]["val"])[1] %> borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"])[0] %></span></p>
|
||||
</div>
|
||||
<div class="analysis-genral">
|
||||
<p id="container_comment_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
|
||||
<p class="fontGrey3">注释率</p>
|
||||
<p class="fontBlue2 pr"><%= @complexity["msr"][5]["frmt_val"] %><span class="f8 c_white analysis-genral-icon <%= comment_lines_density_status(@complexity["msr"][5]["val"])[1] %> borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"])[0] %></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">质量等级</span><span class="mr10 fontGrey2"><span class="c_red f18" style="margin-top:-5px; display:inline-block;"><%= score_sqale_rating(@complexity["msr"][9]["val"]) %></span>/5分</span><span class="fontGrey2">可定性评价为:<span class="c_red">质量<%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %></span></span></div>
|
||||
<div class="analysis-block mt10 mb40 f14">
|
||||
<div><span class="fontGrey3 mr30">技术债务</span><span class="fontBlue2 w70 pInline"><%= @complexity["msr"][8]["frmt_val"] %></span><span class="fontGrey2"><a target="_blank" href="<%= @sonar_address %>/drilldown/measures/<%= @resource_id %>?metric=sqale_index">查看详情</a></span></div>
|
||||
<div><span class="fontGrey3 mr30">质量问题</span>
|
||||
<span class="fontBlue2 w70 pInline"><a class="fontBlue2 w70 pInline" target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false"><%= @sonar_issues["msr"][0]["frmt_val"] %></a></span><span class="fontGrey2">问题分类如下:</span></div>
|
||||
<div class="ml90 mt15">
|
||||
<div class="mb10"><span class="analysis-block-icon mr5"></span><span class="fontGrey3 mr45">阻断</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][1]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][1]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-serious-icon mr5"></span><span class="fontGrey3 mr45">严重</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][2]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][2]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-main-icon mr5"></span><span class="fontGrey3 mr45">主要</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][3]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][3]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-secondary-icon mr5"></span><span class="fontGrey3 mr45">次要</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][4]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][4]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||
<div><span class="analysis-info-icon mr5"></span><span class="fontGrey3 mr45">信息</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][5]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][5]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">代码规模</span><span class="fontGrey2">可定性评价为:<span class="c_red"><%= lines_scale(@complexity["msr"][0]["frmt_val"]) %></span></span></div>
|
||||
<div class="analysis-block mt10 mb40 flex f14">
|
||||
<div class="analysis-genral">
|
||||
<p class="fontGrey3">代码行数</p>
|
||||
<p class="fontBlue2"><%= @complexity["msr"][0]["frmt_val"] %></p>
|
||||
</div>
|
||||
<div class="analysis-genral">
|
||||
<p class="fontGrey3">文件</p>
|
||||
<p class="fontBlue2"><%= @complexity["msr"][2]["frmt_val"] %></p>
|
||||
</div>
|
||||
<div class="analysis-genral">
|
||||
<p class="fontGrey3">目录</p>
|
||||
<p class="fontBlue2"><%= @complexity["msr"][3]["frmt_val"] %></p>
|
||||
</div>
|
||||
<div class="analysis-genral">
|
||||
<p class="fontGrey3">类</p>
|
||||
<p class="fontBlue2"><%= @complexity["msr"][1]["frmt_val"] %></p>
|
||||
</div>
|
||||
<div class="analysis-genral">
|
||||
<p class="fontGrey3">方法</p>
|
||||
<p class="fontBlue2"><%= @complexity["msr"][4]["frmt_val"] %></p>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl">贡献统计</span></div>-->
|
||||
<!--<div class="analysis-block mt10 f12">-->
|
||||
<!--<ul class="contribute-list">-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-avatar"> </li>-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-code">代码行数</li>-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-problem">引入质量问题数</li>-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-rate">引入质量问题数/代码行数</li>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</ul>-->
|
||||
<!--<ul class="contribute-list">-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">-->
|
||||
<!--<div class="mt8"><img src="images/homepageImage.jpg" width="50" class="image-cir" />-->
|
||||
<!--<p class="fontGrey2 hidden">小明</p>-->
|
||||
<!--</div>-->
|
||||
<!--</li>-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height">18340</li>-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height">230</li>-->
|
||||
<!--<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height">.012540</li>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</ul>-->
|
||||
<!--<ul class="contribute-list">-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">-->
|
||||
<!--<div class="mt8"><img src="images/homepageImage.jpg" width="50" class="image-cir" />-->
|
||||
<!--<p class="fontGrey2 hidden">小王</p>-->
|
||||
<!--</div>-->
|
||||
<!--</li>-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height">834</li>-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height">34</li>-->
|
||||
<!--<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height">.04077</li>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</ul>-->
|
||||
<!--<ul class="contribute-list">-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">-->
|
||||
<!--<div class="mt8"><img src="images/homepageImage.jpg" width="50" class="image-cir" />-->
|
||||
<!--<p class="fontGrey2 hidden">小亮</p>-->
|
||||
<!--</div>-->
|
||||
<!--</li>-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height">134</li>-->
|
||||
<!--<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height">10</li>-->
|
||||
<!--<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height">.07462</li>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
@ -0,0 +1,6 @@
|
||||
<% if @name_flag %>
|
||||
<%= render :partial => "result_list" %>
|
||||
<% else %>
|
||||
<%= render "show" %>
|
||||
<% end %>
|
||||
|
@ -0,0 +1,23 @@
|
||||
<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), :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>
|
||||
</div>
|
||||
<div class="mb10">
|
||||
<div>
|
||||
<%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @rev), :id => 'branch', :class => "analysis-option-box" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb10">
|
||||
<div>
|
||||
<%= select_tag :language, options_for_select(["java","python","ruby","c++","c#", "Web"]), :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>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal()">取消</a></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
@ -0,0 +1,76 @@
|
||||
<%= javascript_include_tag 'highcharts','highcharts-more' %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_quality_analyses) %></h2>
|
||||
</div>
|
||||
|
||||
<div class="repository_con " style="line-height:1.9;">
|
||||
<%#= render :partial => 'navigation' %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div id = "container">
|
||||
</div>
|
||||
<div id = "container_quality" class="mt30">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#container').highcharts({
|
||||
chart: {
|
||||
type: 'pie',
|
||||
options3d: {
|
||||
enabled: true,
|
||||
alpha: 45,
|
||||
beta: 0
|
||||
}
|
||||
},
|
||||
title: {
|
||||
text: 'Browser market shares at a specific website, 2014'
|
||||
},
|
||||
tooltip: {
|
||||
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
|
||||
},
|
||||
plotOptions: {
|
||||
pie: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
depth: 35,
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
format: '{point.name}'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
type: 'pie',
|
||||
name: 'Browser share',
|
||||
data: [
|
||||
['Firefox', 45.0],
|
||||
['IE', 26.8],
|
||||
{
|
||||
name: 'Chrome',
|
||||
y: 12.8,
|
||||
sliced: true,
|
||||
selected: true
|
||||
},
|
||||
['Safari', 8.5],
|
||||
['Opera', 6.2],
|
||||
['Others', 0.7]
|
||||
],
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
style: {
|
||||
fontSize: '13px',
|
||||
color: '#aaa',
|
||||
fontFamily: 'Arial',
|
||||
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
|
||||
fontWeight: 'normal'
|
||||
}
|
||||
}
|
||||
}]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
|
||||
<% html_title(l(:label_repository), l(:label_statistics)) -%>
|
@ -0,0 +1,8 @@
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'repositories/quality_analysis', :locals => {}) %>');
|
||||
showModal('ajax-modal', '615px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 580px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","20%").css("left","32%").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
<div class="orig_cont clearfix">
|
||||
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
|
||||
<div>
|
||||
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment} %>
|
||||
</div>
|
@ -0,0 +1,85 @@
|
||||
<ul>
|
||||
<% comments.each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
autoUrl('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
|
||||
<%= time_from_now(comment.created_on) %>
|
||||
</div>
|
||||
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
|
||||
<% parents_rely = [] %>
|
||||
<% parents_rely = get_reply_parents_no_root parents_rely, comment %>
|
||||
<% length = parents_rely.length %>
|
||||
<div id="comment_reply_<%=comment.id %>">
|
||||
<% if length <= 3 %>
|
||||
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent} %>
|
||||
<% else %>
|
||||
<div class="orig_cont clearfix">
|
||||
<div class="orig_cont clearfix">
|
||||
<div>
|
||||
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
|
||||
</div>
|
||||
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
|
||||
</div>
|
||||
<div class="orig_cont_hide clearfix">
|
||||
<span class="orig_icon" >↓ </span>
|
||||
<span class="orig_icon" style="display:none;" > ↑</span>
|
||||
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %>
|
||||
</div>
|
||||
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !comment.content_detail.blank? || comment.class == Journal %>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<% if comment.class == Journal %>
|
||||
<% if comment.details.any? %>
|
||||
<% details_to_strings(comment.details).each do |string| %>
|
||||
<p><%= string %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<P><%= comment.notes.html_safe %></P>
|
||||
<% else %>
|
||||
<%= comment.content_detail.html_safe %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<% if allow_delete %>
|
||||
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user, :user_activity_id => user_activity_id, :activity_id => activity_id},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= comment.id%>"></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
@ -1,5 +1,7 @@
|
||||
<% if params[:type] == 'HomeworkCommon' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/homework_replies', :locals => {:comments => @journals, :is_in_course =>@is_in_course,:course_activity=>@course_activity, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id}) %>');
|
||||
<% elsif params[:type] == 'JournalsForMessage' %>
|
||||
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/journal_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :allow_delete => @allow_delete, :activity_id =>params[:id].to_i}) %>');
|
||||
<% else %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>');
|
||||
<% end %>
|
||||
|
@ -1,3 +1,7 @@
|
||||
<% unless @comment.parent.nil? %>
|
||||
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent})%>");
|
||||
<% if params[:type] == 'JournalsForMessage' && (@comment.jour_type == 'Principal' || @comment.jour_type == 'Course') %>
|
||||
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent})%>");
|
||||
<% else %>
|
||||
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent})%>");
|
||||
<% end %>
|
||||
<% end %>
|
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
var isWeixin = ua.indexOf('micromessenger') != -1;
|
||||
var isAndroid = ua.indexOf('android') != -1;
|
||||
var isIos = (ua.indexOf('iphone') != -1) || (ua.indexOf('ipad') != -1);
|
||||
if (!isWeixin) {
|
||||
document.head.innerHTML = '<title>抱歉,出错了</title><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0"><link rel="stylesheet" type="text/css" href="https://res.wx.qq.com/connect/zh_CN/htmledition/style/wap_err1a9853.css">';
|
||||
document.body.innerHTML = '<div class="page_msg"><div class="inner"><span class="msg_icon_wrp"><i class="icon80_smile"></i></span><div class="msg_content"><h4>请在微信客户端打开链接</h4></div></div></div>';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue