This commit is contained in:
z9hang 2014-07-29 18:04:45 +08:00
commit 952fcce0de
23 changed files with 265 additions and 326 deletions

View File

@ -181,7 +181,8 @@ class AttachmentsController < ApplicationController
respond_to do |format|
# modify by nwb
if !@attachment.container.nil? && (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) &&(@attachment.container.is_a?(Course) || @attachment.container.course)
if !@attachment.container.nil? &&
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course ) )
if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) }
elsif @course.nil?

View File

@ -85,7 +85,7 @@ class MessagesController < ApplicationController
@reply.board = @board
@reply.safe_attributes = params[:reply]
@topic.children << @reply
@topic.update_attribute(:updated_on, Time.now)
#@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record?
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments])

View File

@ -304,6 +304,36 @@ class SoftapplicationsController < ApplicationController
end
end
def search
@softapplications = Softapplication.where("name like '%#{params[:name]}%'")
#new added fenyefunction
@limit = 5
@softapplication_count = @softapplications.count
@softapplication_pages = Paginator.new @softapplication_count, @limit, params['page']
@offset ||= @softapplication_pages.offset
#new added sort
if params[:softapplication_sort_type].present?
case params[:softapplication_sort_type]
when '0'
@softapplications = @softapplications[@offset, @limit]
@s_state = 0
when '1'
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
end
else
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
end
#new added end
respond_to do |format|
format.html
end
end
private
def find_softapplication
@softapplication = Softapplication.find_by_id(params[:id])

View File

@ -167,12 +167,6 @@ class Mailer < ActionMailer::Base
#缺陷到期邮件通知
def issue_expire issue
#@issues = issues
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
#puts s + "////" + issue.assigned_to.mail
#@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id)
#mail :to => issue.assigned_to.mail,
# :subject => s
issue_id = issue.project_index
redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue_id,
@ -183,10 +177,32 @@ class Mailer < ActionMailer::Base
@issue = issue
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
recipients = issue.recipients
cc = issue.watcher_recipients - recipients
s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
mail :to => recipients,
:cc => cc,
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
:subject => s
#########################################################################################################
#@issues = issues
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
#puts s + "////" + issue.assigned_to.mail
#@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id)
#mail :to => issue.assigned_to.mail,
# :subject => s
#########################################################################################################
#issue_id = issue.project_index
#redmine_headers 'Project' => issue.project.identifier,
# 'Issue-Id' => issue_id,
# 'Issue-Author' => issue.author.login
#redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
#message_id issue
#@author = issue.author
#@issue = issue
#@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
#recipients = issue.recipients
#cc = issue.watcher_recipients - recipients
#mail :to => recipients,
# :cc => cc,
# :subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
######################################################################################################
end
@ -567,9 +583,10 @@ class Mailer < ActionMailer::Base
end
#缺陷到期后发送邮件提示
#只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。
def mail_issue
threads = []
issues = Issue.where("done_ratio <> 100 && closed_on is null && due_date is not null")
issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null and due_date > '#{Time.now.to_date}'")
issues.each do |issue|
thread = Thread.start do
while true
@ -582,7 +599,7 @@ class Mailer < ActionMailer::Base
sleep 3600
else
#发邮件
puts issue.id.to_s
#puts issue.id.to_s
Mailer.issue_expire(issue).deliver
#Mailer.issue_add(issue).deliver
break
@ -591,7 +608,6 @@ class Mailer < ActionMailer::Base
end
threads << thread
end
puts threads.count.to_s
threads
end

View File

@ -1,6 +1,6 @@
<div id="admin-index">
<h3><%=l(:label_administration)%></h3>
<!-- <%= render :partial => 'no_data' if @no_configuration_data %> -->
<!-- <%#= render :partial => 'no_data' if @no_configuration_data %> -->
<%= render :partial => 'menu' %>
</div>

View File

@ -1,21 +1,36 @@
<script type="text/javascript">
function searchUser(){
var name = $("#name").val();
if(name == "")
{
alert("搜索条件不能为空");
return;
}
$("#search_softapplications").submit();
}
</script>
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%=l(:label_contest_innovate_community)%></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="305px">
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 25 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
</div>
<div class="project-search" style="float: right">
<%= form_tag({:controller => 'softapplications', :action => 'search'}, :method => :get, :id => "search_softapplications") do %>
<%= text_field_tag 'name', params[:name], :size => 25 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%=link_to request.host()+"/softapplications", :controller=>'softapplications', :action=>'index' %></td>
<td ><%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %>
<td ><%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %>
</td>
</tr>
</table>

View File

@ -0,0 +1,24 @@
<% @softapplications.each do |softapplication| %>
<div>
<span style="font-size: 15px; margin-right: 10px;"><strong><%= link_to softapplication.name, softapplication, :target => "_blank" %></strong></span>
<span><%= rating_for softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %></span>
</div>
<div class="avatar-4" style="float: left; margin-top: 7px "><%= image_tag('/images/app1.png')%></div>
<div style="float: left; width: 600px; padding-top: 6px; margin-left: 8px"><%= softapplication.description.truncate(95, omission: '...') %></div>
<div style="float: left; width: 200px; margin-left: 70px; margin-top: -3px; line-height: 0.5em ">
<%contest = softapplication.contests.first%>
<p><%=l(:label_attendingcontestwork_belongs_contest)%><%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%></p>
<p><%=l(:label_attendingcontestwork_belongs_type)%><%= softapplication.app_type_name.truncate(10, omission: '...') %></p>
<p><%=l(:label_attendingcontestwork_adaptive_system)%><%= softapplication.android_min_version_available %></p>
</div>
<div style="padding-left: 53px">
<span><%=l(:label_attendingcontestwork_developers)%><%= softapplication.application_developers %></span>
<span style="padding-left: 50px"><%=l(:label_attendingcontestwork_release_time)%><%=format_time softapplication.created_at %></span>
</div>
<div style="border-left: 1px solid #d9d8d8; border-bottom: 1px solid #d9d8d8; margin-left: 50px; padding-bottom: 10px; margin-bottom: 20px; width: 66%"></div>
<div class="underline-contests_one" style="margin-top: -7px"></div>
<% end %>
<div class="pagination"><%= pagination_links_full @softapplication_pages, @softapplication_count, :per_page_links => false %></div>

View File

@ -3,37 +3,15 @@
<%=render :partial => 'layouts/base_softapplication_index_top_content'%>
<% if @softapplications.size > 0%>
<%= sort_softapplication(@s_state)%>
<div width="95%" border="0" style="padding-left: 10px; padding-top: 10px;">
<% @softapplications.each do |softapplication| %>
<div>
<span style="font-size: 15px; margin-right: 10px;"><strong><%= link_to softapplication.name, softapplication, :target => "_blank" %></strong></span>
<span><%= rating_for softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %></span>
</div>
<div class="avatar-4"; style="float: left; margin-top: 7px "><%= image_tag('/images/app1.png')%></div>
<div style="float: left; width: 600px; padding-top: 6px; margin-left: 8px"><%= softapplication.description.truncate(95, omission: '...') %></div>
<div style="float: left; width: 200px; margin-left: 70px; margin-top: -3px; line-height: 0.5em ">
<%contest = softapplication.contests.first%>
<p><%=l(:label_attendingcontestwork_belongs_contest)%><%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%></p>
<p><%=l(:label_attendingcontestwork_belongs_type)%><%= softapplication.app_type_name.truncate(10, omission: '...') %></p>
<p><%=l(:label_attendingcontestwork_adaptive_system)%><%= softapplication.android_min_version_available %></p>
</div>
<div style="padding-left: 53px">
<span><%=l(:label_attendingcontestwork_developers)%><%= softapplication.application_developers %></span>
<span style="padding-left: 50px"><%=l(:label_attendingcontestwork_release_time)%><%=format_time softapplication.created_at %></span>
</div>
<div style="border-left: 1px solid #d9d8d8; border-bottom: 1px solid #d9d8d8; margin-left: 50px; padding-bottom: 10px; margin-bottom: 20px; width: 66%"></div>
<div class="underline-contests_one" style="margin-top: -7px"></div>
<% end %>
<div width="95%" border="0" style="padding-left: 10px; padding-top: 10px;" id="softapplications_list">
<%= sort_softapplication(@s_state)%>
<%= render :partial => "list" %>
</div>
<% else %>
<%= render :partial => "layouts/no_content"%>
<% end %>
<div class="pagination"><%= pagination_links_full @softapplication_pages, @softapplication_count, :per_page_links => false %></div>
<% html_title l(:label_contest_work_list)%>

View File

@ -0,0 +1,11 @@
<%=render :partial => 'layouts/base_softapplication_index_top_content'%>
<% if @softapplications.size > 0%>
<%#= sort_softapplication(@s_state)%>
<div width="95%" border="0" style="padding-left: 10px; padding-top: 10px;" id="softapplications_list">
<%= render :partial => "list" %>
</div>
<% else %>
<%= render :partial => "layouts/no_content"%>
<% end %>
<% html_title l(:label_contest_work_list)%>

View File

@ -0,0 +1,2 @@
$('#softapplications_list').html('<%= escape_javascript(render(:partial => 'list' )) %>');

View File

@ -87,12 +87,12 @@ default:
address: smtp.gmail.com
address: smtp.qq.com
port: 587
domain: smtp.gmail.com
domain: smtp.qq.com
authentication: :plain
user_name: trustieforge@gmail.com
password: '!@#$%^&*('
user_name: 939547590@qq.com
password: 'suwen11223344'
# Absolute path to the directory where attachments are stored.
# The default is the 'files' directory in your Redmine instance.

View File

@ -1,4 +1,4 @@
#Mailer.mail_issue.each do |t|
# t.join
#end
Mailer.mail_issue.each do |t|
t.join
end

View File

@ -76,6 +76,7 @@ RedmineApp::Application.routes.draw do
collection do
match 'new_message', via: :get
match 'search', via: [:get, :post]
end
member do
match 'create_message' , via: :post

View File

@ -439,26 +439,6 @@ ActiveRecord::Schema.define(:version => 20140728014933) do
t.datetime "updated_at", :null => false
end
create_table "gitlab_projects", :force => true do |t|
t.integer "gitlab_project_id"
t.integer "project_id"
t.string "repository_url"
t.string "web_url"
t.string "localfile_url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "gitlab_users", :force => true do |t|
t.integer "gitlab_user_id"
t.integer "user_id"
t.string "email"
t.string "password"
t.string "login", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups_users", :id => false, :force => true do |t|
t.integer "group_id", :null => false
t.integer "user_id", :null => false
@ -901,6 +881,19 @@ ActiveRecord::Schema.define(:version => 20140728014933) do
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
create_table "rich_rich_files", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "rich_file_file_name"
t.string "rich_file_content_type"
t.integer "rich_file_file_size"
t.datetime "rich_file_updated_at"
t.string "owner_type"
t.integer "owner_id"
t.text "uri_cache"
t.string "simplified_type", :default => "file"
end
create_table "roles", :force => true do |t|
t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1

View File

@ -1,9 +1,15 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
typeId: 1
typeName: MyString
courses_001_infos:
id: 1
course_id: 1
user_id: 20
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41
courses_002_infos:
id: 2
course_id: 2
user_id: 20
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41
two:
typeId: 1
typeName: MyString

View File

@ -1,15 +1,18 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
courses_001_statuses:
changesets_count: 1
watchers_count: 1
course_id: 1
grade: 1.5
course_ac_para: 1
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41
two:
courses_002_statuses:
changesets_count: 1
watchers_count: 1
course_id: 1
course_id: 2
grade: 1.5
course_ac_para: 1
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41

View File

@ -1,23 +1,23 @@
---
courses_invalid_001:
courses_001:
id: 1
tea_id:
name: ''
tea_id: 20
name: courses_001
state:
code:
time:
time: 2013
extra:
created_at: 2013-09-30 15:36:00.000000000 Z
updated_at: 2014-04-19 01:50:41.000000000 Z
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41
location:
term:
term: 春季学期
string:
password:
password: '1234'
setup_time:
endup_time:
class_period:
school_id:
description:
endup_time: '2014-04-18 00:00:00'
class_period: '32'
school_id: 117
description: 'courses_001 description'
status: 1
attachmenttype: 2
lft:
@ -25,16 +25,16 @@ courses_invalid_001:
is_public: 1
inherit_members: 1
courses_008:
id: 8
tea_id: 5
courses_002:
id: 2
tea_id: 20
name: 分布式计算环境
state:
code:
time: 2013
extra: course2013-09-30_23-36-00
created_at: 2013-09-30 15:36:00.000000000 Z
updated_at: 2014-04-19 01:50:41.000000000 Z
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41
location:
term: 春季学期
string:
@ -50,129 +50,3 @@ courses_008:
rgt:
is_public: 1
inherit_members: 1
courses_058:
id: 58
tea_id: 1168
name: 软件工程实践
state:
code:
time: 2014
extra: course2014-04-17_17-12-17
created_at: 2014-04-17 09:12:17.000000000 Z
updated_at: 2014-04-17 09:12:17.000000000 Z
location:
term: 春季学期
string:
password: SEP2014
setup_time:
endup_time:
class_period: '18'
school_id: 0
description: 国防科技大学计算机学院工程硕士专业选修课。
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 1
inherit_members: 1
courses_059:
id: 59
tea_id: 193
name: 软件项目管理
state:
code:
time: 2014
extra: course2014-04-18_18-10-46
created_at: 2014-04-18 10:10:46.000000000 Z
updated_at: 2014-04-18 10:10:46.000000000 Z
location:
term: 春季学期
string:
password: software
setup_time:
endup_time:
class_period: '30'
school_id: 0
description: 面向“软件工程”专业的本科生
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 1
inherit_members: 1
courses_060:
id: 60
tea_id: 1179
name: android开发
state:
code:
time: 2014
extra: course2014-04-19_15-40-39
created_at: 2014-04-19 07:40:39.000000000 Z
updated_at: 2014-04-19 07:40:39.000000000 Z
location:
term: 春季学期
string:
password: trustie740208
setup_time:
endup_time:
class_period: '48'
school_id: 37
description: ''
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 1
inherit_members: 1
courses_061:
id: 61
tea_id: 29
name: 测试课程1
state:
code:
time: 2014
extra: course2014-06-04_14-51-56
created_at: 2014-06-04 06:51:56.000000000 Z
updated_at: 2014-07-15 01:40:49.000000000 Z
location:
term: 春季学期
string:
password: '1234'
setup_time:
endup_time: '2014-07-14 00:00:00'
class_period: '23'
school_id: 1579
description: '233'
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 0
inherit_members: 1
course_trustie_074:
id: 74
tea_id: 698
name: 电路与电子学基础(软件工程专业)
state:
code:
time: 2014
extra: course2014-05-22_16-09-25
created_at: 2014-05-22 08:09:25.000000000 Z
updated_at: 2014-05-22 08:09:25.000000000 Z
location:
term: 春季学期
string:
password: '12345678'
setup_time:
endup_time:
class_period: '54'
school_id: 117
description: "电路与电子学基础,软件工程小班\\r\ 模拟电子技术部分\ "
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 1
inherit_members: 1

View File

@ -47,8 +47,3 @@ member_roles_011:
role_id: 2
member_id: 10
inherited_from: 10
member_roles_179:
id: 179
member_id: 126
role_id: 3
inherited_from:

View File

@ -60,10 +60,3 @@ members_010:
project_id: 2
user_id: 8
mail_notification: false
members_course_001:
id: 126
user_id: 5
project_id: -1
created_on: 2013-09-30 15:36:00.000000000 Z
mail_notification: false
course_id: 8

View File

@ -1,9 +1,13 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
name:
province: MyString
school_117:
id: 117
name: 国防科学技术大学
province: 湖南省
logo_link:
two:
name:
province: MyString
school_001:
id: 1
name: 摧毁地球人学校
province: 火星
logo_link:

View File

@ -1,76 +1,57 @@
person_one_extra:
id: 44
user_id: 29
birthday: "2013-09-30 21:19:25"
brief_introduction: nil
gender: 1
location: "江苏"
occupation: ""
work_experience: nil
zip_code: nil
created_at: "2013-09-30 21:19:25"
updated_at: "2013-10-09 19:00:06"
technical_title: nil
identity: 2
student_id: nil
teacher_realname: nil
student_realname: nil
location_city: "南京"
person_mao_extra:
id: 22
user_id: 193
birthday: "2013-09-30 21:19:25"
brief_introduction: "期待..."
gender: 0
location: "湖南长沙"
occupation: "国防科技大学计算机学院"
work_experience: nil
zip_code: nil
created_at: "2013-09-30 21:19:25"
updated_at: "2013-10-09 19:00:06"
technical_title: "教授"
identity: 0
student_id: nil
teacher_realname: nil
student_realname: nil
location_city: nil
ue_lirongzhen:
id: 587
user_id: 642
user_extension_006:
id: 6
user_id: 6
birthday:
brief_introduction:
gender: 0
location: 河南
location:
occupation:
work_experience:
zip_code:
created_at: 2014-07-29 02:54:09
updated_at: 2014-07-29 02:54:09
technical_title:
identity: 0
student_id:
teacher_realname:
student_realname:
location_city:
school_id:
user_extension_020:
id: 20
user_id: 20
birthday:
brief_introduction: 哈尔
gender: 0
location: 黑龙江
occupation: kylinos-cloud
work_experience:
zip_code:
created_at: 2014-03-18 14:52:55.000000000 Z
updated_at: 2014-03-26 07:19:04.000000000 Z
technical_title:
identity: 1
student_id: '14066023'
created_at: 2014-07-29 02:54:09
updated_at: 2014-07-29 02:54:09
technical_title: 助教
identity: 0
student_id:
teacher_realname:
student_realname:
location_city: 周口
location_city: 哈尔滨
school_id:
ue_yingang:
id: 6
user_id: 5
user_extension_025:
id: 25
user_id: 25
birthday:
brief_introduction: 现有功能的精细化!
brief_introduction: 哈尔
gender: 0
location: 湖南
occupation: 国防科学技术大学计算机学院
location: 黑龙江
occupation: kylinos-cloud
work_experience:
zip_code:
created_at: 2013-09-24 09:36:12.000000000 Z
updated_at: 2014-04-19 08:16:55.000000000 Z
technical_title: 副教授
identity: 0
student_id: ''
created_at: 2014-07-29 02:54:09
updated_at: 2014-07-29 02:54:09
technical_title: 助教
identity: 1 #student
student_id: 10060342
teacher_realname:
student_realname:
location_city: 长沙
student_realname: 'ue_realname'
location_city: 哈尔滨
school_id: 117

View File

@ -72,7 +72,7 @@ users_003:
login: dlopper
type: User
users_005:
id: 12
id: 5
created_on: 2006-07-19 19:33:19 +02:00
# Locked
status: 3
@ -165,26 +165,27 @@ groups_011:
id: 11
lastname: B Team
type: Group
users_yingang_teacher:
id: 5
login: jacknudt
hashed_password: dbbd96684c9a64afe9c4935ce0b517e5e9c08064
firstname:
lastname:
mail: jack_nudt@163.com
users_020:
id: 20
login: teacher1
# password: foobar
hashed_password: 6b6095d977621a3071ae2670be95b88092e94b53
firstname: wang
lastname: dr
mail: jack_nudt@foo.bar
admin: false
status: 1
last_login_on: 2014-04-27 13:49:18.000000000 Z
last_login_on: 2014-07-29 02:54:09
language: zh
auth_source_id:
created_on: 2013-06-25 05:20:59.000000000 Z
updated_on: 2014-07-16 03:37:51.000000000 Z
created_on: 2014-07-29 02:54:09
updated_on: 2014-07-29 02:54:09
type: User
identity_url:
mail_notification: only_my_events
salt: 92944df2ce4dae1a4f01007263c5d8bb
users_lirongzhen_student:
id: 642
salt: 9db798ee4c462d9614479e6738790891
users_025:
id: 25
login: lirongzhen
hashed_password: 070922b015398577c3ae0d87a68d5ffa93bf82e9
firstname: 荣振

View File

@ -1,7 +1,18 @@
require File.expand_path('../../test_helper', __FILE__)
class CoursesControllerTest < ActionController::TestCase
fixtures :courses, :users, :user_extensions, :roles, :members, :member_roles, :enabled_modules, :boards, :messages
fixtures :courses,
:course_infos,
:course_statuses,
:users,
:user_extensions,
:schools,
:roles,
:members,
:member_roles,
:enabled_modules,
:boards,
:messages
def setup
@request.session[:user_id] = nil
@ -23,7 +34,7 @@ class CoursesControllerTest < ActionController::TestCase
# Get :new
# 人员添加课程的权限是不属于任何角色
def test_new_course_anyone_temporary
@request.session[:user_id] = 5
@request.session[:user_id] = 20
Role.find_by_name("Non member").add_permission! :add_course #Non member
get :new
@ -33,7 +44,7 @@ class CoursesControllerTest < ActionController::TestCase
# post :create
def test_create_course_with_access_control
@request.session[:user_id] = 5
@request.session[:user_id] = 20
Role.find_by_name("Non member").add_permission! :add_course #Non member
course_name = 'course_one'
@ -59,7 +70,7 @@ class CoursesControllerTest < ActionController::TestCase
# post :create 403
def test_create_course_without_access_control
@request.session[:user_id] = 5
@request.session[:user_id] = 20
#Role.find_by_name("Non member").add_permission! :add_course #Non member
course_name = 'course_one'