Merge branch 'szzh' into dev_hjq
This commit is contained in:
commit
d6aeb5b0e7
|
@ -336,7 +336,7 @@ class AccountController < ApplicationController
|
|||
:expires => 1.month.from_now,
|
||||
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
||||
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
||||
:domain => '.trustie.net',
|
||||
:domain => Redmine::Configuration['cookie_domain'],
|
||||
:httponly => true
|
||||
}
|
||||
cookies[autologin_cookie_name] = cookie_options
|
||||
|
|
|
@ -199,7 +199,7 @@ class ApplicationController < ActionController::Base
|
|||
# Logs out current user
|
||||
def logout_user
|
||||
if User.current.logged?
|
||||
cookies.delete(autologin_cookie_name)
|
||||
cookies.delete(autologin_cookie_name, domain: :all)
|
||||
# Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
|
||||
self.logged_user = nil
|
||||
end
|
||||
|
|
|
@ -675,11 +675,12 @@ class BidsController < ApplicationController
|
|||
#删除作业
|
||||
#by xianbo
|
||||
def homework_destroy
|
||||
@bid_to_destroy = Bid.find params[:course_id]
|
||||
@bid_to_destroy = Bid.find params[:id]
|
||||
course_url = course_homework_path(@bid_to_destroy.courses.first)
|
||||
(render_403; return false) unless User.current.admin?||User.current.id==@bid_to_destroy.author_id
|
||||
@bid_to_destroy.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.html { redirect_to course_url }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
<p class="fl "><%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )</p>
|
||||
<% if @is_teacher%>
|
||||
<%= bid_anonymous_comment(bid)%>
|
||||
<% if bid.homeworks.empty? %>
|
||||
<%= link_to(l(:button_delete),bids_homework_path(:id => bid.id), :method => :delete, :confirm => l(:label_delete_confirm), :class => "fr mr10 work_edit") %>
|
||||
<% end %>
|
||||
<%= link_to(l(:button_edit),edit_bid_path(:course_id =>@course.id, :bid_id => bid.id), :class => "fr mr10 work_edit") %>
|
||||
<% elsif @is_student%>
|
||||
<%= student_anonymous_comment bid %>
|
||||
|
@ -59,4 +62,4 @@
|
|||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
.close_btn span { display:none;}
|
||||
.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;}
|
||||
.msgserver { margin:2px 0px 0px 4px; padding-top: 0px}
|
||||
.msgserver a { background:url(/images/sidebar_bg.png) no-repeat -119px -115px; padding-left:22px;}
|
||||
.msgserver a { padding-left:4px;}
|
||||
.opnionText{ width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;}
|
||||
.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;}
|
||||
.opnionButton:hover{background: #0fa9bb; }
|
||||
|
@ -180,7 +180,9 @@ function cookieget(n)
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="msgserver">
|
||||
<a href="http://user.trustie.net/users/34/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>白 羽</a>
|
||||
<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #15BCCF;">
|
||||
<%= l(:label_technical_support) %>白 羽</a>
|
||||
<iframe name="hiddentab" style="display: none"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="side_bottom"></div>
|
||||
|
|
|
@ -22,10 +22,9 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="msgserver">
|
||||
<a href="http://user.trustie.net/users/34/user_newfeedback" target="_blank">
|
||||
<%= l(:label_technical_support) %>
|
||||
白 羽
|
||||
</a>
|
||||
<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #15BCCF;">
|
||||
<%= l(:label_technical_support) %>白 羽</a>
|
||||
<iframe name="hiddentab" style="display: none"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="side_bottom"></div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- added by fq -->
|
||||
<!-- added by fq -->u
|
||||
<!--huang-->
|
||||
<% if @user.user_extensions.identity == 0 %>
|
||||
<%= render :partial => 'my_create_homework' %>
|
||||
|
|
|
@ -90,6 +90,7 @@ default:
|
|||
user_name: "huang.jingquan@163.com"
|
||||
password: 'xinhu1ji2qu366'
|
||||
|
||||
cookie_domain: ".trustie.net"
|
||||
# Absolute path to the directory where attachments are stored.
|
||||
# The default is the 'files' directory in your Redmine instance.
|
||||
# Your Redmine instance needs to have write permission on this
|
||||
|
|
|
@ -353,7 +353,7 @@ zh:
|
|||
#
|
||||
label_feedback: 意见反馈
|
||||
label_feedback_tips: "欢迎反馈网站问题,课程中遇到的问题请反馈给相关老师!"
|
||||
label_technical_support: "技术支持:"
|
||||
label_technical_support: "QQ 在线支持:"
|
||||
label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!"
|
||||
label_feedback_value: "该帖来自用户反馈:)"
|
||||
|
||||
|
|
|
@ -759,6 +759,7 @@ en:
|
|||
button_create_and_continue: Create and continue
|
||||
button_test: Test
|
||||
button_edit: Edit
|
||||
button_delete: Delete
|
||||
button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
|
||||
button_add: Add
|
||||
button_change: Change
|
||||
|
|
|
@ -849,6 +849,7 @@ zh:
|
|||
button_create_and_continue: 创建并继续
|
||||
button_test: 测试
|
||||
button_edit: 编辑
|
||||
button_delete: 删除
|
||||
button_edit_associated_wikipage: "编辑相关wiki页面: %{page_title}"
|
||||
button_add: 新增
|
||||
button_change: 修改
|
||||
|
|
|
@ -251,7 +251,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
|
||||
post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
|
||||
# boards end
|
||||
post 'bids/homework_destroy', :to => 'bids#homework_destroy'
|
||||
delete 'bids/homework', :to => 'bids#homework_destroy'
|
||||
|
||||
# Misc issue routes. TODO: move into resources
|
||||
match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
|
||||
|
|
|
@ -287,7 +287,8 @@ html{ overflow-x:hidden;}
|
|||
.close_btn span { display:none;}
|
||||
.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;}
|
||||
.msgserver { margin-top:5px;}
|
||||
.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; }
|
||||
/*.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; }*/
|
||||
.msgserver a { padding-left:4px; height:21px; display:block; }
|
||||
.opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;}
|
||||
a.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;}
|
||||
a:hover.opnionButton{background: #0fa9bb; }
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
require 'rails_helper'
|
||||
require 'shared_account_spec'
|
||||
|
||||
RSpec.describe "homework", type: :request do
|
||||
include_context "create user"
|
||||
let(:course) {FactoryGirl.create(:course, teacher: current_user)}
|
||||
let(:homework){FactoryGirl.attributes_for(:homework)}
|
||||
|
||||
before {
|
||||
shared_register
|
||||
}
|
||||
describe "创建作业" do
|
||||
before do
|
||||
post calls_create_homework_path(course_id: course.id), {
|
||||
bid: homework
|
||||
}
|
||||
@homework = assigns(:bid)
|
||||
end
|
||||
it "参数正确,可以成功创建作业" do
|
||||
expect(response).to redirect_to(course_homework_url(course.id))
|
||||
end
|
||||
it {expect(course.homeworks).to_not be_empty}
|
||||
it {expect(@homework.acts).to_not be_empty}
|
||||
it {expect(@homework.watchers).to_not be_empty}
|
||||
it {expect(@homework.attachments).to_not be_empty}
|
||||
end
|
||||
|
||||
describe "删除作业" do
|
||||
before do
|
||||
shared_login
|
||||
post calls_create_homework_path(course_id: course.id), {
|
||||
bid: homework
|
||||
}
|
||||
@homework = assigns(:bid)
|
||||
delete bids_homework_path(id: @homework.id)
|
||||
end
|
||||
it{expect(response).to redirect_to(course_homework_path(course.id))}
|
||||
it "homework_for_courses应删除" do
|
||||
expect(course.homeworks).to be_empty
|
||||
end
|
||||
it "相关活动也删除" do
|
||||
expect(@homework.acts).to be_empty
|
||||
end
|
||||
it "watches 删除" do
|
||||
expect(@homework.watchers).to be_empty
|
||||
end
|
||||
it "附件 删除" do
|
||||
expect(@homework.attachments).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue