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

This commit is contained in:
wanglinchun 2013-12-27 15:09:56 +08:00
commit 6ad3505b14
22 changed files with 127 additions and 75 deletions

View File

@ -57,7 +57,7 @@ class MemosController < ApplicationController
pre_count = REPLIES_PER_PAGE pre_count = REPLIES_PER_PAGE
@memo = @memo.root # 取出楼主防止输入帖子id让回复作为主贴显示 @memo = @memo.root # 取出楼主防止输入帖子id让回复作为主贴显示
@memo.update_attribute(:viewed_count, @memo.viewed_count.to_i + 1) @memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
page = params[:page] page = params[:page]
if params[:r] && page.nil? if params[:r] && page.nil?
@ -95,11 +95,12 @@ class MemosController < ApplicationController
def update def update
respond_to do |format| respond_to do |format|
if( @memo.update_attribute(:subject, params[:memo][:subject]) && if( @memo.update_column(:subject, params[:memo][:subject]) &&
@memo.update_attribute(:content, params[:memo][:content]) && @memo.update_column(:content, params[:memo][:content]) &&
@memo.update_attribute(:sticky, params[:memo][:sticky]) && @memo.update_column(:sticky, params[:memo][:sticky]) &&
@memo.update_attribute(:lock, params[:memo][:lock])) @memo.update_column(:lock, params[:memo][:lock]))
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
# @memo.root.update_attribute(:updated_at, @memo.updated_at)
format.html {redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}"} format.html {redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}"}
else else
format.html { render action: "edit" } format.html { render action: "edit" }

View File

@ -79,6 +79,7 @@ class MessagesController < ApplicationController
@reply.board = @board @reply.board = @board
@reply.safe_attributes = params[:reply] @reply.safe_attributes = params[:reply]
@topic.children << @reply @topic.children << @reply
@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record? if !@reply.new_record?
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply}) call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments]) attachments = Attachment.attach_files(@reply, params[:attachments])

View File

@ -73,10 +73,8 @@ class WordsController < ApplicationController
end end
def destroy def destroy
if User.current.admin? || User.current.id == @user.id @journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
JournalsForMessage.delete_message(params[:object_id]) @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse
end
@jours = @user.journals_for_messages.reverse
@limit = 10 @limit = 10
@feedback_count = @jours.count @feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @feedback_pages = Paginator.new @feedback_count, @limit, params['page']

View File

@ -75,13 +75,13 @@ module WelcomeHelper
str = '&nbsp;'.html_safe str = '&nbsp;'.html_safe
case event.event_type case event.event_type
when 'news' , 'issue', 'message' , 'bid' , 'wiki-page' , 'document' 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) 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' 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) 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" )
when 'attachment' 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)) 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 else
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) 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" )
end end
str str
rescue Exception => e rescue Exception => e
@ -92,9 +92,9 @@ module WelcomeHelper
str = "回复(" str = "回复("
case event.event_type case event.event_type
when "issue" when "issue"
str << link_to(cal_issues_count(event), issue_path(event)) << ")" str << link_to(cal_issues_count(event), issue_path(event), :target => "_blank" ) << ")"
when "Memo" when "Memo"
str << link_to(cal_memos_count(event), forum_memo_path(event.forum_id,event.id)) << ")" str << link_to(cal_memos_count(event), forum_memo_path(event.forum_id,event.id), :target => "_blank" ) << ")"
else else
str = "" str = ""
end end
@ -102,10 +102,21 @@ module WelcomeHelper
end end
def find_new_forum_topics limit=7 def find_new_forum_topics limit=7
Memo.where('memos.parent_id IS NULL').reorder('memos.created_at DESC').limit(limit) # Memo.where('memos.parent_id IS NULL').reorder('memos.created_at DESC').limit(limit)
# activity = Redmine::Activity::Fetcher.new(nil) # activity = Redmine::Activity::Fetcher.new(nil)
# activity.scope=['memos'] # activity.scope=['memos']
# activity.events_welcome(nil, nil, {:limit => limit}) # activity.events_welcome(nil, nil, {:limit => limit})
# 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.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.take(limit)
end end
private private
@ -135,7 +146,7 @@ module WelcomeHelper
# } # }
# user_objs = User.find_by_sql("SELECT * FROM users WHERE (users.id IN #{"(" << users.join(',') << ")"} )") # user_objs = User.find_by_sql("SELECT * FROM users WHERE (users.id IN #{"(" << users.join(',') << ")"} )")
activity = Redmine::Activity::Fetcher.new(nil) activity = Redmine::Activity::Fetcher.new(nil)
activity.scope_select{|t| ['changesets'].include?(t) ? nil : 'You may think you know what the following code does, may be. but why don"t you close this file and go play with something else, Now?' } activity.scope_select{|t| ['changesets', 'documents'].include?(t) ? nil : 'You may think you know what the following code does, may be. but why don"t you close this file and go play with something else, Now?' }
activity.events_welcome(nil, nil, {:limit => limit, :types => 'welcome'}) activity.events_welcome(nil, nil, {:limit => limit, :types => 'welcome'})
end end

View File

@ -1,6 +1,6 @@
class Forum < ActiveRecord::Base class Forum < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC" has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC", :dependent => :destroy
has_many :memos, :dependent => :destroy has_many :memos, :dependent => :destroy
belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id' belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id'
safe_attributes 'name', safe_attributes 'name',

View File

@ -20,7 +20,6 @@ class JournalsForMessage < ActiveRecord::Base
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id' belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
has_many :reply_for_journals, :dependent => :destroy
validates :notes, presence: true validates :notes, presence: true
after_create :act_as_activity #huang after_create :act_as_activity #huang
@ -30,7 +29,8 @@ class JournalsForMessage < ActiveRecord::Base
# default_scope { where('m_parent_id IS NULL') } # default_scope { where('m_parent_id IS NULL') }
def self.delete_message(message_id) def self.delete_message(message_id)
self.delete_all "id = #{message_id}" self.find(message_id).destroy
# self.destroy_all "id = #{message_id}"
end end
def reference_user def reference_user

View File

@ -17,7 +17,8 @@ class Memo < ActiveRecord::Base
# #:project_key => "#{Forum.table_name}.project_id" # #:project_key => "#{Forum.table_name}.project_id"
# :date_column => "#{table_name}.created_at" # :date_column => "#{table_name}.created_at"
acts_as_event :title => Proc.new {|o| "#{o.forum.name}: #{o.subject}"}, acts_as_event :title => Proc.new {|o| "#{o.forum.name}: #{o.subject}"},
:datetime => :created_at, :datetime => :updated_at,
# :datetime => :created_at,
:description => :content, :description => :content,
:author => :author, :author => :author,
:type => Proc.new {|o| o.parent_id.nil? ? 'Memo' : 'Reply'}, :type => Proc.new {|o| o.parent_id.nil? ? 'Memo' : 'Reply'},
@ -64,6 +65,7 @@ class Memo < ActiveRecord::Base
def reset_counters! def reset_counters!
if parent && parent.id if parent && parent.id
Memo.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id}) Memo.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
parent.update_attribute(:updated_at, Time.now)
end end
forum.reset_counters! forum.reset_counters!
end end

View File

@ -33,6 +33,7 @@ class Message < ActiveRecord::Base
:date_column => "#{table_name}.created_on" :date_column => "#{table_name}.created_on"
acts_as_event :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"}, acts_as_event :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"},
:description => :content, :description => :content,
:datetime => :updated_on,
# :datetime => "#{Message.table_name}.created_on", # :datetime => "#{Message.table_name}.created_on",
:group => :parent, :group => :parent,
:type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'}, :type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'},

View File

@ -2,7 +2,7 @@
<div id="add-memo" style="display:none;"> <div id="add-memo" style="display:none;">
<h3><%=l(:label_memo_new)%></h3> <h3><%=l(:label_memo_new)%></h3>
<% if User.current.logged? %> <% if User.current.logged? %>
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %> <%= labelled_form_for(@memo, :url => forum_memos_path(@forum), :html => {:multipart => true} ) do |f| %>
<% if @memo.errors.any? %> <% if @memo.errors.any? %>
<div id="error_explanation"> <div id="error_explanation">
<h2><%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2> <h2><%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2>

View File

@ -76,7 +76,7 @@
<% end %> <% end %>
<td class="font_index"><%=link_to "#{@project.members.count}", project_member_path(@project) %></td> <td class="font_index"><%=link_to "#{@project.members.count}", project_member_path(@project) %></td>
<td class="font_index"><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist" %></td> <td class="font_index"><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist", :id => @project %></td>
<td class="font_index"><%=link_to "#{@project.issues.count}", project_issues_path(@project) %></td> <td class="font_index"><%=link_to "#{@project.issues.count}", project_issues_path(@project) %></td>
<!-- <td class="font_index"><%=link_to files_count, project_files_path(@project) %></td> --> <!-- <td class="font_index"><%=link_to files_count, project_files_path(@project) %></td> -->
</tr> </tr>

View File

@ -21,7 +21,7 @@
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
<%= l(:label_new_activity) %> </span> <%= l(:label_new_activity) %> </span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), e.event_type.eql?("attachment") ? project_files_path(e.container) : e.event_url %> <%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -97,7 +97,7 @@
<div class="forum-topic" style="height: 25px;"> <div class="forum-topic" style="height: 25px;">
<h3 style="color: rgb(21, 188, 207);margin-left: 8px;"><strong>贴吧动态</strong></h3> <h3 style="color: rgb(21, 188, 207);margin-left: 8px;"><strong>贴吧动态</strong></h3>
<span style="margin-top: -30px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span> <span style="margin-top: -30px;float: right; display: block;"><%= link_to "更多>>", forums_path, :target => "_blank" %></span>
</div> </div>
<div class="welcome-box-list-new"> <div class="welcome-box-list-new">
@ -105,14 +105,14 @@
<li class="message-brief-intro" style="min-height: 25px;padding-bottom:3px;"> <li class="message-brief-intro" style="min-height: 25px;padding-bottom:3px;">
<div style="display: inline-block; width: 100%;"> <div style="display: inline-block; width: 100%;">
<span style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;"%> <%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;", :target => "_blank" %>
</span> </span>
<br> <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;;"><%=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;"> <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);"%>&nbsp;发表 由&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>
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size 9pt !important;;">回复(<%= link_to topic.replies_count, topic.event_url %>)</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>
</div> </div>
</li> </li>
<% end %> <% end %>
@ -123,7 +123,7 @@
<div class="right" style="float: right; margin-right: 10px; height: 445px; width: 45%; "> <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;"> <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> <h3 style="margin-left: -5px; color: rgb(21, 188, 207)"><strong>用户动态</strong></h3>
<span style="margin-top: -30px;float: right; display: block;"><%= link_to "更多>>", { :controller => 'users', :action => 'index'} %></span> <span style="margin-top: -30px;float: right; display: block;"><%= link_to "更多>>", { :controller => 'users', :action => 'index'}, :target => "_blank" %></span>
<div class="user-message-box-list"> <div class="user-message-box-list">
<% find_all_activities.each do |event| %> <% find_all_activities.each do |event| %>
<li style="display: block;height:60px; padding-bottom: 4px;"> <li style="display: block;height:60px; padding-bottom: 4px;">
@ -131,7 +131,7 @@
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %> <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
</div> </div>
<div class="inner-right" style="float: right; width:86%; height: 100%; "> <div class="inner-right" style="float: right; width:86%; height: 100%; ">
<span style="color: green;"><%= link_to event.event_author, (user_path(event.event_author) if event.event_author), :style => "color:green;" %></span><%= show_user_content event %> <span style="color: green;"><%= link_to event.event_author, (user_path(event.event_author) if event.event_author), :style => "color:green;", :target => "_blank" %></span><%= show_user_content event %>
<p style="margin-top: 4px;"><span style="color: rgb(172, 174, 177)"><%= time_tag_welcome event.event_datetime %>前</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="float: right; color: rgb(172, 174, 177);"><%= show_event_reply event %></span></p> <p style="margin-top: 4px;"><span style="color: rgb(172, 174, 177)"><%= time_tag_welcome event.event_datetime %>前</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="float: right; color: rgb(172, 174, 177);"><%= show_event_reply event %></span></p>
</div> </div>
</li> </li>
@ -143,7 +143,7 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3 style="margin-left: 5px; color: #e8770d;"><strong>热门项目</strong></h3> <h3 style="margin-left: 5px; color: #e8770d;"><strong>热门项目</strong></h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", { :controller => 'projects', :action => 'index', :project_type => 0} %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", { :controller => 'projects', :action => 'index', :project_type => 0}, :target => "_blank" %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% find_all_hot_project.map do |project| break if(project == find_all_hot_project[15]) %> <% find_all_hot_project.map do |project| break if(project == find_all_hot_project[15]) %>
@ -153,7 +153,7 @@
</div> </div>
<div style="float: left; margin-left: 10px; width: 360px;"> <div style="float: left; margin-left: 10px; width: 360px;">
<p class="layout"> <p class="layout">
<span style="display: inline-block; width: 250px;"><%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name", :title => "#{project.name}")%></span> <span style="display: inline-block; width: 250px;"><%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name", :title => "#{project.name}", :target => "_blank" )%></span>
<%= content_tag "span", show_grade(project), <%= content_tag "span", show_grade(project),
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ", :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
@ -172,7 +172,7 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h3 style="margin-left: 5px; color: #e8770d;"><strong>热门课程</strong></h3> <h3 style="margin-left: 5px; color: #e8770d;"><strong>热门课程</strong></h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :project_sort_type => 1} %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :project_sort_type => 1}, :target => "_blank" %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %> <% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %>
@ -186,8 +186,8 @@
</div> </div>
<div style="float: left; margin-left: 10px; width: 360px;"> <div style="float: left; margin-left: 10px; width: 360px;">
<p class="layout"> <p class="layout">
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%> <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}", :target => "_blank" )%>
<span style="cursor: pointer; display: inline-block; float: right; color: #ec6300; white-space: nowrap;">学生人数:<%= link_to "#{studentCount(project)}", project_member_path(project, :role => 2) ,:course =>'1'%></span> <span style="cursor: pointer; display: inline-block; float: right; color: #ec6300; white-space: nowrap;">学生人数:<%= link_to "#{studentCount(project)}", project_member_path(project, :role => 2) ,:course =>'1', :target => "_blank" %></span>
</p> </p>
<p class="layout-1" > <p class="layout-1" >
<%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %> <%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %>
@ -202,14 +202,14 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h3 style="margin-left: 5px; color: color: (51, 119, 51);"><strong>热门竞赛</strong></h3> <h3 style="margin-left: 5px; color: color: (51, 119, 51);"><strong>热门竞赛</strong></h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'bids', :action => 'contest', :project_type => 1} %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'bids', :action => 'contest', :project_type => 1}, :target => "_blank" %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %> <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
<li style="background-image:none;"> <li style="background-image:none;">
<p class="layout"> <p class="layout">
<span style = "background: url('/images/007.gif') no-repeat scroll ;background-position: left center;"><%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", <span style = "background: url('/images/007.gif') no-repeat scroll ;background-position: left center;"><%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}",
:style => "margin-left: 28px;") %></span> :style => "margin-left: 28px;", :target => "_blank") %></span>
</p> </p>
<p class="layout-1" > <p class="layout-1" >
<%= content_tag "span", contest.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => contest.description %> <%= content_tag "span", contest.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => contest.description %>
@ -222,14 +222,14 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h3 style="margin-left: 5px; color: color: (51, 119, 51);"><strong>热门众包</strong></h3> <h3 style="margin-left: 5px; color: color: (51, 119, 51);"><strong>热门众包</strong></h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'bids', :action => 'index'} %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'bids', :action => 'index'}, :target => "_blank" %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% find_all_hot_bid.map do |bid| break if(bid == find_all_hot_bid[5]) %> <% find_all_hot_bid.map do |bid| break if(bid == find_all_hot_bid[5]) %>
<li style="background-image:none;"> <li style="background-image:none;">
<p class="layout"> <p class="layout">
<span style = "background: url('/images/007.gif') no-repeat scroll ;background-position: left center;"><%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :title => "#{bid.name}", <span style = "background: url('/images/007.gif') no-repeat scroll ;background-position: left center;"><%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :title => "#{bid.name}",
:style => "margin-left: 28px;")%></span> :style => "margin-left: 28px;", :target => "_blank") %></span>
</p> </p>
<p class="layout-1" > <p class="layout-1" >
<%= content_tag "span", bid.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => bid.description %> <%= content_tag "span", bid.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => bid.description %>

View File

@ -1,6 +1,6 @@
<% id = "journal_reply_ul_" + journal.id.to_s%> <% id = "journal_reply_ul_" + journal.id.to_s%>
<ul class="messages-for-user-reply" id = <%= id %> > <ul class="messages-for-user-reply" id = '<%= id %>' >
<% fetch_user_leaveWord_reply(journal).each do |reply|%> <% 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.id} %>
<% end %> <% end %>

View File

@ -1,24 +1,30 @@
<li> <% 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"> <span class="portrait">
<%= image_tag url_to_avatar(reply.user), :class => "avatar-3" %> <%= image_tag url_to_avatar(reply.user), :class => "avatar-3" %>
</span> </span>
<div class="body"> <div class="body">
<% id = 'project_respond_form_'+ reply.id.to_s %> <% id = 'project_respond_form_'+ reply.id.to_s %>
<span><%= link_to reply.user.name, user_path(reply.user) %>:&nbsp;</span> <span><%= link_to reply.user.name, user_path(reply.user) %>:&nbsp;</span>
<span class="message-notes"> <%= reply.notes %></span> <span class="message-notes"> <%= reply.notes %></span>
<% ids = 'project_respond_form_'+ journal.id.to_s%> <%# ids = 'project_respond_form_'+ journal.id.to_s%>
<p style="margin-top: 4px; font-size: 9pt;">
<p>
<span class="time"><%= format_time reply.created_on %></span> <span class="time"><%= format_time reply.created_on %></span>
<span style="float: right;"> <span style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
<%#= toggle_link l(:label_projects_feedback_respond), id, {:focus => 'project_respond'} %> <%= link_to l(:label_projects_feedback_respond),'',
<%= 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)} #{reply.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)) %>
<% end %>
</span> </span>
</p> </p>
</div> </div>
<div id='<%=id%>' class="respond-form"> <div id='<%=id%>' class="respond-form">
<%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id} %> <%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id} %>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</li> </li>

View File

@ -3,34 +3,39 @@
<% remove_allowed = (User.current.id == jour.first.user_id) %> <% remove_allowed = (User.current.id == jour.first.user_id) %>
<ul class="message-for-user"> <ul class="message-for-user">
<% for journal in jour%> <% for journal in jour%>
<li class="outer-message-for-user"> <li id='word_li_<%=journal.id.to_s%>' class="outer-message-for-user">
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span> <span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
<span class="body"> <span class="body">
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span> <span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
<% if @user == User.current %> <% if @user == User.current %>
<span class="font_lighter"><%= l(:label_leave_me_message) %></span> <span class="font_lighter"><%= l(:label_leave_me_message) %>&nbsp;:</span>
<% else %> <% else %>
<span class="font_lighter"><%= l(:label_leave_others_message) %></span> <span class="font_lighter"><%= l(:label_leave_others_message) %>&nbsp;:</span>
<% end %> <% end %>
<span> <p>
<%= textilizable journal.notes%> <%= textilizable journal.notes%>
</span> </p>
<span class="font_lighter"> <%= l :label_comment_time %>&nbsp; <%= format_time journal.created_on %></span> <span class="font_lighter"> <%= l :label_comment_time %>&nbsp; <%= format_time journal.created_on %></span>
<% ids = 'project_respond_form_'+ journal.id.to_s%> <% ids = 'project_respond_form_'+ journal.id.to_s%>
<%#= toggle_link l(:label_projects_feedback_respond), ids, {:focus => 'project_respond'} %> <span>
<%= link_to l(:label_projects_feedback_respond),'',
<%= link_to l(:label_projects_feedback_respond),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}: '); $('##{ids} textarea') ;return false;"}
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}:'); return false;"} %>
%>
<% if @user == User.current || User.current.admin? || journal.user.id == User.current.id %>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %>
</span>
</span> </span>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<div id=<%= ids %> class="respond-form"> <div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal.id} %> <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal.id} %>
</div> </div>
<div> <div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %> <%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
</div> </div>
</li> </li>
<% end %> <% end %>
</ul> </ul>
<% end %> <% end %>

View File

@ -4,6 +4,6 @@
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= 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_user_id', params[:reference_user_id], :value => journal.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_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 => "bid_btn", :style => "margin-top: 1px;"%> <%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "enterprise", :style => "margin-top: 1px;"%>
<% end %> <% end %>

View File

@ -1,9 +1,10 @@
<% if @save_succ %> <% if @save_succ %>
$('#journal_reply_ul_<%=@jfm.m_parent_id%>').append( var pre_append = $('<%= j(
'<%= j(
render :partial => "words/journal_reply_items", 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.id}
) %>'); ) %>').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(''); $('#project_respond_form_<%=@jfm.m_reply_id.to_s%> textarea').val('');
$('#project_respond_form_<%=@jfm.m_reply_id.to_s%>').hide(); $('#project_respond_form_<%=@jfm.m_reply_id.to_s%>').hide();
<% else %> <% else %>

View File

@ -1,2 +1,11 @@
$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>'); <% if @journal_destroyed.nil? %>
$('#new_form_reference_user_id').val(""); alert('<%=l(:notice_failed_delete)%>');
<% elsif (@journal_destroyed.jour_type == 'Principal')%>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<% else %>
$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>');
$('#new_form_reference_user_id').val("");
<% end %>

View File

@ -155,6 +155,7 @@ en:
notice_successful_create: Successful creation. notice_successful_create: Successful creation.
notice_successful_update: Successful update. notice_successful_update: Successful update.
notice_successful_delete: Successful deletion. notice_successful_delete: Successful deletion.
notice_failed_delete: Successful failure.
notice_successful_connection: Successful connection. notice_successful_connection: Successful connection.
notice_file_not_found: The page you were trying to access doesn't exist or has been removed. notice_file_not_found: The page you were trying to access doesn't exist or has been removed.
notice_locking_conflict: Data has been updated by another user. notice_locking_conflict: Data has been updated by another user.

View File

@ -164,6 +164,7 @@ zh:
notice_successful_create: 创建成功 notice_successful_create: 创建成功
notice_successful_update: 更新成功 notice_successful_update: 更新成功
notice_successful_delete: 删除成功 notice_successful_delete: 删除成功
notice_failed_delete: 删除失败
notice_successful_connection: 连接成功 notice_successful_connection: 连接成功
notice_file_not_found: 您访问的页面不存在或已被删除。 notice_file_not_found: 您访问的页面不存在或已被删除。
notice_locking_conflict: 数据已被另一位用户更新 notice_locking_conflict: 数据已被另一位用户更新

View File

@ -592,7 +592,7 @@ function blockEventPropagation(event) {
function toggleAndSettingWordsVal(parent_widget, text_widget, value){ function toggleAndSettingWordsVal(parent_widget, text_widget, value){
text_widget.val(value) text_widget.val(value)
parent_widget.toggle(400) parent_widget.slideToggle(400)
} }
$(document).ready(setupAjaxIndicator); $(document).ready(setupAjaxIndicator);

View File

@ -2118,11 +2118,26 @@ span.body{
ul.messages-for-user-reply li { ul.messages-for-user-reply li {
padding-bottom: 4px; padding-bottom: 4px;
font-size: 9pt;
} }
.respond-form{ .respond-form{
display: none; display: none;
width: 100%; width: 87%;
margin: auto; margin: auto;
clear:both; clear:both;
}
.outer-message-for-use p {
margin: 0;
padding: 0;
margin-top: 5px;
}
.body p {
margin: 0;
padding: 0;
margin-top: 4px;
margin-left: 4px;
font-size: 9pt;
} }