socialforge/app/views/users/show.html.erb

260 lines
16 KiB
Plaintext
Raw Normal View History

2013-09-12 10:41:15 +08:00
<% if User.current.id == @user.id%>
2013-11-09 09:26:02 +08:00
<%= show_activity @state%>
<%= form_tag(:controller => 'users', :action => "show") do %>
2014-04-25 16:30:21 +08:00
<div class="user-search-block hidden" style="float:right;margin-top:-55px">
2013-11-09 09:26:02 +08:00
<table width="100%" valign="center">
<tr>
2013-12-16 18:37:03 +08:00
<td align="right">
<div class="project-search">
<%= text_field_tag 'user', params[:user], :size => 30 %>
<%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
</div>
</td>
2013-11-09 09:26:02 +08:00
</tr>
</table>
</div>
<% end %>
2013-12-16 18:37:03 +08:00
<% end %>
<% unless @state == 2%>
2013-11-09 09:26:02 +08:00
<% unless @activity.empty? %>
2013-12-16 18:37:03 +08:00
<div id="activity">
<% @activity.each do |e| %>
2014-04-04 15:58:25 +08:00
<%# 以下一行代码解决有未知的活动无法转换成Model报错%>
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next; ) if e.act_type.safe_constantize.nil? %>
2013-12-16 18:37:03 +08:00
<% act = e.act %>
<% unless act.nil? %>
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
<td>
<table width="580" border="0" class="info-break">
<% case e.act_type %>
<% when 'JournalsForMessage' %>
<% if User.current.login == @user.login %>
2014-03-07 16:49:45 +08:00
<%# if e.user_id == act.jour.id %>
2014-03-13 22:06:49 +08:00
<tr><td colspan="2" valign="top"><strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter">有了<%= link_to("#{e.act.user.name}", user_path(e.user.id))%>的留言</span></td></tr>
2014-03-07 16:49:45 +08:00
<%# else %>
2014-03-13 22:06:49 +08:00
<!-- <tr><td colspan="2" valign="top" class="font_lighter"><strong><%#= link_to("#{e.user.name}", user_path(e.user_id)) %> 给 <%#= link_to("#{act.at_user.name if act.at_user}", user_path(act.jour.id)) %> 留言了</strong>&nbsp;</td></tr> -->
2014-03-07 16:49:45 +08:00
<%# end %>
2013-12-16 18:37:03 +08:00
<% else %>
2014-03-13 22:06:49 +08:00
<tr><td colspan="2" valign="top"><strong><%= link_to("#{@user.name}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter">有了新的动态</span></td></tr>
<% end %>
2013-12-16 18:37:03 +08:00
<tr> <td colspan="2" width="580" > <p class="font_description"> <%=textilizable act.notes %> </p></td> </tr>
<tr> <td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<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"></div>
</td>
</tr>
<% when 'Bid' %>
<tr>
<% if act.reward_type ==3 %>
<% 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) %></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_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 %>
2013-12-16 18:37:03 +08:00
</tr>
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.description %> </p></td> </tr>
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<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></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.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>
2013-11-07 17:21:32 +08:00
<% else %>
2013-12-16 18:37:03 +08:00
<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>
2013-11-07 17:21:32 +08:00
<% end %>
2013-12-16 18:37:03 +08:00
</tr>
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.notes %> </p></td> </tr>
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<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"></div>
</td>
</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></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" > <p class="font_description"> <%= h act.long_comments %> </p></td> </tr>
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<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></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}"}) %></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>
2014-03-31 15:36:51 +08:00
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.content.truncate(240, omission: '...') %> </p></td> </tr>
2013-12-16 18:37:03 +08:00
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<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"></div>
</td>
</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></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> </tr>
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<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"></div>
</td>
</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} %></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" > <p class="font_description"> <%= h act.description %> </p></td> </tr>
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<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></div></td>
</tr>
<% when 'Issue' %>
<tr>
<% if e.user == User.current%>
2014-03-28 14:55:34 +08:00
<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.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
2013-12-16 18:37:03 +08:00
<% else %>
2014-03-28 14:55:34 +08:00
<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>
2013-12-16 18:37:03 +08:00
<% end %>
</tr>
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= textilizable act.description %> </p></td> </tr>
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
<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></div>
</td>
</tr>
<% end %><!-- < % #case end %> -->
</table>
</td>
</tr>
</table>
<% end %><!-- < % #unless act.nil? end %> -->
<% end %><!-- < % #@activity.each do |e| end%> -->
</div>
<div class="pagination" style="float:left;">
<ul> <%= pagination_links_full @activity_pages %> </ul>
</div>
<% else %> <!-- < %# unless @activity.empty? %> -->
<% if @user == User.current %>
<%= l(:label_user_activities) %>
<% else %>
<p class="font_description">
<%= l(:label_user_activities_other) %>
</p>
<% end %>
<% end %><!-- < %# unless @activity.empty? end %> -->
2013-09-12 10:41:15 +08:00
<% else %>
2013-12-16 18:37:03 +08:00
<% unless @message.empty? %>
<div id="activity">
<% @message.each do |e| -%>
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
<td>
<table width="580" border="0">
<tr>
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user), user_path(e.user)) %></strong><span class="font_lighter">
<% if e.instance_of?(JournalsForMessage)%>
<% if e.reply_id == User.current.id%>
<%if e.jour_type == 'Bid'%>
<%= l(:label_in_bids)%><%= link_to(e.jour.name, respond_path(e.jour))%>&nbsp;<%= l(:label_quote_my_words) %>
2014-03-07 16:49:45 +08:00
<% elsif e.jour_type == 'User' %>
2013-12-16 18:37:03 +08:00
<%= l(:label_in_users)%><%= link_to(e.jour.firstname, feedback_path(e.jour))%>&nbsp;<%= l(:label_quote_my_words) %>
2014-03-07 16:49:45 +08:00
<% elsif e.jour_type == 'Project' %>
<%= '在'<<l(:field_project)%><%= link_to(e.jour.name, feedback_path(e.jour))%>&nbsp;<%= l(:label_reply_plural) %>
2013-12-16 18:37:03 +08:00
<% end %>
2013-09-12 10:41:15 +08:00
<% else %>
2013-12-16 18:37:03 +08:00
<%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id))%>&nbsp;<%= l(:label_have_respond) %>
2013-09-12 10:41:15 +08:00
<% end %>
<% else %>
2013-12-16 18:37:03 +08:00
<% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %>
<%= l(:label_about_issue) %><%= link_to(e.issue.subject, issue_path(e.journalized_id))%><%= l(:label_have_respond) %>
2013-09-12 10:41:15 +08:00
2013-12-16 18:37:03 +08:00
<% else %>
<%= l(:label_in_issues)%><%= link_to(e.issue.subject, issue_path(e.issue))%><%= l(:label_quote_my_words) %>
<% end %>
<% end %> </span>
</td>
</tr>
<tr>
<td colspan="2" width="580" > <p class="font_description"> <%= textilizable e.notes %> </p></td>
</tr>
<tr>
<td align="left"><a class="font_lighter"></a></td>
<td width="200" align="right" class="a"><span class="font_lighter"><%= format_time e.created_on %></span></td>
</tr>
</table>
</td>
</tr>
</table>
<% end %>
</div>
<div class="pagination" style="float:left;">
<ul> <%= pagination_links_full @info_pages %> <ul>
</div>
<% else %>
<p class="font_description"><%= l(:label_no_user_respond_you) %></p>
2013-09-12 10:41:15 +08:00
<% end %>
<% end %>
2014-03-07 11:28:52 +08:00
<script type="text/javascript" language="javascript">
$(document).ready(function($) {
2014-03-28 14:55:34 +08:00
$("#content .pagination:first~ div").first().find("a").attr("target", "_blank");
2014-03-07 11:28:52 +08:00
});
</script>