diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 19ae17015..c2ba5b03b 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -49,4 +49,14 @@ module OrganizationsHelper # Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") end + # 从内容中获取路径 + def get_image_path_from_content content + r = Regexp.new(/src="\/files\/uploads\/image(.+?)"/) + if r.match(content).nil? + image_path = nil + else + image_path = r.match(content)[1] + end + end + end diff --git a/app/views/organizations/_org_new_forum.html.erb b/app/views/organizations/_org_new_forum.html.erb index 627d9d3ad..8ae2036cc 100644 --- a/app/views/organizations/_org_new_forum.html.erb +++ b/app/views/organizations/_org_new_forum.html.erb @@ -1,6 +1,11 @@
- + <% iamge_path = get_image_path_from_content(activity.content) %> + <% if iamge_path.nil? %> + + <% else %> + + <% end %> <%=link_to activity.content.html_safe, organization_path(organization, :org_subfield_id => field.id), :class => "con-left-txt fl" %>