添加留言删除前身份确认,修改活动列表中问题部分的显示,添加了项目信息

This commit is contained in:
fanqiang 2013-08-28 15:29:18 +08:00
parent 7fbe7f4de6
commit b4b4956ab7
5 changed files with 19 additions and 11 deletions

View File

@ -107,7 +107,7 @@ class BidsController < ApplicationController
if params[:bid_message][:message].size>0 if params[:bid_message][:message].size>0
if params[:reference_content] if params[:reference_content]
message = params[:reference_content] + params[:bid_message][:message] message = params[:bid_message][:message] + "\n" + params[:reference_content]
else else
message = params[:bid_message][:message] message = params[:bid_message][:message]
end end
@ -138,8 +138,10 @@ class BidsController < ApplicationController
##删除留言 ##删除留言
def destroy def destroy
JournalsForMessage.delete_message(params[:object_id])
@user = @bid.author @user = @bid.author
if User.current.admin? || User.current.id == @user.id
JournalsForMessage.delete_message(params[:object_id])
end
@jours = @bid.journals_for_messages.reverse @jours = @bid.journals_for_messages.reverse
@limit = 10 @limit = 10
@feedback_count = @jours.count @feedback_count = @jours.count

View File

@ -6,7 +6,7 @@ class WordsController < ApplicationController
if params[:new_form][:user_message].size>0 if params[:new_form][:user_message].size>0
unless params[:user_id].nil? unless params[:user_id].nil?
if params[:reference_content] if params[:reference_content]
message = params[:reference_content] + params[:new_form][:user_message] message = params[:new_form][:user_message] + "\n" + params[:reference_content]
else else
message = params[:new_form][:user_message] message = params[:new_form][:user_message]
end end
@ -37,7 +37,9 @@ class WordsController < ApplicationController
end end
def destroy def destroy
JournalsForMessage.delete_message(params[:object_id]) if User.current.admin? || User.current.id == @user.id
JournalsForMessage.delete_message(params[:object_id])
end
@jours = @user.journals_for_messages.reverse @jours = @user.journals_for_messages.reverse
@limit = 10 @limit = 10
@feedback_count = @jours.count @feedback_count = @jours.count
@ -71,6 +73,10 @@ class WordsController < ApplicationController
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]') text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
# @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
# @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
@id = user.id @id = user.id
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404

View File

@ -202,7 +202,7 @@ class User < Principal
user = find_by_login(login) user = find_by_login(login)
if user if user
# user is already in local database # user is already in local database
return nil unless user.active? #return nil unless user.active?
return nil unless user.check_password?(password) return nil unless user.check_password?(password)
else else
# user is not yet registered, try to authenticate with available sources # user is not yet registered, try to authenticate with available sources

View File

@ -34,9 +34,9 @@
<% when 'Journal' %> <% when 'Journal' %>
<tr> <tr>
<% if e.user == User.current%> <% if e.user == User.current%>
<td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td> <td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span><%= link_to("项目:"+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
<% else %> <% else %>
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user), user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td> <td colspan="2" valign="top"><strong> <%= link_to(h(e.user), user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span><%= link_to("项目:"+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
<% end %> <% end %>
</tr> </tr>
<tr> <tr>
@ -119,9 +119,9 @@
<% when 'Issue' %> <% when 'Issue' %>
<tr> <tr>
<% if e.user == User.current%> <% if e.user == User.current%>
<td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td> <td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span><%= link_to("项目:"+act.project.name, project_path(act.project.identifier))%> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
<% else %> <% else %>
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user), user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td> <td colspan="2" valign="top"><strong> <%= link_to(h(e.user), user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span><%= link_to("项目:"+act.project.name, project_path(act.project.identifier))%> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
<% end %> <% end %>
</tr> </tr>
<tr> <tr>

View File

@ -192,8 +192,8 @@ software development and software crowdsourcing.</td></tr>
</tr> </tr>
<tr> <tr>
<td rowspan="2" align="left"><%=link_to image_tag(url_to_avatar(User.current), :class => 'avatar'), user_path(User.current) %></td> <td rowspan="2" align="left"><%=link_to image_tag(url_to_avatar(User.current), :class => 'avatar'), user_path(User.current) %></td>
<td><%= l(:label_user_watcher) %> (<strong class="font_small_watch"><%= link_to User.watched_by(User.current).count, user_path(User.current) %></strong>)&nbsp <td><strong class="font_small_watch"><%= link_to l(:label_user_watcher)+"("+User.watched_by(User.current).count.to_s+")", user_path(User.current) %></strong>&nbsp
<%= l(:label_user_fans) %>(<strong class="font_small_watch"><%=link_to User.current.watcher_users(User.current.id).count, user_path(User.current) %></strong>)</td> <strong class="font_small_watch"><%=link_to l(:label_user_fans)+"("+User.current.watcher_users(User.current.id).count.to_s+")", user_path(User.current) %></strong></td>
</tr> </tr>
<tr> <tr>
<td><% unless User.current.memberships.empty? %> <td><% unless User.current.memberships.empty? %>