From 332bc0765d999d5d55b160596d656d3b92b29344 Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 16 Oct 2013 21:10:30 +0800 Subject: [PATCH] 240 characters or less limited in activity info. ===> projects#show --- app/helpers/application_helper.rb | 4 ++ app/views/projects/show.html.erb | 115 ++++++++++++++++-------------- 2 files changed, 66 insertions(+), 53 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e2ebfe36..8b9e469f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1398,4 +1398,8 @@ module ApplicationHelper user.watcher_users.count end #end + #author : nyan + def stringCut240(str) + (str.length > 240) ? (str[0,240]<<"\n......") : str + end end diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 3ab6302d..903ad70f 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,57 +1,66 @@ -<% if @events_by_day.size >0 %> -
-

<%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %>

-

- <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %> -

-
- <% @events_by_day.keys.sort.reverse.each do |day| %> -

-
- <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> -
- - - - - -
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%> - - - - - - - - - - <% if e.event_type == "issue" %> - - <% end %> - -
<%= h(e.project) if @project.nil? || @project.id != e.project.id %> - <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> <%= l(:label_new_activity) %> - - <%= link_to format_activity_title(e.event_title), e.event_url %> -

<%= textilizable(e.event_description) %>

- <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> - <%= link_to l(:label_find_all_comments), issue_path(e) %> - <%= l(:label_comments_count, :count => e.journals.count)%>
+

+ <% if @events_by_day.size >0 %> +

+

<%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %>

+

+ <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %> +

+
+ <% @events_by_day.keys.sort.reverse.each do |day| %> +

+
+ <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> +
+ + + + + +
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%> + + + + + + + + + + <% if e.event_type == "issue" %> + + <% end %> + +
<%= h(e.project) if @project.nil? || @project.id != e.project.id %> <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title(e.event_title), e.event_url %>
+

+ + <%= textilizable( stringCut240(e.event_description) ) %> +

<%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> <%= link_to l(:label_find_all_comments), issue_path(e) %> <%= l(:label_comments_count, :count => e.journals.count)%>
+
+ <% end %> +
+ <% end -%> +
- <% end -%>
- <% end -%> - -
-
-<% else %> + <% else %>

-
<%=link_to image_tag(url_to_avatar(@user), :class => "avatar"), user_path(@user)%> - - -
<%=link_to (h @user.lastname+@user.firstname), user_path(@user) %> <%= l(:label_user_create_project) %> <%=link_to @project.name %> !
<%= format_time(@project.created_on) %>

+ + + + + +
<%= link_to image_tag(url_to_avatar(@user), :class => "avatar"), user_path(@user)%> + + + + + +
<%= link_to (h @user.lastname+@user.firstname), user_path(@user) %> <%= l(:label_user_create_project) %> <%= link_to @project.name %> !
<%= format_time(@project.created_on) %> +
+

<% end %> +

\ No newline at end of file