- <%= textilizable( truncate(e.event_description, :length => 240)) %> + <%= textilizable(truncate(e.event_description, :length => 68)) %>
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index dd2b5341a..27f487d92 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -544,7 +544,8 @@ class UsersController < ApplicationController end def watch_projects - @watch_type = Watcher.visible.where("watchable_type = ? and user_id = ?", 'Project', @user.id) + @watch_type = Watcher.where("watchable_type = ? and user_id = ?", 'Project', @user.id) + #@project = Project.visible.where("project_type < ?", 1) @watch_projects = [] unless @watch_type.nil? @watch_type.each do |obj| diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 83a4dfd19..53eeab105 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1426,4 +1426,7 @@ module ApplicationHelper def stringCut240(str) (str.length > 240) ? (str[0,240]<<"......") : str end + def truncate_at_line_break(str, length = 240) + str.gsub(%r{^(.{#{length}}[^\n]*)\n.+$}m, '\\1...') + end end diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index 0154bb682..907d21ee2 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -3,59 +3,7 @@ <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>
- - - -<% if(@project.project_type==1) %> + | |
+ <% if(@project.project_type==1) %> <% if get_avatar?(@project) %> <%= image_tag(url_to_avatar(@project), :class => "avatar2") %> <% else %> @@ -67,7 +67,7 @@ <% end %> |
- <%= @project.name %>
+ <%= @project.name %>
<%if User.current.logged? %>
<% if @course.teacher.id == User.current.id %>
diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb
index ba6483585..ae3401151 100644
--- a/app/views/layouts/base_homework.html.erb
+++ b/app/views/layouts/base_homework.html.erb
@@ -31,7 +31,7 @@
|
<%= link_to "forge.trustie.net/courses", :controller => 'projects', :action => 'course'%> | <%=link_to "主页", home_path %> > <%=link_to "实践课程", :controller => 'projects', :action => 'course' %> > - <%= link_to(@bid.courses.first.name.slice(0..6), project_path(@bid.courses.first)) %> > + <%= link_to(@bid.courses.first.name,project_path(@bid.courses.first)) %> > <%=link_to(@bid.name, respond_path(@bid))%> |
- <%= textilizable( truncate(e.event_description, :length => 240)) %> + <%= textilizable(truncate(e.event_description, :length => 68)) %>