From f3a15ce313692cc438a7969136bec00829fa5c90 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Tue, 26 May 2015 23:09:10 +0800
Subject: [PATCH 01/14] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=80=A7=E8=83=BD?=
=?UTF-8?q?=E5=88=86=E6=9E=90=20oneapm?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Gemfile | 4 ++
config/oneapm.yml | 135 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 139 insertions(+)
create mode 100644 config/oneapm.yml
diff --git a/Gemfile b/Gemfile
index fbe74f8dd..a43efbaeb 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,6 +6,10 @@ unless RUBY_PLATFORM =~ /w32/
gem 'iconv'
end
+source 'http://rubygems.oneapm.com' do
+ gem 'oneapm_rpm'
+end
+
gem "mysql2", "= 0.3.18"
gem 'redis-rails'
gem 'rubyzip'
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)
From 9ce1916fbb3f309e2045e2e15f02372fb7eb8f81 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Tue, 26 May 2015 23:10:08 +0800
Subject: [PATCH 02/14] =?UTF-8?q?autologin=20token=20cookies=20domain?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/account_controller.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 7976e1aa4..75be302cd 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -336,6 +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',
:httponly => true
}
cookies[autologin_cookie_name] = cookie_options
From 3fa5179026e83a57aa18c957d36e45ff13556026 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Tue, 26 May 2015 23:11:10 +0800
Subject: [PATCH 03/14] =?UTF-8?q?issue=E6=95=B0=E7=BB=9F=E8=AE=A1=E6=8B=96?=
=?UTF-8?q?=E6=85=A2=E6=80=A7=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/projects/_development_group.html.erb | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb
index 676761831..726e9646f 100644
--- a/app/views/projects/_development_group.html.erb
+++ b/app/views/projects/_development_group.html.erb
@@ -8,9 +8,10 @@
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
- <% unless @project.issues.visible.all.count == 0 %>
-
(<%= @project.issues.visible.all.count %>)
+ <% if (issue_count = @project.issues.count) > 0 %>
+
(<%= issue_count %>)
<% end %>
+
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
<% end %>
@@ -49,4 +50,4 @@
<%= l(:label_project_more) %>
<%= render 'projects/tools_expand' %>
-
\ No newline at end of file
+
From 1919292c583388ffef1fe3f43229471b8a629916 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 27 May 2015 09:23:48 +0800
Subject: [PATCH 04/14] =?UTF-8?q?=E8=BF=98=E6=98=AFissues=20count=E8=AE=A1?=
=?UTF-8?q?=E7=AE=97=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/projects/_research_team.html.erb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/views/projects/_research_team.html.erb b/app/views/projects/_research_team.html.erb
index b2b0e3c33..8bd32a98e 100644
--- a/app/views/projects/_research_team.html.erb
+++ b/app/views/projects/_research_team.html.erb
@@ -8,8 +8,8 @@
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
- <% unless @project.issues.count == 0 %>
-
(<%= @project.issues.visible.all.count %>)
+ <% if (issue_count = @project.issues.count) > 0 %>
+
(<%= issue_count %>)
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
@@ -37,4 +37,4 @@
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
<% end %>
-<% end%>
\ No newline at end of file
+<% end%>
From 5af284e8a47cac37226b35e2cb4fc8c1bf1762b6 Mon Sep 17 00:00:00 2001
From: huang
Date: Wed, 27 May 2015 10:43:03 +0800
Subject: [PATCH 05/14] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/issues_controller.rb | 2 +-
app/views/layouts/base_projects.html.erb | 115 +++++++++---------
.../projects/_development_group.html.erb | 1 -
app/views/projects/_friend_group.html.erb | 1 -
app/views/projects/_research_team.html.erb | 1 -
5 files changed, 56 insertions(+), 64 deletions(-)
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index cadff5f15..539d84e65 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -130,7 +130,7 @@ class IssuesController < ApplicationController
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
- respond_to do |format|
+ respond_to do |format|``
format.html {
retrieve_previous_and_next_issue_ids
render :template => 'issues/show', :layout => @project_base_tag#by young
diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb
index 43861d99a..87ceeaf9a 100644
--- a/app/views/layouts/base_projects.html.erb
+++ b/app/views/layouts/base_projects.html.erb
@@ -18,54 +18,7 @@
<%= yield :header_tags -%>
-
-
@@ -83,13 +36,7 @@
<%= l(:label_user_location) %> :
- <%= link_to l(:field_homepage), home_path %>
- >
-
- <%=l(:label_project_hosting_platform) %>
-
- >
- <%= link_to @project.name, project_path(@project.id) %>
+ <%= link_to l(:field_homepage), home_path %> > <%=l(:label_project_hosting_platform) %> ><%= link_to @project.name, project_path(@project.id) %>
@@ -144,10 +91,11 @@
<%= l(:label_member) %>(<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %>)
|
<%= l(:label_user_watcher) %>(<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>)
+ <% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
<%= l(:project_module_attachments) %>(
- <% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
+ <% attaments_num %>
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %>)
<% end %>
@@ -166,14 +114,14 @@
<% end %>
-
+ <%#--project_new_type: 1为开发组;2为科研组;3为朋友圈子--%>
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
- <%= render :partial => 'projects/development_group', :locals => {:project => @project}%>
+ <%= render :partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
<% elsif @project.project_new_type == 2 %>
- <%= render :partial => 'projects/research_team', :locals => {:project => @project}%>
+ <%= render :partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num} %>
<% else %>
- <%= render :partial => 'projects/friend_group', :locals => {:project => @project}%>
+ <%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
<% end %>
@@ -232,8 +180,55 @@
id="friend_organization"/> 圈子模式:为朋友圈提供简洁的交流和分享工具。
确定
-
+
+
123
<%= render :partial => 'layouts/new_feedback' %>
diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb
index 726e9646f..d4bc7012a 100644
--- a/app/views/projects/_development_group.html.erb
+++ b/app/views/projects/_development_group.html.erb
@@ -1,4 +1,3 @@
-<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
diff --git a/app/views/projects/_friend_group.html.erb b/app/views/projects/_friend_group.html.erb
index dca5473f7..03df67b0e 100644
--- a/app/views/projects/_friend_group.html.erb
+++ b/app/views/projects/_friend_group.html.erb
@@ -1,4 +1,3 @@
-<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
diff --git a/app/views/projects/_research_team.html.erb b/app/views/projects/_research_team.html.erb
index 8bd32a98e..6dc27a2fb 100644
--- a/app/views/projects/_research_team.html.erb
+++ b/app/views/projects/_research_team.html.erb
@@ -1,4 +1,3 @@
-<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
From f770702d0bf16e3ca4f15ed9e021aa9e93f3b194 Mon Sep 17 00:00:00 2001
From: huang
Date: Wed, 27 May 2015 11:08:05 +0800
Subject: [PATCH 06/14] =?UTF-8?q?issue=E7=BC=96=E8=BE=91=E6=97=B6=E5=80=99?=
=?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=93=85=E7=AC=94=E5=9B=BE=E6=A0=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/issues/_form.html.erb | 6 +++---
app/views/issues/show.html.erb | 6 ------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb
index fb087a47c..27ac07d64 100644
--- a/app/views/issues/_form.html.erb
+++ b/app/views/issues/_form.html.erb
@@ -51,8 +51,8 @@
<% if @issue.safe_attribute? 'description' %>
描述 :
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
- <%= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
- <%= content_tag 'span', :id => "issue_description_and_toolbar" do %>
+ <%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
+ <%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor",
# :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
# :accesskey => accesskey(:edit),
@@ -60,7 +60,7 @@
:width=>'87%',
:resizeType => 0,
:no_label => true %>
- <% end %>
+ <%# end %>
<%#= wikitoolbar_for 'issue_description' %>
<% end %>
diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb
index 88bbb4a71..26d79d4e8 100644
--- a/app/views/issues/show.html.erb
+++ b/app/views/issues/show.html.erb
@@ -124,18 +124,12 @@
<%= render :partial => 'changesets', :locals => {:changesets => @changesets} %>
<% end %>
-
-
-
-
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%= f.link_to 'PDF' %>
<% end %>
-
<% content_for :sidebar do %>
<%= render :partial => 'issues/sidebar' %>
From 95f3d89afa9896d091d5d5603611940b0b09470d Mon Sep 17 00:00:00 2001
From: huang
Date: Wed, 27 May 2015 14:45:36 +0800
Subject: [PATCH 07/14] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=96=E8=BE=91=E5=99=A8=EF=BC=9A=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E9=A1=B5=E9=9D=A2=E3=80=81=E5=88=97=E8=A1=A8=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E6=96=B0=E6=A0=B7=E5=BC=8F=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/issues/_form.html.erb | 14 ++++++------
app/views/news/_project_form.html.erb | 33 +++++++++++++++++----------
app/views/news/_project_news.html.erb | 2 +-
public/javascripts/project.js | 1 +
public/stylesheets/project.css | 1 +
5 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb
index 27ac07d64..41fca87eb 100644
--- a/app/views/issues/_form.html.erb
+++ b/app/views/issues/_form.html.erb
@@ -53,13 +53,13 @@
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
<%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
<%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
- <%= f.kindeditor :description,:editor_id => "issue_desc_editor",
- # :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
- # :accesskey => accesskey(:edit),
- # :class => "w583",
- :width=>'87%',
- :resizeType => 0,
- :no_label => true %>
+ <%= f.kindeditor :description,:editor_id => "issue_desc_editor",
+ # :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
+ # :accesskey => accesskey(:edit),
+ # :class => "w583",
+ :width=>'87%',
+ :resizeType => 0,
+ :no_label => true %>
<%# end %>
<%#= wikitoolbar_for 'issue_description' %>
<% end %>
diff --git a/app/views/news/_project_form.html.erb b/app/views/news/_project_form.html.erb
index 37f11d3f0..33613e5a7 100644
--- a/app/views/news/_project_form.html.erb
+++ b/app/views/news/_project_form.html.erb
@@ -1,26 +1,35 @@
-
+<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
+
* <%= l(:field_title) %> :
-
+
-
- * <%= l(:field_description) %> :
-
-
+
+ <% if is_new %>
+ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
+ * <%= l(:field_description) %> :
+ <%= f.kindeditor :description,:width=>'91%',:editor_id=>'project_news_description_editor' %>
+
+ <% else %>
+ * <%= l(:field_description) %> :
+ <%= f.kindeditor :description,:width=>'91%', :editor_id=>'project_news_description_editor', :owner_id => @news.id, :owner_type => OwnerTypeHelper::NEWS %>
+
+ <% end %>
+
-
- <%= l(:label_attachment_plural) %> :
+
+ <%= l(:label_attachment_plural) %> :
<%= render :partial => 'attachments/new_form', :locals => {:container => @news} %>
-
+
<% if is_new %>
- <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
+ <%= link_to l(:button_create), "javascript:void(0)", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), project_news_index_path(@project), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
<% else %>
- <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
- <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %>
+ <%= link_to l(:button_save), "javascript:void(0)", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
+ <%= link_to l(:button_cancel), news_path(@news), :class => 'blue_btn grey_btn fl c_white' %>
<% end %>
diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb
index 75b51ab6c..7b6a16e38 100644
--- a/app/views/news/_project_news.html.erb
+++ b/app/views/news/_project_news.html.erb
@@ -29,7 +29,7 @@
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<%= l(:label_add_news) %>: <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
- <%= news.description %>
+ <%=textAreailizable news.description %>
<%= l(:label_create_time) %> :<%= format_time(news.created_on) %>
diff --git a/public/javascripts/project.js b/public/javascripts/project.js
index f9f88703d..e30c08b43 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("描述不能为空");
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{ }
From 04c54d4f6ee9a751210b432aecbd1a5322a4f72c Mon Sep 17 00:00:00 2001
From: huang
Date: Wed, 27 May 2015 14:50:09 +0800
Subject: [PATCH 08/14] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=A1=B5=E9=9D=A2=E6=97=B6=E9=97=B4=E5=92=8C?=
=?UTF-8?q?=E9=99=84=E4=BB=B6=E6=8D=A2=E4=BD=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/news/_project_show.html.erb | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb
index 9d598f0b5..f95192d64 100644
--- a/app/views/news/_project_show.html.erb
+++ b/app/views/news/_project_show.html.erb
@@ -82,8 +82,9 @@
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %>
<%= delete_link news_path(@news),:class => 'talk_edit fr' if User.current.allowed_to?(:manage_news, @project) %>
- <%= textAreailizable(@news, :description) %> <%= l(:label_create_time) %> : <%= format_time(@news.created_on) %>
- <%= link_to_attachments_course @news %>
+ <%= textAreailizable(@news, :description) %>
+ <%= link_to_attachments_course @news %>
+ <%= l(:label_create_time) %> : <%= format_time(@news.created_on) %>
From df5c040aab9d389a5d75d81568fd6b8558593818 Mon Sep 17 00:00:00 2001
From: huang
Date: Wed, 27 May 2015 16:00:11 +0800
Subject: [PATCH 09/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AEissue?=
=?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/issues/_action_menu.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb
index a5823ede3..2643c93e7 100644
--- a/app/views/issues/_action_menu.html.erb
+++ b/app/views/issues/_action_menu.html.erb
@@ -1,6 +1,6 @@
<%#= watcher_link_issue(@issue, User.current) %>
-<%#= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %>
+<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'talk_edit fr' if User.current.allowed_to?(:add_issues, @project) %>
<%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %>
<%= link_to l(:button_edit), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("all_attributes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
<%= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %>
From 47e3e93a2f65b81ca9dccd1431089cf9f71d8111 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 27 May 2015 19:37:46 +0800
Subject: [PATCH 10/14] =?UTF-8?q?cookies=20=E5=88=A0=E9=99=A4=E4=B9=9F?=
=?UTF-8?q?=E9=9C=80=E8=A6=81domain?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/account_controller.rb | 2 +-
app/controllers/application_controller.rb | 2 +-
config/configuration.yml | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 75be302cd..dc1cceb87 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -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
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 0dc86fb01..02b2f0d1d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -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: Redmine::Configuration['cookie_domain'])
# Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
self.logged_user = nil
end
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
From 1fe49c8cb14030fb74c8648e6a3a8c2e4bb9b4d3 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 27 May 2015 19:38:19 +0800
Subject: [PATCH 11/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/bids_controller.rb | 5 ++-
app/views/courses/homework.html.erb | 5 ++-
app/views/users/user_homeworks.html.erb | 2 +-
config/locales/en.yml | 1 +
config/locales/zh.yml | 1 +
config/routes.rb | 2 +-
spec/requests/homework_request_spec.rb | 52 +++++++++++++++++++++++++
7 files changed, 63 insertions(+), 5 deletions(-)
create mode 100644 spec/requests/homework_request_spec.rb
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index c98df27d3..35236414f 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -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
diff --git a/app/views/courses/homework.html.erb b/app/views/courses/homework.html.erb
index f7cf2a360..7b74351cd 100644
--- a/app/views/courses/homework.html.erb
+++ b/app/views/courses/homework.html.erb
@@ -21,6 +21,9 @@
<%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )
<% 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 @@
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
-
\ No newline at end of file
+
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/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/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/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
From 5279c2d3e5123abb02571f8415df99f0434194e2 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Thu, 28 May 2015 09:51:32 +0800
Subject: [PATCH 12/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=89=80=E6=9C=89?=
=?UTF-8?q?=E7=9A=84=E5=9F=9F=E7=9A=84autologin?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 02b2f0d1d..88cd51d67 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -199,7 +199,7 @@ class ApplicationController < ActionController::Base
# Logs out current user
def logout_user
if User.current.logged?
- cookies.delete(autologin_cookie_name, domain: Redmine::Configuration['cookie_domain'])
+ cookies.delete(autologin_cookie_name, domain: :all)
# Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
self.logged_user = nil
end
From e2ec7d5f3e40ad98d79c30a08f65257bd9d7ef44 Mon Sep 17 00:00:00 2001
From: huang
Date: Thu, 28 May 2015 15:45:36 +0800
Subject: [PATCH 13/14] =?UTF-8?q?QQ=E5=9C=A8=E7=BA=BF=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_base_feedback.html.erb | 6 ++++--
app/views/layouts/_new_feedback.html.erb | 7 +++----
config/locales/commons/zh.yml | 2 +-
public/stylesheets/public.css | 3 ++-
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb
index d9bd5e376..07f852914 100644
--- a/app/views/layouts/_base_feedback.html.erb
+++ b/app/views/layouts/_base_feedback.html.erb
@@ -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 %>
diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb
index 67b4af32c..3b8098ed5 100644
--- a/app/views/layouts/_new_feedback.html.erb
+++ b/app/views/layouts/_new_feedback.html.erb
@@ -22,10 +22,9 @@
<% end %>
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/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; }
From 065c196edc8c0e91ca41a4289a074ce7d369a255 Mon Sep 17 00:00:00 2001
From: yutao <283765470@qq.com>
Date: Thu, 28 May 2015 16:18:48 +0800
Subject: [PATCH 14/14] ...
---
public/javascripts/project.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/javascripts/project.js b/public/javascripts/project.js
index f9f88703d..918c438e3 100644
--- a/public/javascripts/project.js
+++ b/public/javascripts/project.js
@@ -419,7 +419,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);
});