Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-07-20 09:02:20 +08:00
commit 67132109dc
12 changed files with 139 additions and 7 deletions

View File

@ -361,6 +361,12 @@ class ProjectsController < ApplicationController
end
end
# dts测试工具
def dts_rep
render_403 unless User.current.admin?
@dts = Dts.all
end
#发送邮件邀请新用户
def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin?

5
app/models/dts.rb Normal file
View File

@ -0,0 +1,5 @@
class Dts < ActiveRecord::Base
attr_accessible :Category, :Defect, :Description, :File, :IPLine, :IPLineCode, :Method, :Num, :PreConditions, :Review, :StartLine, :TraceInfo, :Variable, :project_id
belongs_to :project
end

View File

@ -68,6 +68,7 @@ class Project < ActiveRecord::Base
has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy
has_many :applied_projects
has_many :invite_lists
has_one :dts
# end
#ADDED BY NIE

View File

@ -35,6 +35,11 @@
<li>
<%= link_to l(:label_project_tool_response) ,project_feedback_path(@project)%>
</li>
<li>
<% if User.current.admin? %>
<%= link_to l(:label_project_dts_new) ,dts_rep_project_path(@project), data: { confirm:'你确定要进行DTS测试吗' } %>
<% end %>
</li>
<!--<li>-->
<!--<%# unless @project.enabled_modules.where("name = 'dts'").empty? %>-->
<!--<%#= link_to l(:project_module_dts) ,share_show_path(@project) %>-->

View File

@ -0,0 +1,30 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_dts_statics) %></h2>
</div>
<p class="fr f14 ">语言:<span style="color: red">Java</span> 总文件数:<span style="color: red">361</span> 代码行数:<span style="color: red">48662</span></p>
<!--<p class="box_h3" style="text-align:center; padding-top: 20px; ">具体测试结果</p>-->
<!--<div style="font-size: 14px;">-->
<!--<p class="">描叙:</p>-->
<!--<p style="padding-left: 10px;color:#ACAEB1 "><%#= @dts.Description %></p>-->
<!--</div>-->
<% @dts.each do |dt| %>
<table width="600" border="2" bordercolor="red" style="padding-top: 10px; padding-left: 30px;">
<tr>
<td align="center" bgcolor="#999999" style="width: 80px"><strong>错误变量</strong></td>
<td style="width: 120px"><%= dt.Variable %></td>
<td align="center" bgcolor="#999999" style="width: 80px"><strong>起始行</strong></td>
<td style="width: 120px"><%= dt.StartLine %></td>
<td align="center" bgcolor="#999999" style="width: 80px"><strong>IP行</strong></td>
<td><%= dt.IPLine %></td>
</tr>
<tr>
<td align="center" bgcolor="#999999"><strong>缺陷代码</strong></td>
<td colspan="5"><%= dt.IPLineCode %></td>
</tr>
<tr>
<td align="center" bgcolor="#999999"><strong>错误描述</strong></td>
<td colspan="5"><%= dt.Description %></td>
</tr>
</table>
<% end %>

View File

@ -90,6 +90,9 @@ zh:
label_project_tool_response: 用户反馈
label_project_news: 项目新闻
label_project_dts_new: DTS测试
label_project_dts_statics: DTS缺陷报告
label_project_overview: "项目简介"
label_expend_information: 展开更多信息
label_project_create: "新建了项目"

View File

@ -385,6 +385,7 @@ RedmineApp::Application.routes.draw do
get 'feedback', :action => 'feedback', :as => 'project_feedback'
get 'watcherlist', :action=> 'watcherlist'
get 'dts_rep', :action=> 'dts_rep'
get 'invite_members', :action=> 'invite_members'
get 'invite_members_by_mail', :action=> 'invite_members_by_mail'
get 'send_mail_to_member', :action => 'send_mail_to_member'

View File

@ -0,0 +1,22 @@
class CreateDts < ActiveRecord::Migration
def change
create_table :dts do |t|
t.string :IPLineCode
t.string :Description
t.string :Num
t.string :Variable
t.string :TraceInfo
t.string :Method
t.string :File
t.string :IPLine
t.string :Review
t.string :Category
t.string :Defect
t.string :PreConditions
t.string :StartLine
t.integer :project_id
t.timestamps
end
end
end

View File

@ -11,12 +11,14 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150715070534) do
ActiveRecord::Schema.define(:version => 20150719092427) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
t.string "act_type", :null => false
t.integer "user_id", :null => false
t.integer "act_id", :null => false
t.string "act_type", :null => false
t.integer "user_id", :null => false
t.integer "activity_container_id"
t.string "activity_container_type", :default => ""
end
add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type"
@ -473,6 +475,25 @@ ActiveRecord::Schema.define(:version => 20150715070534) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id"
create_table "dts", :force => true do |t|
t.string "IPLineCode"
t.string "Description"
t.string "Num"
t.string "Variable"
t.string "TraceInfo"
t.string "Method"
t.string "File"
t.string "IPLine"
t.string "Review"
t.string "Category"
t.string "Defect"
t.string "PreConditions"
t.string "StartLine"
t.integer "project_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "enabled_modules", :force => true do |t|
t.integer "project_id"
t.string "name", :null => false
@ -1340,7 +1361,7 @@ ActiveRecord::Schema.define(:version => 20150715070534) do
end
create_table "user_extensions", :force => true do |t|
t.integer "user_id", :null => false
t.integer "user_id", :null => false
t.date "birthday"
t.string "brief_introduction"
t.integer "gender"
@ -1348,8 +1369,8 @@ ActiveRecord::Schema.define(:version => 20150715070534) do
t.string "occupation"
t.integer "work_experience"
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "technical_title"
t.integer "identity"
t.string "student_id"
@ -1357,6 +1378,7 @@ ActiveRecord::Schema.define(:version => 20150715070534) do
t.string "student_realname"
t.string "location_city"
t.integer "school_id"
t.string "description", :default => ""
end
create_table "user_grades", :force => true do |t|
@ -1462,6 +1484,17 @@ ActiveRecord::Schema.define(:version => 20150715070534) do
add_index "versions", ["project_id"], :name => "versions_project_id"
add_index "versions", ["sharing"], :name => "index_versions_on_sharing"
create_table "visitors", :force => true do |t|
t.integer "user_id"
t.integer "master_id"
t.datetime "updated_on"
t.datetime "created_on"
end
add_index "visitors", ["master_id"], :name => "index_visitors_master_id"
add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on"
add_index "visitors", ["user_id"], :name => "index_visitors_user_id"
create_table "watchers", :force => true do |t|
t.string "watchable_type", :default => "", :null => false
t.integer "watchable_id", :default => 0, :null => false

View File

@ -12,6 +12,7 @@ a:hover.lg-foot{ color:#787b7e;}
/*右侧内容--动态*/
.project_r_h{ width:670px; height:40px; background:#eaeaea; margin-bottom:10px;}
.project_h2{ background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;}
.project_h22{ background:#64bdd9; color:#fff; height:33px; width:124px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;}
.project_r_box{ border:1px solid #e2e1e1; width:670px; margin-top:10px;}
.project_h3 { color:#646464; font-size:14px; padding:0 10px; border-bottom:1px solid #e2e1e1;}
a.more{ float:right; font-size:12px; font-weight:normal; color:#a9a9a9; margin-top:3px;}
@ -752,3 +753,4 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
#about_newtalk{ display:none;}

19
spec/factories/dts.rb Normal file
View File

@ -0,0 +1,19 @@
FactoryGirl.define do
factory :dt, :class => 'Dts' do
IPLineCode "MyString"
Description "MyString"
Num "MyString"
Variable "MyString"
TraceInfo "MyString"
Method "MyString"
File "MyString"
IPLine "MyString"
Review "MyString"
Category "MyString"
Defect "MyString"
PreConditions "MyString"
StartLine "MyString"
project_id 1
end
end

5
spec/models/dts_spec.rb Normal file
View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Dts, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end