From 25fd89862361793b0618a5add4e7dde121912de3 Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Tue, 3 Dec 2013 08:42:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/welcome_helper.rb | 2 +- app/views/welcome/index.html.erb | 43 +++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index b62ddb69a..d95fc2623 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -61,7 +61,7 @@ module WelcomeHelper rescue Exception => e logger.error "[WelcomeHelper] ===> #{e}" end - grade + "    ".html_safe << grade.to_s end def show_user_content event diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 2cf87a6de..7e6e09564 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -93,6 +93,36 @@ $('#' + id).val(content); } } + + $(function(){ + var x = 10; + var y = 20; + $("span.tooltip").mouseover(function(e){ + this.myTitle = this.title; + this.title = ""; + var tooltip = "
" + this.myTitle + "
"; + $("body").append(tooltip); + $("#tooltip") + .css({ + "top": (e.pageY + y) + "px", + "left": (e.pageX + x) + "px" + }).show("fast"); + }).mouseout(function(){ + this.title = this.myTitle; + $("#tooltip").remove(); + }).mousemove(function(e){ + $("#tooltip") + .css({ + "top": (e.pageY + y) + "px", + "left": (e.pageX + x) + "px" + }); + }); + }) + + $("span.project_info").live("mouseover", funtion(){ + var v = $(this).attr("id"); + alert(v); + }); <%= stylesheet_link_tag 'welcome' %> @@ -105,11 +135,11 @@ <% find_hot_forum_topics.each do |topic|%>
  • -      <%= link_to topic.subject.truncate(30, omission: '...'), forum_memo_path(topic.forum_id,topic.id), :class => "gray" %> - +      <%= link_to topic.subject.truncate(25, omission: '...'), forum_memo_path(topic.forum_id,topic.id), :class => "gray" %> + <%= link_to topic.author, user_path(topic.author) %> - <%= time_tag_welcome topic.created_at %>前 + <%= time_tag_welcome topic.created_at %>前
  • <% end %> @@ -149,7 +179,12 @@

    <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :title => "#{project.name}")%> -     <%= show_grade project %> + + <%= content_tag "span", show_grade(project), + :style => "cursor: help; display: inline-block; float: right; color: #ec6300; background: url('/images/score.png') no-repeat scroll ;background-position: left center;", + :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", + :class => "tooltip", + :id => "tooltip-#{project.project_id}" %>

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