修改主页显示
This commit is contained in:
parent
31a4ecc8e8
commit
69c113f386
|
@ -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
|
||||
|
|
|
@ -94,30 +94,30 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
var x = 10;
|
||||
var y = 20;
|
||||
$("span.tooltip").mouseover(function(e){
|
||||
this.myTitle = this.title;
|
||||
this.title = "";
|
||||
var tooltip = "<div id='tooltip' style='background-color: red; position: absolute;'>" + this.myTitle + "</div>";
|
||||
$("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 = "<div id='tooltip' style=' position: absolute;'><div class='arrow bottom right'></div>" + this.myTitle + "</div>";
|
||||
// $("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 @@
|
|||
|
||||
<div class="left" style="float: left; height: 445px; width: 50%;">
|
||||
<ul class="welcome-message-list" style="width: 90%; ">
|
||||
<h3 style="color: rgb(21, 188, 207)"><strong>论坛热帖</strong></h3>
|
||||
<h3 style="color: rgb(21, 188, 207);margin-left: 8px;"><strong>论坛热帖</strong></h3>
|
||||
<div class="welcome-box-list">
|
||||
<% find_hot_forum_topics.each do |topic|%>
|
||||
<li class="message-brief-intro" style="min-height: 25px;">
|
||||
<div style="display: inline-block;">
|
||||
<span style="color:gray; display: inline-block; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;"> <%= link_to topic.subject.truncate(25, omission: '...'), forum_memo_path(topic.forum_id,topic.id), :class => "gray" %></span>
|
||||
<span style="margin-left: 20px; color: green !important; white-space: nowrap;">
|
||||
<%= link_to topic.author, user_path(topic.author), :style => "color: rgb(72,72,72);"%>
|
||||
<div style="display: inline-block; width: 100%;">
|
||||
<span style="color:gray; display: inline-block; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;"> <%= link_to topic.subject.truncate(30, omission: '...'), forum_memo_path(topic.forum_id,topic.id), :class => "gray" , :style => "font-size: 10pt !important;"%></span>
|
||||
<br>
|
||||
<span style="margin-left: 20px; color: rgb(172, 174, 177); white-space: nowrap; font-size: 9pt !important;;"><%= time_tag_welcome topic.created_at %>前</span>
|
||||
<span style="margin-left: 5px; color: rgb(172, 174, 177) !important; white-space: nowrap;">
|
||||
由<%= link_to topic.author, user_path(topic.author), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);"%>发表
|
||||
</span>
|
||||
<span style="margin-left:20px; color:rgb(72,72,72); white-space: nowrap;"><%= time_tag_welcome topic.created_at %>前</span>
|
||||
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size: 9pt !important;;">回复(<%= link_to topic.replies_count, forum_memo_path(topic.forum_id,topic.id) %>)</span>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -149,7 +151,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="right" style="float: right; margin-right: -10px; height: 445px; width: 50%; ">
|
||||
<div class="right" style="float: right; margin-right: -20px; height: 445px; width: 50%; ">
|
||||
<ul class="user-welcome-message-list" style="width: 80%; margin-top: 0px;">
|
||||
<h3 style="margin-left: -5px; color: rgb(21, 188, 207)"><strong>用户动态</strong></h3>
|
||||
<div class="user-message-box-list">
|
||||
|
@ -159,9 +161,9 @@
|
|||
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
|
||||
</div>
|
||||
<div class="inner-right" style="float: right; width:86%; height: 100%; ">
|
||||
<span style="color: green;"><%= link_to event.event_author, user_path(event.event_author), :style => "color:green;" %></span><!-- 发表了<%= find_all_event_type event %>:<span style="color: blue;"><%= link_to truncate(event.event_title, length: 30, omission:'...'), event.event_url %>
|
||||
<span style="color: green;"><%= link_to event.event_author, (user_path(event.event_author) if event.event_author), :style => "color:green;" %></span><!-- 发表了<%= find_all_event_type event %>:<span style="color: blue;"><%= link_to truncate(event.event_title, length: 30, omission:'...'), event.event_url %>
|
||||
</span> --><%= show_user_content event %>
|
||||
<p><span style="color: rgb(172, 174, 177)"><%= time_tag_welcome event.event_datetime %>前</span> <!-- <span>评论(4)</span></p> -->
|
||||
<p><span style="color: rgb(172, 174, 177)"><%= time_tag_welcome event.event_datetime %>前</span> <span style="float: right; color: rgb(172, 174, 177);"><%= show_event_reply event %></span></p>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -170,7 +172,7 @@
|
|||
</div>
|
||||
|
||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
||||
<h2>热门项目</h2>
|
||||
<h3 style="margin-left: 5px; color: #e8770d;"><strong>热门项目</strong></h2>
|
||||
<div class="d-p-projectlist-box">
|
||||
<ul class="d-p-projectlist">
|
||||
<% 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}")%>
|
||||
<!-- <span 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-#{project.project_id}"><%= show_grade project %></span> -->
|
||||
<%= 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}" %>
|
||||
|
@ -199,13 +201,42 @@
|
|||
</div>
|
||||
|
||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
||||
<h2>热门竞赛</h2>
|
||||
<h3 style="margin-left: 5px; color: #e8770d;"><strong>热门课程</strong></h3>
|
||||
<div class="d-p-projectlist-box">
|
||||
<ul class="d-p-projectlist">
|
||||
<% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %>
|
||||
<li style="background-image:none;">
|
||||
<div style="float: left;">
|
||||
<% 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 %>
|
||||
</div>
|
||||
<div style="float: left; margin-left: 10px; width: 360px;">
|
||||
<p class="layout">
|
||||
<%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%>
|
||||
</p>
|
||||
<p class="layout-1" >
|
||||
<%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
||||
<h3 style="margin-left: 5px; color: rgb(21, 188, 207);"><strong>热门竞赛</strong></h3>
|
||||
<div class="d-p-projectlist-box">
|
||||
<ul class="d-p-projectlist">
|
||||
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
|
||||
<li style="background-image:none;">
|
||||
<p class="layout">
|
||||
<%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}")%>
|
||||
<span style = "background: url('/images/007.gif') no-repeat scroll ;background-position: left center;"><%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}",
|
||||
:style => "margin-left: 28px;") %></span>
|
||||
</p>
|
||||
<p class="layout-1" >
|
||||
<%= content_tag "span", contest.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => contest.description %>
|
||||
|
@ -217,14 +248,14 @@
|
|||
</div>
|
||||
|
||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
||||
<h2>热门众包</h2>
|
||||
|
||||
<h3 style="margin-left: 5px; color: rgb(21, 188, 207);"><strong>热门众包</strong></h3>
|
||||
<div class="d-p-projectlist-box">
|
||||
<ul class="d-p-projectlist">
|
||||
<% find_all_hot_bid.map do |bid| break if(bid == find_all_hot_bid[5]) %>
|
||||
<li style="background-image:none;">
|
||||
<p class="layout">
|
||||
<%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :title => "#{bid.name}")%>
|
||||
<span style = "background: url('/images/007.gif') no-repeat scroll ;background-position: left center;"><%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :title => "#{bid.name}",
|
||||
:style => "margin-left: 28px;")%></span>
|
||||
</p>
|
||||
<p class="layout-1" >
|
||||
<%= content_tag "span", bid.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => bid.description %>
|
||||
|
@ -235,23 +266,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
||||
<h2>热门课程</h2>
|
||||
<div class="d-p-projectlist-box">
|
||||
<ul class="d-p-projectlist">
|
||||
<% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %>
|
||||
<li style="background-image:none;">
|
||||
<p class="layout">
|
||||
<%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%>
|
||||
</p>
|
||||
<p class="layout-1" >
|
||||
<%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %>
|
||||
</p>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="clr">
|
||||
</div>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 931 B |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 652 B |
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue