修改引用的留言为不能修改
This commit is contained in:
parent
27feeee03f
commit
2ad51d7afe
|
@ -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)} <br/> "
|
||||
@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||
@content = "<blockquote>" << @content
|
||||
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
|
||||
#@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}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}" }
|
||||
|
|
|
@ -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{<pre>((.|\s)*?)</pre>}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{<pre>((.|\s)*?)</pre>}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)} <br/> "
|
||||
@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||
@content = "<blockquote>" << @content
|
||||
@temp = Message.new
|
||||
@temp.content = @content
|
||||
|
||||
end
|
||||
|
||||
def preview
|
||||
|
|
|
@ -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
|
||||
|
||||
#验证是否显示课程
|
||||
|
|
|
@ -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)
|
||||
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)
|
||||
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
|
||||
|
|
|
@ -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 %>
|
||||
<div id="message_quote" class="wiki"></div>
|
||||
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= label_tag(l(:label_reply_plural)) %>:
|
||||
<!-- <p> < %= f.text_area :content, :required => true, :size => "75%", :resize => "none", id: 'editor01' %> </p> -->
|
||||
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %></p>
|
||||
|
|
|
@ -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");
|
|
@ -32,7 +32,9 @@
|
|||
<%= f.select :board_id, boards_options_for_select(@message.course.boards) %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div id="message_quote" class="wiki"></div>
|
||||
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<p>
|
||||
<%= 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' %></p>
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue