1.格式化代码

2.修复进入其他人个人动态页面显示的名字仍是"我"的BUG #1251
解决方案:增加访问用户ID和当前登录Id是不是一致的判断
This commit is contained in:
sw 2014-09-16 11:11:40 +08:00
parent 1b97361ec6
commit 8530abf769
1 changed files with 319 additions and 173 deletions

View File

@ -1,4 +1,4 @@
<% if User.current.id == @user.id %>
<% if User.current.id == @user.id %>
<div class="menu-div">
<div class="menu">
<span style="color: #000; font-weight: bold;"><%= "#{@user.name}的动态" %></span>
@ -9,7 +9,6 @@
</ul>
</div>
<script type="text/javascript">
</script>
</div>
<div style="height:20px"></div>
@ -27,9 +26,9 @@
</table>
</div>
<% end %>
<% end %>
<% end %>
<% unless @state == 2 %>
<% unless @state == 2 %>
<% unless @activity.empty? %>
<div id="activity">
<% @activity.each do |e| %>
@ -47,15 +46,27 @@
<% when 'JournalsForMessage' %>
<tr>
<td colspan="2" valign="top">
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_have_feedback) %>
<%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span>
<% if User.current.login == e.user.try(:login) %>
<strong>
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
</strong>
&nbsp;
<% else %>
<strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong>
<% end %>
<span class="font_lighter">
<%= l(:label_have_feedback) %>
<%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %>
</span>
</td>
</tr>
<tr>
<td colspan="2" width="580">
<p class="font_description"> <%= textAreailizable act.notes %> </p>
<div style="display: inline-block; float: right; margin-top: 0px">
<span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %></span>
<span>
<%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
</span>
</div>
</td>
</tr>
@ -70,14 +81,42 @@
<% when 'Bid' %>
<tr>
<% if act.reward_type == 3 && @show_course == 1%>
<% 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_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
<strong>
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
</strong>
<span class="font_lighter">
<%= l(:label_i_new_activity) %>
</span>
<%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
</td>
<% else %>
<td colspan="2" valign="top">
<strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
<strong>
<%= link_to(h(e.user), user_path(e.user_id)) %>
</strong>&nbsp;
<span class="font_lighter">
<%= l(:label_new_activity) %>
</span>&nbsp;
<%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
</td>
<% end %>
<% else %>
<% 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_i_new_activity) %></span>
<%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
</td>
<% else %>
<td colspan="2" valign="top">
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;
<%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
</td>
<% end %>
<% end %>
</tr>
<tr>
<td colspan="2" width="580">
@ -89,15 +128,30 @@
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
</div>
<div style="display: inline-block; float: right; margin-top: 0px">
<span><%= link_to l(:label_find_all_comments), respond_path(e.act_id) %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.commit) %></a>
<span><%= link_to l(:label_find_all_comments), respond_path(e.act_id) %></span>
<a class="font_lighter"><%= l(:label_comments_count, :count => e.act.commit) %></a>
</div>
</td>
</tr>
<% when 'Journal' %>
<tr>
<% if e.user == User.current %>
<td colspan="2" valign="top">
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.id)) %> <%= 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}"} %>
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;
<%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.id)) %>
<%= 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 %>
<td colspan="2" valign="top">
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;
<%= link_to(l(:label_activity_project)+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 %>
</tr>
<tr>
<% if act.notes.nil? %>
@ -118,9 +172,29 @@
</tr>
<% when 'Changeset' %>
<tr>
<% if e.user == User.current %>
<td colspan="2" valign="top">
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></span>
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;
<%= link_to format_activity_title(act.title),
{:controller => 'repositories',
:action => 'revision',
:id => act.repository.project,
:repository_id => act.repository.identifier_param,
:rev => act.identifier} %>
</td>
<% else %>
<td colspan="2" valign="top">
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;
<%= link_to format_activity_title(act.title),
{:controller => 'repositories',
:action => 'revision',
:id => act.repository.project,
:repository_id => act.repository.identifier_param,
:rev => act.identifier} %>
</td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580">
@ -132,15 +206,38 @@
<span class="font_lighter"> <%= format_time(e.act.committed_on) %></span>
</div>
<div style="display: inline-block; float: right; margin-top: 0px">
<span><%= link_to l(:label_find_all_comments), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.count) %></a>
<span><%= link_to l(:label_find_all_comments),
{:controller => 'repositories',
:action => 'revision',
:id => act.repository.project,
:repository_id => act.repository.identifier_param,
:rev => act.identifier} %>
</span>
<a class="font_lighter"><%= l(:label_comments_count, :count => e.act.count) %></a>
</div>
</td>
</tr>
<% when 'Message' %>
<tr>
<% if e.user == User.current %>
<td colspan="2" valign="top">
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %>
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;
<%= link_to format_activity_title("#{act.board.name}: #{act.subject}"),
{:controller => 'messages',
:action => 'show',
:board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %>
</td>
<% else %>
<td colspan="2" valign="top">
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;
<%= link_to format_activity_title("#{act.board.name}: #{act.subject}"),
{:controller => 'messages',
:action => 'show',
:board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %>
</td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580">
@ -157,9 +254,17 @@
</tr>
<% when 'Principal' %>
<tr>
<% if e.user == User.current %>
<td colspan="2" valign="top">
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_user) %></span>
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_new_user) %></span>
</td>
<% else %>
<td colspan="2" valign="top">
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_new_user) %></span>
</td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580"><p class="font_description"></p></td>
@ -174,9 +279,19 @@
</tr>
<% when 'News' %>
<tr>
<% if e.user == User.current %>
<td colspan="2" valign="top">
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;
<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
</td>
<% else %>
<td colspan="2" valign="top">
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;
<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
</td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580">
@ -188,12 +303,18 @@
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
</div>
<div style="display: inline-block; float: right; margin-top: 0px">
<span><%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.comments_count) %></a>
<span>
<%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} %>
</span>
<a class="font_lighter">
<%= l(:label_comments_count, :count => e.act.comments_count) %>
</a>
</div>
</td>
</tr>
<% when 'Issue' %>
<tr>
<% if e.user == User.current %>
<td colspan="2" valign="top">
<strong>
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
@ -201,8 +322,25 @@
<span class="font_lighter">
<%= l(:label_i_new_activity) %>
</span>&nbsp;
<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %>
<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"),
{:controller => 'issues',
:action => 'show',
:id => act.id} %>
</td>
<% else %>
<td colspan="2" valign="top">
<strong>
<%= link_to(h(e.user), user_path(e.user_id)) %>
</strong>&nbsp;
<span class="font_lighter">
<%= l(:label_new_activity) %>
</span>&nbsp;
<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"),
{:controller => 'issues',
:action => 'show',
:id => act.id} %>
</td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580" style="WORD-BREAK: break-all; WORD-WRAP: break-word">
@ -215,15 +353,26 @@
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
</div>
<div style="display: inline-block; float: right; margin-top: 0px">
<span><%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.journals.count) %></a>
<span><%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %></span>
<a class="font_lighter"><%= l(:label_comments_count, :count => e.act.journals.count) %></a>
</div>
</td>
</tr>
<% when 'Contest' %>
<tr>
<% if e.user == User.current && @show_contest == 1%>
<td colspan="2" valign="top">
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;
<%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
</td>
<% else %>
<td colspan="2" valign="top">
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;
<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;
<%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
</td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580"><p class="font_description"> <%= textAreailizable act, :description %> </p>
@ -236,16 +385,13 @@
</div>
</tr>
<% else %>
<%# f=1 %>
<% end %><!-- < % #case end %> -->
</table>
</td>
</tr>
</table>
<% end %>
<% end %><!-- < % #unless act.nil? end %> -->
<% end %><!-- < % #@activity.each do |e| end%> -->
</div>
<div class="pagination" style="float:left;">
@ -261,7 +407,7 @@
<% end %>
<% end %><!-- < %# unless @activity.empty? end %> -->
<% else %>
<% else %>
<% unless @message.empty? %>
<div id="activity">
<% @message.each do |e| -%>
@ -319,8 +465,8 @@
<% end %>
<% end %>
<script type="text/javascript" language="javascript">
<% end %>
<script type="text/javascript" language="javascript">
$(document).ready(function ($) {
$("#content .menu-div:first~ div").first().find("a").attr("target", "_blank");
$('[mode=all]').click(function (event) {
@ -333,4 +479,4 @@
window.location.href = '<%=user_url(@user, type: 2)%>';
});
});
</script>
</script>