From 8a0dc59f3e9c441a0cafc2710acd64a173b1ee0a Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Thu, 26 Dec 2013 19:57:40 +0800 Subject: [PATCH] welcome index helper. --- app/helpers/welcome_helper.rb | 10 +++++----- app/views/welcome/index.html.erb | 30 +++++++++++++++--------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index f862ce30..ff2801a5 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -75,13 +75,13 @@ module WelcomeHelper str = ' '.html_safe case event.event_type when 'news' , 'issue', 'message' , 'bid' , 'wiki-page' , 'document' - str << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) + str << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url, :target => "_blank" ) when 'reply' ,'Reply', 'Memo' - str << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(strip_tags(event.event_description), length: 30, omission:'...'), event.event_url) + str << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(strip_tags(event.event_description), length: 30, omission:'...'), event.event_url, :target => "_blank" ) when 'attachment' str << content_tag('span', '上传了') << content_tag('span', find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) << link_to((' ['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container)) else - str << content_tag("span", "更新了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) + str << content_tag("span", "更新了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url, :target => "_blank" ) end str rescue Exception => e @@ -92,9 +92,9 @@ module WelcomeHelper str = "回复(" case event.event_type when "issue" - str << link_to(cal_issues_count(event), issue_path(event)) << ")" + str << link_to(cal_issues_count(event), issue_path(event), :target => "_blank" ) << ")" when "Memo" - str << link_to(cal_memos_count(event), forum_memo_path(event.forum_id,event.id)) << ")" + str << link_to(cal_memos_count(event), forum_memo_path(event.forum_id,event.id), :target => "_blank" ) << ")" else str = "" end diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 32cb4316..2f027957 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -97,7 +97,7 @@

贴吧动态

- <%= link_to "更多>>", forums_path %> + <%= link_to "更多>>", forums_path, :target => "_blank" %>
@@ -105,14 +105,14 @@
  •       - <%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;"%> + <%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;", :target => "_blank" %>
    <%=time_tag_welcome(topic_last_time topic)%>前 - 由 <%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);"%> 发表 + 由 <%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);", :target => "_blank" %> 发表 - 回复(<%= link_to topic.replies_count, topic.event_url %>) + 回复(<%= link_to topic.replies_count, topic.event_url, :target => "_blank" %>)
  • <% end %> @@ -123,7 +123,7 @@

      用户动态

      - <%= link_to "更多>>", { :controller => 'users', :action => 'index'} %> + <%= link_to "更多>>", { :controller => 'users', :action => 'index'}, :target => "_blank" %>
      <% find_all_activities.each do |event| %>
    • @@ -131,7 +131,7 @@ <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
    • - <%= link_to event.event_author, (user_path(event.event_author) if event.event_author), :style => "color:green;" %><%= show_user_content event %> + <%= link_to event.event_author, (user_path(event.event_author) if event.event_author), :style => "color:green;", :target => "_blank" %><%= show_user_content event %>

      <%= time_tag_welcome event.event_datetime %>前     <%= show_event_reply event %>

      @@ -143,7 +143,7 @@

      热门项目

      - <%= link_to "更多>>", { :controller => 'projects', :action => 'index', :project_type => 0} %> + <%= link_to "更多>>", { :controller => 'projects', :action => 'index', :project_type => 0}, :target => "_blank" %>
        <% find_all_hot_project.map do |project| break if(project == find_all_hot_project[15]) %> @@ -153,7 +153,7 @@

      - <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name", :title => "#{project.name}")%> + <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name", :title => "#{project.name}", :target => "_blank" )%> <%= content_tag "span", show_grade(project), :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ", :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", @@ -172,7 +172,7 @@

      热门课程

      - <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :project_sort_type => 1} %> + <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :project_sort_type => 1}, :target => "_blank" %>
        <% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %> @@ -186,8 +186,8 @@

      - <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%> - 学生人数:<%= link_to "#{studentCount(project)}", project_member_path(project, :role => 2) ,:course =>'1'%> + <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}", :target => "_blank" )%> + 学生人数:<%= link_to "#{studentCount(project)}", project_member_path(project, :role => 2) ,:course =>'1', :target => "_blank" %>

      <%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %> @@ -202,14 +202,14 @@

      热门竞赛

      - <%= link_to "更多>>", {:controller => 'bids', :action => 'contest', :project_type => 1} %> + <%= link_to "更多>>", {:controller => 'bids', :action => 'contest', :project_type => 1}, :target => "_blank" %>
        <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
      • <%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", - :style => "margin-left: 28px;") %> + :style => "margin-left: 28px;", :target => "_blank") %>

        <%= content_tag "span", contest.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => contest.description %> @@ -222,14 +222,14 @@

        热门众包

        - <%= link_to "更多>>", {:controller => 'bids', :action => 'index'} %> + <%= link_to "更多>>", {:controller => 'bids', :action => 'index'}, :target => "_blank" %>
          <% find_all_hot_bid.map do |bid| break if(bid == find_all_hot_bid[5]) %>
        • <%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :title => "#{bid.name}", - :style => "margin-left: 28px;")%> + :style => "margin-left: 28px;", :target => "_blank") %>

          <%= content_tag "span", bid.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => bid.description %>