From 69c113f386c83a808cb975e81edda47f597752ba Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Thu, 5 Dec 2013 15:26:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E9=A1=B5=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/welcome_helper.rb | 22 +++++- app/views/welcome/index.html.erb | 129 +++++++++++++++++-------------- public/images/007.gif | Bin 0 -> 931 bytes public/images/021.png | Bin 0 -> 1362 bytes public/images/039.gif | Bin 0 -> 652 bytes public/stylesheets/welcome.css | 52 +++++++++++-- 6 files changed, 136 insertions(+), 67 deletions(-) create mode 100644 public/images/007.gif create mode 100644 public/images/021.png create mode 100644 public/images/039.gif diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 5a103e015..b9192f47b 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -73,13 +73,13 @@ module WelcomeHelper rescue Exception => e logger.error "[WelcomeHelper] ===> #{e}" end - "项目得分:".html_safe << grade.to_s + "项目评分:".html_safe << grade.to_s end def show_user_content event str = ''.html_safe case event.event_type - when ('news' || 'issue' || 'attachment' || 'message' || 'bid' || 'wiki-page' || 'document') + when 'news' , 'issue' , 'attachment' , 'message' , 'bid' , 'wiki-page' , 'document' str << " ".html_safe << 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) when 'reply' str << " ".html_safe << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_description, length: 30, omission:'...'), event.event_url) @@ -89,6 +89,18 @@ module WelcomeHelper str end + def show_event_reply event + str = "回复(" + case event.event_type + when "issue" + str << link_to(cal_issues_count(event), issue_path(event)) << ")" + when "Memo" + str << link_to(cal_memos_count(event), forum_memo_path(event.forum_id,event.id)) << ")" + else + str = "" + end + str.html_safe + end private @@ -141,7 +153,7 @@ module WelcomeHelper end #取得论坛数据 - def find_hot_forum_topics limit=10 + def find_hot_forum_topics limit=9 #Memo.order('replies_count DESC').where('replies_count <> 0').limit(limit) Memo.order('replies_count DESC, created_at DESC').where('parent_id IS NULL').limit(limit) ## 以下语句会内链接自身查询出最后一条回复时间,没有回复的帖子不会显示 @@ -180,6 +192,10 @@ module WelcomeHelper '回复' when 'bid' '作业' + when 'Memo' + '主题' + when 'document' + '文件' else event.event_type end diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index db1db2955..2bba8e495 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -94,30 +94,30 @@ } } - $(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" - }); - }); - }) + // $(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" + // }); + // }); + // }) // $('li').mouseover(function(){ // var id=$(this).attr('id'); @@ -132,16 +132,18 @@
-
+

    用户动态

    @@ -159,9 +161,9 @@ <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
    - <%= link_to event.event_author, user_path(event.event_author), :style => "color:green;" %><%= show_user_content event %> -

    <%= time_tag_welcome event.event_datetime %>前      +

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

    <% end %> @@ -170,7 +172,7 @@
-

热门项目

+

热门项目

    <% find_all_hot_project.map do |project| break if(project == find_all_hot_project[15]) %> @@ -183,7 +185,7 @@ <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :title => "#{project.name}")%> <%= content_tag "span", show_grade(project), - :style => "cursor: help; display: inline-block; float: right; color: #ec6300; ", + :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ", :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", :class => "tooltip", :id => "tooltip-#{project.project_id}" %> @@ -197,15 +199,44 @@
+ +
+

热门课程

+
+
    + <% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %> +
  • +
    + <% if get_avatar?(project)%> + <%= image_tag(url_to_avatar(project), :class => "avatar-4") %> + <% else %> + <%= image_tag('../images/avatars/Project/course.jpg', :class => "avatar-4") %> + <% end %> +
    +
    +

    + <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%> +

    +

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

    +
    +
  • + <% end %> +
+
+
+
-

热门竞赛

+

热门竞赛

    <% 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}")%> + <%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", + :style => "margin-left: 28px;") %>

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

-

热门众包

- +

热门众包

    <% 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}")%> + <%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :title => "#{bid.name}", + :style => "margin-left: 28px;")%>

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

-
-

热门课程

-
-
    - <% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %> -
  • -

    - <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%> -

    -

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

    -
  • - <% end %> -
-
-
+
diff --git a/public/images/007.gif b/public/images/007.gif new file mode 100644 index 0000000000000000000000000000000000000000..16e705d929ec78cec3a5de5b3ce325e37a650c34 GIT binary patch literal 931 zcmb`^drVVz6bJBMPw9h}M+=nq808_L70VO^6y+g;QyGlz!5Ap|ivkzuiF3VY=`kUAauNG5Y-`R@u;D!FIsLGTd5(u5IK8 zd_%+fnEbF2Kqt49>9U! zxEbi%D_8_H4fHzD!d3eEbK*cV=V$`$odjTtezE|jkI{XfH0i9E5QK7d0 z``Yl8eyj$H0y+VEf!+oB0O*)Z2LWpgw4jg&=z>BYD>MYy0rZ7JKPp%USO^G4dKmUU z#ZKmqR#$gRQ)laAl}@cjU2DIepffR%IaVuH-^2_jj|!6P_6(1Beg4t0@w~+Gv1Dz? zuj3P8@3TB*QqFZJbAy}^wpL^c*_@|KEQ5t=c^X8yQPT6I(X&ERbmNYlPdal<(QTup zSr(zQuHos&H?_^?U-Yw2AiudrIw19}3FXW-3WI}7x0i3N+`98=v}8H{XB<80uU?ZE z&i~xdGJmsTLOgV}x#{lGU-66OmVdRYbQ`m(+T#zkGShf`{v`1F1A?ZoDi}0!eK?>p zCw-}$Ylo)WJ6>wm23DgpQ4BQo}y2y^9T-PX+W`%=HS1m07+_ zjb!5QKT@^+QJ$aaVPFz6JR9HM`yOu&J=LxZ4h8_1Uf+`{(914l%anAIQ#g A-T(jq literal 0 HcmV?d00001 diff --git a/public/images/021.png b/public/images/021.png new file mode 100644 index 0000000000000000000000000000000000000000..536464fcedf9f8c5bdb1f2ff35caf22234e40ed9 GIT binary patch literal 1362 zcmV-Y1+DstP)Dk2EiI(ph>3(WL9G;G6oWB}!31d_-fDmZ6Y$cg z(S&~_;vX$&R8kugZ6sPH2~ea?u(2Lu(Pp?Fdx7_)62Vxra^c?gARlWgX+VLCf1s=G>roX) zz?>_5$oCcV*jTV+K!)ifRs3g8LGEis_*ye7M=;^eYZz!t*Han`$s59QC8V&-U>+E2i$FU|}6BRUis;h0lH1>Jp$>EwJQxkyfw{%AgFv?1B_$bTwt9p2fKUm!B`zdnj>r(UgFaLg{_g{#qT( zar-|kd3GQ5JNos3*2}nf>=i6-|99Ge;-Jj;6n0MeGA=c$NDPOy)*9R=8YCx+Q^q^woNBc zoKmp{=@Fe+zUR1ZmiKrBxDM6msr2@?^3p=SG}WRW*QbWhRDep=SMe#I$GSIr(2=d& zu25~6)gInzni-%3^Bg*PfWdg08w4%7i`0bAB#>d3pn;KMm#9Ti)e@!A`-SNHOjPUfnd!B*QOmfI~* zyeMjFr(jWwXkLv}W}9$+gLuv=-{~Dfh1Jp-^%B{YGU@F?g+Ox{umQ!NEUZQh5)6v} zx&2&2f}I@$T#fV$m>Gd;bwKJt&R}3oQ&8(m$@FqsweF3UuCvbhFMCWlC%mzG@O$U{ zb%urvJSQF-cAA)}3$zF*xJIlD*JgU8!NB$4y*bafX|i3+4-Uln-^|*fB(&o8`ybUU zjxV(JxN4i4n|W0DMfugbRYgR4CMbzbR8wRCx`tB(=o+BaoItBtfL8N>t)7>$YTX)1 zCS(OLx1}yn=}F0)cFAZ>&g*U7lNmgHnJw&|ml#VjG#g0Ba5Wz1WI4!eAQ+G?($!$W z)zD-%`)=08`1VH(7Bf!!8b_|}V7d2UhmBmKz`L&QN9W#umy~Ff0J^KGy`xh^q_ekE atZ(9^NhnT(*-Xb!VTFbY%xXG$+8O{XFW5~0 literal 0 HcmV?d00001 diff --git a/public/stylesheets/welcome.css b/public/stylesheets/welcome.css index 7d85e3615..f4feb824d 100644 --- a/public/stylesheets/welcome.css +++ b/public/stylesheets/welcome.css @@ -102,16 +102,16 @@ ul.welcome-message-list{ margin-right: 10px; color: #999999; } -.d-p-index-box h2{ +.d-p-index-box h3{ height: 35px; line-height: 35px; background-color: rgb(252, 252, 252); color: green; - text-indent: 8px; + /*text-indent: 8px;*/ margin: 0; padding: 0; display: block; - font-size: 1em; + /*font-size: 1em;*/ border-top: none; border-bottom: 1px solid rgb(21, 165, 200); /*-webkit-margin-before: 0.83em; @@ -159,7 +159,7 @@ li { background-color: rgb(252, 252, 252); } .d-p-index-newsource li,.d-p-index-hotproject ul.d-p-projectlist li{ - color: rgb(72,72,72); + color: rgb(102, 102, 102); background: center -1px no-repeat; line-height: 20px; padding: 5px 5px 0px 9px; @@ -174,7 +174,7 @@ li { } .d-g-blue{ - color: rgb(62, 98, 166) !important; + color: rgb(17, 102, 173) !important; font-weight: 700; } @@ -222,9 +222,47 @@ p.layout { .inner-right a, a:link, a:visited { - color: rgb(62, 98, 166); + color: rgb(17, 102, 173); +} + + +.tooltip { + margin-left: 10px; +} + +div#tooltip { + background-color: #46ccef; + border: 1px solid #c8c8c8; + border-radius: 5px; + width: 220px; + /*text-align: center;*/ + text-indent: -5px; + padding: 20px; + position: absolute; + opacity: 100; +} + +/*div#tooltip .arrow { + border-style: solid; + position: absolute; +} + +div#tooltip .bottom { + border-color: #c8c8c8 transparent transparent transparent; + border-width: 8px 8px 0px 8px; + bottom: -8px; +}*/ + +div#tooltip::after { + border-color: #f8f8f8 transparent transparent transparent; + border-style: solid; + border-width: 7px 7px 0px 7px; + bottom: 1px; + content: ""; + position: absolute; + left: -7px; + } -