From 39434766e3cd18ae9cf964af15d8307ab96ae2b8 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 10 Jul 2014 16:35:53 +0800
Subject: [PATCH 1/8] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E8=B6=85=E7=BA=A7?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=97=A0=E6=B3=95=E8=AE=BF=E9=97=AE?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E7=9A=84?=
=?UTF-8?q?BUG=202.=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A=E6=8F=8F=E8=BF=B0?=
=?UTF-8?q?=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/bids_controller.rb | 2 +-
app/models/course.rb | 3 ++-
app/views/courses/_course.html.erb | 8 ++++++--
app/views/courses/index.html.erb | 2 ++
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index a728ee6e2..b9f9245c8 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -449,7 +449,7 @@ class BidsController < ApplicationController
# 显示作业课程
# add by nwb
def show_courseEx
- if (User.current.logged? && User.current.member_of_course?(@bid.courses.first))
+ if (User.current.logged? && (User.current.member_of_course?(@bid.courses.first) || User.current.admin?))
# flash[:notice] = ""
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
diff --git a/app/models/course.rb b/app/models/course.rb
index 5034ab0d8..bac28e4c2 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -92,7 +92,8 @@ class Course < ActiveRecord::Base
# 课程的短描述信息
def short_description(length = 255)
- description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ description.gsub(/<\/?.*?>/,"").strip if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end
def extra_frozen?
diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb
index ef8f37566..6b720229a 100644
--- a/app/views/courses/_course.html.erb
+++ b/app/views/courses/_course.html.erb
@@ -16,7 +16,7 @@
<%= content_tag('span', "#{l(:label_institution_name)}:", :class => "course-font")%>
<% @admin = @course.course_infos%>
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
-
+
<% unless @course.teacher.user_extensions.school.nil? %>
<%= link_to @course.teacher.user_extensions.school.try(:name), school_course_list_path(@course.teacher.user_extensions.school) %>
<% end %>
@@ -28,7 +28,7 @@
<%= content_tag('a', @admin.collect{|u| link_to(u.user.lastname+u.user.firstname, user_path(u.user_id))}.join(", ").html_safe) %>
<% end %>
-
+
@@ -76,6 +76,10 @@
<%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
+ <%# desc = course.short_description.nil? ? "" : course.short_description%>
+
<%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb
index db94cf6c5..0586262e9 100644
--- a/app/views/courses/index.html.erb
+++ b/app/views/courses/index.html.erb
@@ -35,6 +35,8 @@
<%if @courses%>
<%= render_course_hierarchy(@courses)%>
+ <%#= render :partial => 'course', :locals => {:course => @courses.first}%>
+ <%#= "
hello".html_safe %>
<%end%>
From 47ad20421e3fbe9c481e1fc9290863e230550c0d Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 10 Jul 2014 16:48:13 +0800
Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E8=AF=BE?=
=?UTF-8?q?=E7=A8=8B=E6=8F=8F=E8=BF=B0=E4=B8=AD=E6=9C=89=E7=89=B9=E6=AE=8A?=
=?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=98=AF=EF=BC=8C=E8=AF=BE=E7=A8=8B=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E6=8F=8F=E8=BF=B0=E6=98=BE=E7=A4=BA=E6=9C=89=E8=AF=AF?=
=?UTF-8?q?=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/course.rb | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/app/models/course.rb b/app/models/course.rb
index bac28e4c2..7db789a7a 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -92,10 +92,21 @@ class Course < ActiveRecord::Base
# 课程的短描述信息
def short_description(length = 255)
- description.gsub(/<\/?.*?>/,"").strip if description
+ description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end
+ def strip_html(html)
+ return html if html.empty? || !html.include?('<')
+ output = ""
+ tokenizer = HTML::Tokenizer.new(html)
+ while token = tokenizer.next
+ node = HTML::Node.parse(nil, 0, 0, token, false)
+ output += token unless (node.kind_of? HTML::Tag) or (token =~ /^
Date: Thu, 10 Jul 2014 16:57:04 +0800
Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AA=E4=BA=BA?=
=?UTF-8?q?=E4=B8=BB=E9=A1=B5=E4=B8=AD=E4=BD=9C=E4=B8=9A=E3=80=81=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=E4=BB=8B=E7=BB=8D=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?=
=?UTF-8?q?BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/open_source_project.rb | 3 ++-
app/models/project.rb | 3 ++-
app/views/users/_course_form.html.erb | 2 +-
app/views/users/user_projects.html.erb | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/app/models/open_source_project.rb b/app/models/open_source_project.rb
index e3556ce55..2de5966bb 100644
--- a/app/models/open_source_project.rb
+++ b/app/models/open_source_project.rb
@@ -84,7 +84,8 @@ class OpenSourceProject < ActiveRecord::Base
# end
def short_description(length = 255)
- description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ description.gsub(/<\/?.*?>/,"").html_safe if description
end
def applied_by?(user)
diff --git a/app/models/project.rb b/app/models/project.rb
index 5efaf10ab..4bd1f2774 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -623,7 +623,8 @@ class Project < ActiveRecord::Base
# Returns a short description of the projects (first lines)
def short_description(length = 255)
- description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ description.gsub(/<\/?.*?>/,"").html_safe if description
end
def css_classes
diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb
index f5cada9a8..4d9c58392 100644
--- a/app/views/users/_course_form.html.erb
+++ b/app/views/users/_course_form.html.erb
@@ -32,7 +32,7 @@
- <%= membership.course.description %>
+ <%= membership.course.short_description %>
|
diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb
index e16700cd1..66ddcaae2 100644
--- a/app/views/users/user_projects.html.erb
+++ b/app/views/users/user_projects.html.erb
@@ -30,7 +30,7 @@
- <%= membership.project.description%>
+ <%= membership.project.short_description%>
|
From 51ef3fa5a18799f34f0d3e398ac936014bafb520 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 10 Jul 2014 16:58:57 +0800
Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=BB=E9=A1=B5?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BB=8B=E7=BB=8D=E6=98=BE=E7=A4=BA=E6=9C=89?=
=?UTF-8?q?=E8=AF=AF=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/welcome/index.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index 345f47739..890155915 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -65,7 +65,7 @@
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
- ><%=project.description.truncate(50, omission: '...')%>
+ ><%=project.short_description.truncate(50, omission: '...')%>
<% issue_count = project.issues.count %>
From bed662c2e5f77c3df15a243b7a446921d47799dc Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 10 Jul 2014 17:42:40 +0800
Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=88=97=E8=A1=A8=E6=8F=8F=E8=BF=B0=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E4=B8=8D=E6=AD=A3=E5=B8=B8=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/issue.rb | 8 ++++++++
app/views/issues/_list.html.erb | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 550e0dc5d..f47e1c6f9 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -562,6 +562,12 @@ class Issue < ActiveRecord::Base
@workflow_rule_by_attribute = result if user.nil?
result
end
+ # 缺陷的短描述信息
+ def short_description(length = 255)
+ description.gsub(/<\/?.*?>/,"").html_safe if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ end
+
private :workflow_rule_by_attribute
def done_ratio
@@ -1513,4 +1519,6 @@ class Issue < ActiveRecord::Base
def be_user_score_new_issue
UserScore.project(:post_issue, User.current,self, { issue_id: self.id })
end
+
+
end
diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb
index b36c4b57d..57d8a60cb 100644
--- a/app/views/issues/_list.html.erb
+++ b/app/views/issues/_list.html.erb
@@ -38,7 +38,7 @@
<% end -%>
@@ -51,31 +51,31 @@
<% case e.act_type %>
<% when 'JournalsForMessage' %>
<% if User.current.login == e.user.try(:login) %>
- <%# if e.user_id == act.jour.id %>
-
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%=
- link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %> |
+ <%# if e.user_id == act.jour.id %>
+
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %>
+ <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %> |
<%# else %>
<%# end %>
<% else %>
-
<%= link_to("#{e.user.name}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%=
- link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %> |
+
<%= link_to("#{e.user.name}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%=
+ link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %> |
<% end %>
-
- <%= textilizable act.notes %>
- <%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
-
- |
-
+
+ <%= textilizable act.notes %>
+ <%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
+
+ |
+
-
-
-
- <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
-
-
- |
-
+
+
+
+ <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
+
+
+ |
+
<% when 'Bid' %>
<% if act.reward_type ==3 %>
@@ -92,7 +92,7 @@
<% end %>
<% end %>
-
<%= h act.description %> |
+
<%= act.description.html_safe %> |
@@ -109,7 +109,7 @@
| <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= 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}"} %> |
<% end %>
-
<%= h act.notes %> |
+
<%= act.notes.html_safe %> |
@@ -126,7 +126,7 @@
| <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %> |
<% end %>
-
<%= h act.long_comments %> |
+
<%= act.long_comments.html_safe %> |
@@ -145,11 +145,11 @@
|
<%= h act.content.truncate(240, omission: '...') %> |
-
+ |
<%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
-
+
|
<% when 'Principal' %>
@@ -161,8 +161,8 @@
<% end %>
|
-
-
+ |
+
<%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
@@ -177,7 +177,7 @@
| <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> |
<% end %>
-
<%= h act.description %> |
+
<%= act.description.html_safe %> |
@@ -193,7 +193,7 @@
| <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %> |
<% end %>
-
<%= textilizable act.description %> |
+
<%= textilizable(act.description) %> |
@@ -251,7 +251,7 @@
- <%= link_to(h(e.user), user_path(e.user)) %>
+ | <%= link_to(h(e.user), user_path(e.user)) %>
<% if e.instance_of?(JournalsForMessage)%>
<% if e.reply_id == User.current.id%>
<%if e.jour_type == 'Bid'%>
diff --git a/app/views/users/user_activities.html.erb b/app/views/users/user_activities.html.erb
index faea90fd3..2b4cf8819 100644
--- a/app/views/users/user_activities.html.erb
+++ b/app/views/users/user_activities.html.erb
@@ -39,8 +39,9 @@
|
|
- |
+
+
<% end %>
-<% end %>
+<% end %>
<% end %>
From 9472a7eb5cd1b0e9904118bd1dbdc5a0c0829266 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 11 Jul 2014 13:41:05 +0800
Subject: [PATCH 7/8] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E6=97=B6?=
=?UTF-8?q?=E5=8F=96=E6=B6=88=E6=98=BE=E7=A4=BA=E6=88=91=E7=9A=84=E5=AD=A6?=
=?UTF-8?q?=E6=A0=A1=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/school/index.html.erb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb
index a42844ffb..8a5aa5f49 100644
--- a/app/views/school/index.html.erb
+++ b/app/views/school/index.html.erb
@@ -71,7 +71,9 @@