为解决完:

1、user_message_system附件显示问题
2、issue回复添加附件问题
This commit is contained in:
huang 2015-12-31 17:08:27 +08:00
parent 74afabd571
commit 0541294c33
11 changed files with 82 additions and 15 deletions

View File

@ -137,6 +137,7 @@ class IssuesController < ApplicationController
end
end
# end
@jour_reply = Journal.new
@journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
@journals.each_with_index {|j,i| j.indice = i+1}
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
@ -153,6 +154,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
@journal = Journal.new(:journalized => @issue)
respond_to do |format|
format.html {
@ -401,6 +403,7 @@ class IssuesController < ApplicationController
jour.user_id = User.current.id
jour.notes = params[:notes]
jour.journalized = @issue
jour.save_attachments(params[:attachments])
jour.save
user_activity = UserActivity.where("act_type='Issue' and act_id =#{@issue.id}").first
user_activity.updated_at = jour.created_on

View File

@ -1,4 +1,5 @@
class SystemMessagesController < ApplicationController
# before_filter :message_author, :only => [:show]
#
# def message_author
@ -41,6 +42,7 @@ class SystemMessagesController < ApplicationController
@system_messages.description = params[:system_message][:description]
@system_messages.subject = params[:system_message][:subject]
@system_messages.user_id = User.current.id
@system_messages.save_attachments(params[:attachments])
respond_to do |format|
if @system_messages.save
format.html {redirect_to user_system_messages_path(User.current)}

View File

@ -55,6 +55,7 @@ class UsersController < ApplicationController
before_filter :recorded_visitor, :only => [:show,:user_fanslist,:user_watchlist,:user_visitorlist]
helper :sort
helper :attachments
include SortHelper
helper :custom_fields
include CustomFieldsHelper
@ -63,6 +64,7 @@ class UsersController < ApplicationController
include GitlabHelper
include UserScoreHelper
include PollHelper
helper :user_score
helper :journals

View File

@ -31,9 +31,8 @@ class Journal < ActiveRecord::Base
#has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy 评论不应该算入
# 被ForgeMessage虚拟关联
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy
has_many :at_messages, as: :at_message, dependent: :destroy
acts_as_attachable
attr_accessor :indice
acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.project_index}#{status}: #{o.issue.subject}" },
@ -46,8 +45,8 @@ class Journal < ActiveRecord::Base
acts_as_activity_provider :type => 'issues',
:author_key => :user_id,
:find_options => {:include => [{:issue => :project}, :details, :user],
:conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" +
" (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"}
:conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" +
"(#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"}
before_create :split_private_notes

View File

@ -7,6 +7,7 @@ class SystemMessage < ActiveRecord::Base
validates_length_of :description, maximum: 10000
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
acts_as_attachable
# 系统消息放置总消息列表
after_create :add_system_message

View File

@ -19,6 +19,15 @@
<div>
<p id="content_notice_span" class="ml55"></p>
</div>
<div class="mt10">
<div class="fl" id="topic_attachments">
<%= render :partial => 'attachments/form', :locals => {:container => @admin_messages} %>
</div>
</div>
<div class="cl"></div>
<div class="actions">
<%= link_to l(:label_submit), "javascript:void(0)", :class => "btn_message_free", :onclick => "system_message_editor.sync();submit_message();" %>
</div>

View File

@ -0,0 +1,31 @@
<span class="add_attachment">
<a href="javascript:void(0);" class="AnnexBtn fl" style= "<%= ie8? ? 'display:none' : ''%>" :onclick=>"$('#_file').click();">上传附件</a>
<%= file_field_tag 'attachments[dummy][file]',
:id => "_file",
:class => 'file_selector',
:multiple => true,
:onchange => "addInputFiles_board(this, '#{container.id}');",
:style => 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js'),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all),
:lebel_file_uploding => l(:lebel_file_uploding)} %>
<% if container.nil? %>
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded) %></span>
<% end %>
</span>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>

View File

@ -1,3 +1,4 @@
<style type="text/css">
div.talk_new .ke-container{margin-left:2px;}
.break_word {width:100%;}

View File

@ -27,6 +27,10 @@
<% end %>
<P><%= reply.notes.html_safe %></P>
</div>
<% if reply.attachments.any? %>
<a href="javascript:void(0)" class="link_img fl"><%= link_to_attachment_project reply, :thumbnails => true %></a><br/>
<div class="cl"></div>
<% end %>
<div style="margin-top: 7px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
@ -61,17 +65,21 @@
</div>
<div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= @issue.id%>' style="display:none;">
<%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f|%>
<div nhname='new_message_<%= @issue.id %>' style="display:none;">
<%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f| %>
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
<!--<div class="cl"></div>-->
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
<div nhname='toolbar_container_<%= @issue.id%>' ></div>
<div nhname='toolbar_container_<%= @issue.id %>' ></div>
<div class="cl"></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id%>' name="notes"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id %>' name="notes"></textarea>
<div class="cl"></div>
<span nhname='contentmsg_<%= @issue.id%>' class="fl"></span>
<a id="new_message_submit_btn_<%= @issue.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="mt10 fl">
<%= render :partial => 'attachments/form_course', :locals => {:container => @issue} %>
</div>
<div class="cl"></div>
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></span>
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<% end %>
</div>

View File

@ -1,9 +1,9 @@
<% if @issue_id%> //issue详情中回复
<% if @issue_id %> //issue详情中回复
$("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)')
sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
sd_create_editor_from_data(<%= @issue.id %>, null, "100%");
<%else%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity');
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%");
<%end %>

View File

@ -18,7 +18,18 @@
</p>
</div>
<div class="cl"></div>
<p class="homepagePostDeadline">发布时间:<%= format_time(system_message.created_at) %></p>
<% if system_message.attachments.any? %>
<div class=" fl" style="width: 600px">
<% if system_message.attachments.any?%>
<%# options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %>
<%= link_to_attachment_project system_message, :thumbnails => false %>
<%#= link_to_attachments_course system_message, :author => false %>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<p class="homepagePostDeadline">发布时间:<%= format_time(system_message.created_at) %></p>
</div>
<div class="cl"></div>
</div>