-<% end%>
\ No newline at end of file
+<% end%>
diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb
index 06c67320a..74560909d 100644
--- a/app/views/users/user_homeworks.html.erb
+++ b/app/views/users/user_homeworks.html.erb
@@ -1,4 +1,4 @@
-
+u
<% if @user.user_extensions.identity == 0 %>
<%= render :partial => 'my_create_homework' %>
diff --git a/config/configuration.yml b/config/configuration.yml
index 87a54a976..45e307157 100644
--- a/config/configuration.yml
+++ b/config/configuration.yml
@@ -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
diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml
index 9ba8cba7a..a023bc8cb 100644
--- a/config/locales/commons/zh.yml
+++ b/config/locales/commons/zh.yml
@@ -353,7 +353,7 @@ zh:
#
label_feedback: 意见反馈
label_feedback_tips: "欢迎反馈网站问题,课程中遇到的问题请反馈给相关老师!"
- label_technical_support: "技术支持:"
+ label_technical_support: "QQ 在线支持:"
label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!"
label_feedback_value: "该帖来自用户反馈:)"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 09897c1eb..8419ae188 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -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
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 4c752660a..73a97c035 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -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: 修改
diff --git a/config/oneapm.yml b/config/oneapm.yml
new file mode 100644
index 000000000..e5b2e7bed
--- /dev/null
+++ b/config/oneapm.yml
@@ -0,0 +1,135 @@
+#
+# OneApm RubyAgent Configuration
+#
+
+# Here are the settings that are common to all environments
+common: &default_settings
+ # ============================== LICENSE KEY ===============================
+
+ #
+ # Get your license key from oneapm.com
+ #
+ license_key: 'BAQMBw8FUwR2542UFFpDXFgVVk66e2dZWB4EBlQHSf846wgBGwICFQoD0498BAEfBgNIAlQ='
+
+ # Agent Enabled (Ruby/Rails Only)
+ # Valid values are true, false and auto.
+ #
+ # agent_enabled: auto
+
+ # This app_name will be the application name in oneapm.com in your account.
+ #
+ # Caution: If you change this name, a new application will appear in the OneApm
+ # user interface with the new name, and data will stop reporting to the
+ # app with the old name.
+ #
+ app_name: trusite
+
+ # When "true", the agent collects performance data about your
+ # application and reports this data to the OneApm service at
+ # oneapm.com. This global switch is normally overridden for each
+ # environment below. (formerly called 'enabled')
+ monitor_mode: true
+
+ # Specify its log level here.
+ log_level: info
+
+ # log_file_path: 'log'
+ # log_file_name: 'oneapm_agent.log'
+
+ # The oneapm agent communicates with the service via https by default.
+ # ssl: true
+
+ # ======================== Browser Monitoring =============================
+ browser_monitoring:
+ # By default the agent automatically injects the monitoring JavaScript
+ # into web pages. Set this attribute to false to turn off this behavior.
+ auto_instrument: true
+
+ # Proxy settings for connecting to the OneApm server.
+ #
+ # proxy_host: hostname
+ # proxy_port: 8080
+ # proxy_user:
+ # proxy_pass:
+
+ # Tells transaction tracer and error collector (when enabled)
+ # whether or not to capture HTTP params. When true, frameworks can
+ # exclude HTTP parameters from being captured.
+ # Rails: the RoR filter_parameter_logging excludes parameters
+ capture_params: false
+
+ # Transaction tracer captures deep information about slow
+ # transactions and sends this to the OneApm service once a
+ # minute. Included in the transaction is the exact call sequence of
+ # the transactions including any SQL statements issued.
+ transaction_tracer:
+
+ # Transaction tracer is enabled by default.
+ enabled: true
+
+ # Threshold in seconds for when to collect a transaction
+ # trace. When the response time of a controller action exceeds
+ # this threshold, a transaction trace will be recorded and sent to
+ # OneApm. Valid values are any float value, or (default) "apdex_f",
+ # which will use the threshold for an dissatisfying Apdex
+ # controller action - four times the Apdex T value.
+ transaction_threshold: apdex_f
+
+ # When transaction tracer is on, SQL statements can optionally be
+ # recorded. The recorder has three modes, "off" which sends no
+ # SQL, "raw" which sends the SQL statement in its original form,
+ # and "obfuscated", which strips out numeric and string literals.
+ record_sql: obfuscated
+
+ # Threshold in seconds for when to collect stack trace for a SQL
+ # call. In other words, when SQL statements exceed this threshold,
+ # then capture and send to OneApm the current stack trace. This is
+ # helpful for pinpointing where long SQL calls originate from.
+ stack_trace_threshold: 0.500
+
+ # Determines whether the agent will capture query plans for slow
+ # SQL queries. Only supported in mysql and postgres. Should be
+ # set to false when using other adapters.
+ # explain_enabled: true
+
+ # Threshold for query execution time below which query plans will
+ # not be captured. Relevant only when `explain_enabled` is true.
+ # explain_threshold: 0.5
+
+ # Error collector captures information about uncaught exceptions and
+ # sends them to OneApm for viewing
+ error_collector:
+
+ # Error collector is enabled by default.
+ enabled: true
+
+ # Ignore the following errors, add your own.
+ ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
+
+# ===================== Application Environments ========================
+# Environment-specific settings are in this section.
+# For Rails applications, RAILS_ENV is used to determine the environment.
+
+# NOTE if your application has other named environments, you should
+# provide oneapm configuration settings for these environments here.
+
+development:
+ <<: *default_settings
+ # Turn on communication to OneApm service in development mode
+ monitor_mode: true
+ app_name: My Application (Development)
+
+test:
+ <<: *default_settings
+ monitor_mode: false
+
+# Turn on the agent in production for 24x7 monitoring.
+production:
+ <<: *default_settings
+ monitor_mode: true
+
+# Staging environment which behaves identically to production.
+staging:
+ <<: *default_settings
+ monitor_mode: true
+ app_name: My Application (Staging)
diff --git a/config/routes.rb b/config/routes.rb
index 411386afc..9a8e71156 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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'
diff --git a/public/javascripts/project.js b/public/javascripts/project.js
index f9f88703d..74ce21c35 100644
--- a/public/javascripts/project.js
+++ b/public/javascripts/project.js
@@ -212,6 +212,7 @@ function regexTitle() {
}
function regexDescription() {
+ project_news_description_editor.sync();
var name = $("#news_description").val();
if (name.length == 0) {
$("#description_notice_span").text("描述不能为空");
@@ -419,7 +420,7 @@ $(function(){
cookiesave(personalized_expand_key,JSON.stringify(personalized_map));
target.toggle(timeout);
}
- $("*[nhtype='toggle4cookie']").click(function(){
+ $("*[nhtype='toggle4cookie']").live('click',function(){
personalized_click($(this),500);
});
diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css
index d6bef6524..5a6d98fbe 100644
--- a/public/stylesheets/project.css
+++ b/public/stylesheets/project.css
@@ -330,6 +330,7 @@ a:hover.st_add{ color:#ff8e15;}
.hwork_new{ color:#4c4c4c;}
.c_red{ color:#F00;}
.hwork_input{ border:1px solid #64bdd9; height:22px; width:555px; background:#fff; margin-bottom:10px; padding:5px;}
+.hwork_input_news{ border:1px solid #64bdd9; height:22px; width:594px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_input02{ border:1px solid #64bdd9; height:15px; width:120px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
.hwork_new ul li{ }
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index 6961b23c8..c8d18609f 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -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; }
diff --git a/spec/requests/homework_request_spec.rb b/spec/requests/homework_request_spec.rb
new file mode 100644
index 000000000..05733a56d
--- /dev/null
+++ b/spec/requests/homework_request_spec.rb
@@ -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