From 2ad51d7afe3878eb4fa1810eb3eca00e0aed948e Mon Sep 17 00:00:00 2001
From: z9hang
Date: Fri, 1 Aug 2014 14:08:38 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=95=E7=94=A8?=
=?UTF-8?q?=E7=9A=84=E7=95=99=E8=A8=80=E4=B8=BA=E4=B8=8D=E8=83=BD=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/memos_controller.rb | 9 ++++++++-
app/controllers/messages_controller.rb | 17 +++++++++++++++--
app/controllers/users_controller.rb | 6 ++++--
app/helpers/user_score_helper.rb | 25 +++++++++++++++++--------
app/views/memos/_reply_box.html.erb | 3 +++
app/views/memos/quote.js.erb | 4 +++-
app/views/messages/_form.html.erb | 2 ++
app/views/messages/quote.js.erb | 5 ++++-
8 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb
index 62f860a96..587b198d7 100644
--- a/app/controllers/memos_controller.rb
+++ b/app/controllers/memos_controller.rb
@@ -9,6 +9,7 @@ class MemosController < ApplicationController
helper :attachments
include AttachmentsHelper
+ include ApplicationHelper
layout 'base_memos'
@@ -19,6 +20,11 @@ class MemosController < ApplicationController
@content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)}
"
@content << @memo.content.to_s.strip.gsub(%r{((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "\n\n
"
@content = "" << @content
+ #@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
+ #@content << @memo.content.to_s.strip.gsub(%r{((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
+ #@content_html = textilizable(@content)
+ @temp = Memo.new
+ @temp.content = @content
end
def new
@@ -34,12 +40,13 @@ class MemosController < ApplicationController
end
def create
+ @quote = params[:quote][:quote]
@memo = Memo.new(params[:memo])
@memo.forum_id = params[:forum_id]
@memo.author_id = User.current.id
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
-
+ @memo.content = @quote + @memo.content
respond_to do |format|
if @memo.save
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index b364440c9..451e04d3d 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MessagesController < ApplicationController
+ include ApplicationHelper
menu_item :boards
default_search_scope :messages
before_filter :find_board, :only => [:new, :preview,:edit]
@@ -80,10 +81,12 @@ class MessagesController < ApplicationController
if params[:reply][:content] == ""
(redirect_to board_message_path(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
end
+ @quote = params[:quote][:quote]
@reply = Message.new
@reply.author = User.current
@reply.board = @board
@reply.safe_attributes = params[:reply]
+ @reply.content = @quote + @reply.content
@topic.children << @reply
#@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record?
@@ -143,8 +146,18 @@ class MessagesController < ApplicationController
@subject = @message.subject
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
- @content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
- @content << @message.content.to_s.strip.gsub(%r{((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
+ #@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
+ #@temp = Message.new
+ ##@temp.content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}> "
+ #@content << @message.content.to_s.strip.gsub(%r{((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
+ #@content_html = textilizable(@content)
+ #@temp.content = @content_html
+ @content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)}
"
+ @content << @message.content.to_s.strip.gsub(%r{((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "
\n\n
"
+ @content = "" << @content
+ @temp = Message.new
+ @temp.content = @content
+
end
def preview
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 7220f3ccb..cba7784bc 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -41,7 +41,7 @@ class UsersController < ApplicationController
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index]
before_filter :auth_user_extension, only: :show
- #before_filter :rest_user_score, only: :show
+ before_filter :rest_user_score, only: :show
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
#william
@@ -794,7 +794,9 @@ class UsersController < ApplicationController
praise_num(@user)
changeset_num(@user)
document_num(@user)
-
+ attachment_num(@user)
+ issue_done_ratio_num(@user)
+ post_issue_num(@user)
end
#验证是否显示课程
diff --git a/app/helpers/user_score_helper.rb b/app/helpers/user_score_helper.rb
index ba055ddf4..de7b2d6ec 100644
--- a/app/helpers/user_score_helper.rb
+++ b/app/helpers/user_score_helper.rb
@@ -600,7 +600,7 @@ module UserScoreHelper
end
def praise_num(user,project=nil)
- if project.nil?
+ if !project.nil?
pts = PraiseTread.where("praise_tread_object_type = 'Issue' || praise_tread_object_type = 'Message' and praise_or_tread = 1").all
result = []
result1 = []
@@ -674,7 +674,7 @@ module UserScoreHelper
update_score(option_number)
end
- def document_num(user,project=nil?)
+ def document_num(user,project=nil)
if project.nil?
Document.includes(:user).where("user_id = '#{user.id}'").all.count
else
@@ -689,14 +689,13 @@ module UserScoreHelper
option_number.attachment = Attachment.includes(:author).where("author_id = '#{user.id}'").all.count
update_score(option_number)
end
- #===================here to continue============================
+
def attachment_num(user,project=nil)
if project.nil?
- Attachment.includes(:author).where("author_id = '#{user.id}'").all.count
+ Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project'").all.count
else
Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project' and container_id = #{project.id}").all.count
end
-
end
#更新缺陷完成度次数
@@ -706,8 +705,13 @@ module UserScoreHelper
update_score(option_number)
end
- def issue_done_ratio_num(user,project)
- Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
+ def issue_done_ratio_num(user,project=nil)
+ if project.nil?
+ Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
+ else
+ Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
+ end
+
end
#更新发布缺陷次数
@@ -718,6 +722,11 @@ module UserScoreHelper
end
def post_issue_num(user,project=nil)
- Issue.includes(:author).where("author_id = '#{user.id}'").all.count
+ if project.nil?
+ Issue.includes(:author).where("author_id = '#{user.id}'").all.count
+ else
+ Issue.includes(:author).where("author_id = '#{user.id}' and project_id = '#{project.id}'").all.count
+ end
+
end
end
diff --git a/app/views/memos/_reply_box.html.erb b/app/views/memos/_reply_box.html.erb
index e0c6acf13..18cfa032d 100644
--- a/app/views/memos/_reply_box.html.erb
+++ b/app/views/memos/_reply_box.html.erb
@@ -2,6 +2,9 @@
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
+
+
+ <%= text_area :quote,:quote,:style => 'display:none' %>
<%= label_tag(l(:label_reply_plural)) %>:
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %>
diff --git a/app/views/memos/quote.js.erb b/app/views/memos/quote.js.erb
index 73e36ee82..a72b7ac9e 100644
--- a/app/views/memos/quote.js.erb
+++ b/app/views/memos/quote.js.erb
@@ -1,2 +1,4 @@
-ckeditor.setData("<%= raw escape_javascript(@content) %>");
+//ckeditor.setData("<%= raw escape_javascript(@content) %>");
+$('#message_quote').html("<%= raw escape_javascript(@temp.content) %>");
+$('#quote_quote').html("<%= raw escape_javascript(@content) %>");
showAndScrollTo("new_memo", "cke_editor01");
\ No newline at end of file
diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb
index c7c557f9a..4208d3061 100644
--- a/app/views/messages/_form.html.erb
+++ b/app/views/messages/_form.html.erb
@@ -32,7 +32,9 @@
<%= f.select :board_id, boards_options_for_select(@message.course.boards) %>
<% end %>
<% end %>
+
+ <%= text_area :quote,:quote,:style => 'display:none' %>
<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %>
<%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %>
diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb
index fe4bed91a..f8ec37d75 100644
--- a/app/views/messages/quote.js.erb
+++ b/app/views/messages/quote.js.erb
@@ -1,4 +1,7 @@
$('#message_subject').val("<%= raw escape_javascript(@subject) %>");
-$('#message_content').val("<%= raw escape_javascript(@content) %>");
+$('#message_quote').html("<%= raw escape_javascript(@temp.content) %>");
+//$('#message_content').val("<#%= raw escape_javascript(@content) %>");
+$('#quote_quote').html("<%= raw escape_javascript(@content) %>");
+
showAndScrollTo("reply", "message_content");
$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight;
From 2505cb30c49bab53bb1eadce116c9955aa3ddef2 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Fri, 1 Aug 2014 14:31:51 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E8=B4=B4=E5=90=A7=E6=8F=8F=E8=BF=B0?=
=?UTF-8?q?=E4=B8=8D=E6=8D=A2=E8=A1=8C=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/themes/redpenny-master/stylesheets/application.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css
index 3a6c53223..7f9aca109 100644
--- a/public/themes/redpenny-master/stylesheets/application.css
+++ b/public/themes/redpenny-master/stylesheets/application.css
@@ -489,6 +489,7 @@ color: #000000;
margin-bottom: 30px;
border-right:1px solid #C6E9F1;
overflow:auto;
+ word-wrap:break-word;
/*by young*/
-moz-box-shadow:#C6E9F1 1px 1px 2px;
-webkit-box-shadow:2px 2px 0px -2px #C6E9F1;
From 087105ad9e009ece275d897f8ce52fbdf22b3385 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Fri, 1 Aug 2014 14:55:25 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E8=B4=B4=E5=90=A7=E9=95=BF=E4=B8=B2?=
=?UTF-8?q?=E6=95=B0=E5=AD=97=E4=B8=8D=E6=8D=A2=E8=A1=8C=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/themes/redpenny-master/stylesheets/application.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css
index 7f9aca109..0f8113054 100644
--- a/public/themes/redpenny-master/stylesheets/application.css
+++ b/public/themes/redpenny-master/stylesheets/application.css
@@ -904,6 +904,7 @@ hr
p
{
font-size: 13px;
+ word-break: break-all;
/*position: static;/*gcm*/
}
/*end*/
From 54a246b6e6f73c6b974ed3c2e5fea0dfb50a6d89 Mon Sep 17 00:00:00 2001
From: linhk <304431313@qq.com>
Date: Fri, 1 Aug 2014 15:46:05 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E4=B8=AD=E5=9B=BD=E9=AB=98=E6=A0=A1?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=96=87=E6=9C=ACEnter=E5=BF=AB=E6=8D=B7?=
=?UTF-8?q?=E6=93=8D=E4=BD=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/school/index.html.erb | 8 ++-
db/schema.rb | 97 +++++++++++++++++++++++++++------
2 files changed, 87 insertions(+), 18 deletions(-)
diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb
index 47ac3f968..6c1eafd6d 100644
--- a/app/views/school/index.html.erb
+++ b/app/views/school/index.html.erb
@@ -71,6 +71,12 @@
})
}
+
+ function word_keydown(e){
+ if(e&& e.keyCode==13){
+ ssearch();
+ }
+ }
@@ -85,7 +91,7 @@
请选择省份:
-
+
diff --git a/db/schema.rb b/db/schema.rb
index 72e6ccba9..7643adb4b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -177,6 +177,58 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
+ create_table "code_review_assignments", :force => true do |t|
+ t.integer "issue_id"
+ t.integer "change_id"
+ t.integer "attachment_id"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.string "action_type"
+ t.integer "changeset_id"
+ end
+
+ create_table "code_review_project_settings", :force => true do |t|
+ t.integer "project_id"
+ t.integer "tracker_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "updated_by"
+ t.boolean "hide_code_review_tab", :default => false
+ t.integer "auto_relation", :default => 1
+ t.integer "assignment_tracker_id"
+ t.text "auto_assign"
+ t.integer "lock_version", :default => 0, :null => false
+ t.boolean "tracker_in_review_dialog", :default => false
+ end
+
+ create_table "code_review_user_settings", :force => true do |t|
+ t.integer "user_id", :default => 0, :null => false
+ t.integer "mail_notification", :default => 0, :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "code_reviews", :force => true do |t|
+ t.integer "project_id"
+ t.integer "change_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "line"
+ t.integer "updated_by_id"
+ t.integer "lock_version", :default => 0, :null => false
+ t.integer "status_changed_from"
+ t.integer "status_changed_to"
+ t.integer "issue_id"
+ t.string "action_type"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.integer "attachment_id"
+ t.integer "file_count", :default => 0, :null => false
+ t.boolean "diff_all"
+ end
+
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false
@@ -367,9 +419,9 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
t.string "web_title"
t.string "title"
t.text "description"
- t.string "page_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.string "page_type"
t.integer "sort_type"
t.integer "image_width", :default => 107
t.integer "image_height", :default => 63
@@ -795,18 +847,18 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
create_table "relative_memos", :force => true do |t|
t.integer "osp_id"
t.integer "parent_id"
- t.string "subject", :null => false
- t.text "content", :null => false
+ t.string "subject", :null => false
+ t.text "content", :limit => 16777215, :null => false
t.integer "author_id"
- t.integer "replies_count", :default => 0
+ t.integer "replies_count", :default => 0
t.integer "last_reply_id"
- t.boolean "lock", :default => false
- t.boolean "sticky", :default => false
- t.boolean "is_quote", :default => false
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "viewed_count_crawl", :default => 0
- t.integer "viewed_count_local", :default => 0
+ t.boolean "lock", :default => false
+ t.boolean "sticky", :default => false
+ t.boolean "is_quote", :default => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "viewed_count_crawl", :default => 0
+ t.integer "viewed_count_local", :default => 0
t.string "url"
t.string "username"
t.string "userhomeurl"
@@ -830,6 +882,19 @@ ActiveRecord::Schema.define(:version => 20140730024419) 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
@@ -880,10 +945,11 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
t.string "url"
t.string "title"
t.integer "share_type"
- 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.integer "project_id"
t.integer "user_id"
+ t.string "description"
end
create_table "softapplications", :force => true do |t|
@@ -989,8 +1055,8 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
- t.integer "identity"
t.string "technical_title"
+ t.integer "identity"
t.string "student_id"
t.string "teacher_realname"
t.string "student_realname"
@@ -1048,9 +1114,6 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
t.integer "active"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
- t.integer "level"
- t.integer "file"
- t.integer "issue"
end
create_table "user_statuses", :force => true do |t|