Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop

This commit is contained in:
wanglinchun 2013-12-30 16:28:04 +08:00
commit 80f40cd1c0
12 changed files with 130 additions and 61 deletions

View File

@ -77,7 +77,10 @@ module WelcomeHelper
when 'news' , 'issue', 'message' , 'bid' , 'wiki-page' , 'document'
str << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ':&nbsp;'.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url, :target => "_blank" )
when 'reply' ,'Reply', 'Memo'
str << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ':&nbsp;'.html_safe << link_to(truncate(strip_tags(event.event_description), length: 30, omission:'...'), event.event_url, :target => "_blank" )
str << content_tag("span", "发表了") <<
content_tag("span", find_all_event_type(event)) <<
':&nbsp;'.html_safe <<
link_to(truncate(strip_tags(event.event_description).gsub(/&nbsp;/,''), length: 30, omission:'...'), event.event_url, :target => "_blank" )
when 'attachment'
str << content_tag('span', '上传了') << content_tag('span', find_all_event_type(event)) << ':&nbsp;'.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) << link_to(('&nbsp;['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container))
else
@ -109,13 +112,13 @@ module WelcomeHelper
# resultSet = Memo.where('memos.parent_id IS NULL').includes(:last_reply).order('COALESCE (last_replies_memos.created_at, memos.created_at) DESC').limit(limit)
# resultSet += Message.where('messages.parent_id IS NULL').includes(:last_reply).order('COALESCE (last_replies_messages.created_on, messages.created_on) DESC').limit(limit)
resultSet = Memo.where('parent_id IS NULL').order('updated_at DESC').limit(limit)
resultSet += Message.where('parent_id IS NULL').order('updated_on DESC').limit(limit)
# resultSet = resultSet.to_a
resultSet = Memo.includes(:children).where('parent_id IS NULL').order('updated_at DESC').limit(limit)
resultSet += Message.includes(:children).where('parent_id IS NULL').order('updated_on DESC').limit(limit)
resultSet.sort! {|x,y| y.event_datetime <=> x.event_datetime}
# for i in 0..(resultSet.size-1)
# resultSet[i] = resultSet[i].parent if resultSet[i].parent
# end
resultSet = resultSet.to_a
for i in 0..(resultSet.size-1)
resultSet[i] = resultSet[i].children.last if resultSet[i].children.count > 0
end
resultSet.take(limit)
end

View File

@ -18,15 +18,14 @@
class JournalObserver < ActiveRecord::Observer
def after_create(journal)
if journal.notify? &&
(Setting.notified_events.include?('issue_updated') ||
(Setting.notified_events.include?('issue_note_added') && journal.notes.present?) ||
(Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
(Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
(Setting.notified_events.include?('issue_updated') ||
(Setting.notified_events.include?('issue_note_added') && journal.notes.present?) ||
(Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
(Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
)
##by senluo
thread4=Thread.new do
Mailer.issue_edit(journal).deliver
end
Thread.new do
Mailer.issue_edit(journal).deliver
end
end
end
end

View File

@ -1,9 +1,9 @@
# Added by young
class JournalsForMessageObserver < ActiveRecord::Observer
def after_create(journals_for_message)
thread4=Thread.new do
Mailer.journals_for_message_add(User.current, journals_for_message).deliver
end
end
def after_create(journals_for_message)
Thread.new do
Mailer.journals_for_message_add(User.current, journals_for_message).deliver
end
end
end

View File

@ -1,5 +1,9 @@
<%= form_tag({:controller => 'projects', :action => 'project_respond'}) do %>
<%= text_area_tag 'project_respond', "", :class => 'noline', :required => true, :style => "resize: none;", :rows => 6, :placeholder => l(:label_projects_feedback_respond_content) %>
<%= text_area_tag 'project_respond', "",
:class => 'noline', :required => true,
:style => "resize: none;", :rows => 6,
:placeholder => l(:label_projects_feedback_respond_content),
:maxlength => 250 %>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "bid_btn"%>

View File

@ -74,7 +74,11 @@
$('#' + id).val('');
}
}
$(function(){
$("a").attr("target", "_blank");
});
function showInfo(id, content) {
var text = $('#' + id);
if (text.val() == '') {
@ -90,16 +94,14 @@
</style>
<%= stylesheet_link_tag 'welcome' %>
<div class="body_resize">
<div class="left" style="float: left; height: 445px; width: 50%; margin-left: 30px;">
<ul class="welcome-message-list" style="width: 90%; ">
<div class="forum-topic" style="height: 25px;">
<h3 style="color: rgb(21, 188, 207);margin-left: 8px;"><strong>贴吧动态</strong></h3>
<div class="left" style="float: left; min-height: 470px; width: 48%;">
<ul class="welcome-message-list">
<div class="forum-topic" style="height: 25px; width: 98%; margin-left: 6px;">
<h3 style="color: rgb(21, 188, 207);"><strong>贴吧动态</strong></h3>
<span style="margin-top: -30px;float: right; display: block;"><%= link_to "更多>>", forums_path, :target => "_blank" %></span>
</div>
<div class="welcome-box-list-new">
<% find_new_forum_topics(8).each do |topic|%>
<li class="message-brief-intro" style="min-height: 25px;padding-bottom:3px;">
@ -108,11 +110,11 @@
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;", :target => "_blank" %>
</span>
<br>
<span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;"><%=time_tag_welcome(topic_last_time topic)%>前</span>
<span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span>
<span style="margin-left: 8px; margin-bottom: 0px; color: rgb(172, 174, 177) !important; white-space: nowrap;">
由&nbsp;<%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);", :target => "_blank" %>&nbsp;发表
</span>
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;">回复(<%= link_to topic.replies_count, topic.event_url, :target => "_blank" %>)</span>
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;">回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url, :target => "_blank" %>)</span>
</div>
</li>
<% end %>
@ -120,9 +122,9 @@
</ul>
</div>
<div class="right" style="float: right; margin-right: 10px; height: 445px; width: 45%; ">
<ul class="user-welcome-message-list" style="width: 94%; margin-top: 0px;">
<h3 style="margin-left: -5px; color: rgb(21, 188, 207)"><strong>用户动态</strong></h3>
<div class="right" style="float: right; min-height: 470px; width: 48%; ">
<ul class="user-welcome-message-list">
<h3 style="color: rgb(21, 188, 207)"><strong>用户动态</strong></h3>
<span style="margin-top: -30px;float: right; display: block;"><%= link_to "更多>>", { :controller => 'users', :action => 'index'}, :target => "_blank" %></span>
<div class="user-message-box-list">
<% find_all_activities.each do |event| %>
@ -139,7 +141,7 @@
</div>
</ul>
</div>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3 style="margin-left: 5px; color: #e8770d;"><strong>热门项目</strong></h3>

View File

@ -2,6 +2,6 @@
<% id = "journal_reply_ul_" + journal.id.to_s%>
<ul class="messages-for-user-reply" id = '<%= id %>' >
<% fetch_user_leaveWord_reply(journal).each do |reply|%>
<%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply.id} %>
<%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply} %>
<% end %>
</ul>

View File

@ -1,21 +1,20 @@
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
<li id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
<span class="portrait">
<%= image_tag url_to_avatar(reply.user), :class => "avatar-3" %>
<%= image_tag url_to_avatar(reply.user), :class => "avatar-3" %>
</span>
<div class="body">
<% id = 'project_respond_form_'+ reply.id.to_s %>
<span><%= link_to reply.user.name, user_path(reply.user) %>:&nbsp;</span>
<span class="message-notes"> <%= reply.notes %></span>
<%# ids = 'project_respond_form_'+ journal.id.to_s%>
<div class="message-body">
<% id = 'project_respond_form_'+ reply.id.to_s %>
<p>
<span><%= link_to reply.user.name, user_path(reply.user) %>:&nbsp;</span>
<span class="message-notes"> <%= reply.notes %></span>
</p>
<p>
<span class="time"><%= format_time reply.created_on %></span>
<span style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}: '); return false;"}
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), '#{l(:label_reply_plural)} #{m_reply_id.user.show_name}: '); return false;"}
%>
<% if @user == User.current || User.current.admin? || reply.user.id == User.current.id %>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>

View File

@ -1,4 +1,40 @@
<script>
var W3CDOM = document.createElement && document.getElementsByTagName;
window.onload = setMaxLength;
function setMaxLength() {
if (!W3CDOM) return;
var textareas = document.getElementsByTagName('textarea');
for (var i=0;i<textareas.length;i++) {
var textarea = textareas[i];
setMaxLengthItem(textareas[i]);
}
}
function setMaxLengthItem(textarea){
if (textarea.getAttribute('maxlength')) {
var counter = document.createElement('div');
counter.className = 'counter';
var counterClone = counter.cloneNode(true);
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');
textarea.parentNode.insertBefore(counterClone,textarea.nextSibling);
textarea.relatedElement = counterClone.getElementsByTagName('span')[0];
textarea.onkeyup = textarea.onchange = checkMaxLength;
textarea.onkeyup();
}
}
function checkMaxLength() {
var maxLength = this.getAttribute('maxlength');
var currentLength = this.value.length;
if (currentLength > maxLength)
this.relatedElement.className = 'toomuch';
else
this.relatedElement.className = '';
this.relatedElement.firstChild.nodeValue = currentLength;
}
</script>
<% if jour.size >0 %>
<% remove_allowed = (User.current.id == jour.first.user_id) %>
<ul class="message-for-user">
@ -30,13 +66,14 @@
</span>
<div style="clear: both;"></div>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal.id} %>
</div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
</div>
</li>
<% end %>
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
</div>
</li>
<% end %>
</ul>
<% end %>

View File

@ -1,9 +1,13 @@
<%= form_tag({:controller => 'words', :action => 'create_reply'}, :remote => true) do %>
<%= text_area_tag 'user_notes', "", :class => 'noline', :style => "resize: none;", :rows => 4, :placeholder => l(:label_projects_feedback_respond_content) %>
<%= text_area_tag 'user_notes', "", :class => 'noline',
:style => "resize: none;", :rows => 4,
:placeholder => l(:label_projects_feedback_respond_content),
:maxlength => 250 %>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => journal.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id %>
<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "enterprise", :style => "margin-top: 1px;"%>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;"%>
<% end %>

View File

@ -1,12 +1,14 @@
<% if @save_succ %>
var pre_append = $('<%= j(
render :partial => "words/journal_reply_items",
:locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm.id}
:locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm}
) %>').hide();
$('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append);
pre_append.fadeIn(600);
$('#project_respond_form_<%=@jfm.m_reply_id.to_s%> textarea').val('');
var textarea = $('#project_respond_form_<%=@jfm.m_reply_id.to_s%> textarea');
textarea.val('');
$('#project_respond_form_<%=@jfm.m_reply_id.to_s%>').hide();
setMaxLengthItem(pre_append.find('textarea')[0]);
<% else %>
alert("<%= l(:label_feedback_fail) %>");
<% end %>

View File

@ -87,9 +87,13 @@ ul.welcome-message-list{
.welcome-message-list h3, .user-welcome-message-list h3 {
border-bottom: 1.5px solid rgb(21, 165, 200);
padding: 2px;
margin-left: 10px;
/*margin-left: 10px;*/
font-size: 16px;
}
.user-message-box-list {
margin-left: 6px;
}
/*鍚勭鍒楄〃鏄剧ず*/
.d-p-index-box{
/*border: 1px solid #e6e6e6;*/
@ -159,6 +163,7 @@ li {
margin: 0px;
padding: 0px;
background-color: rgb(252, 252, 252);
margin-top: 6px;
}
.d-p-index-newsource li,.d-p-index-hotproject ul.d-p-projectlist li{
color: rgb(102, 102, 102);

View File

@ -2125,7 +2125,7 @@ ul.messages-for-user-reply li {
display: none;
width: 87%;
margin: auto;
clear:both;
clear: both;
}
.outer-message-for-use p {
@ -2134,10 +2134,24 @@ ul.messages-for-user-reply li {
margin-top: 5px;
}
.body p {
.message-body p {
margin: 0;
padding: 0;
margin-top: 4px;
margin-left: 4px;
font-size: 9pt;
}
.message-body {
margin: 0;
padding: 0;
margin-left: 40px;
}
.counter {
float: left;
}
.toomuch {
color: red;
}