fixed issue #998, 主页的通知公告区域显示优化

This commit is contained in:
hhuai 2014-08-17 20:56:58 +08:00
parent ecae8d1f35
commit 8b121c3e50
5 changed files with 82 additions and 63 deletions

View File

@ -1,5 +1,5 @@
class ContestNotificationController
class ContestNotificationController < ApplicationController
def show
@notification = ContestNotification.find(params[:id])
end
end
end

View File

@ -110,7 +110,7 @@ class WelcomeController < ApplicationController
def contest
@contest_page = FirstPage.where("page_type = 'contest'").first
@contestNotification = ContestNotification.all.first
@contest_notifications = ContestNotification.order("id desc")
end
def search

View File

@ -0,0 +1,24 @@
<div class="top-content">
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf" ><%= l(:label_contest_innovate ) %></td>
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td rowspan="2">
</td>
<td rowspan="2" >
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a href="http://contest.trustie.net/">contest.trustie.net</td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'welcome', :action => 'contest' %> > 详情</td>
</tr>
</table>
</div>
<!-- end -->
<div class="notification-content">
<p class="title"><%= @notification.title %></p>
<hr />
<p class="content"><%= @notification.content.html_safe %></p>
<hr />
</div>

View File

@ -190,69 +190,20 @@
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="padding-left: 32px">
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h3 style="margin-left: 5px; color: #e8770d;">
<strong><%=l(:label_notification)%></strong>
</h3>
<span style="margin-top: -20px;float: right; display: block;"><%#= link_to l(:label_more_information), forums_path %></span>
<div style="height: 167px; padding-top:6px;">
<fieldset style="padding-left: 36px; margin-left: 13px; height: 150px; width:380px; border-radius:10px;">
<div style="font-size:14px; color: #1166AD; padding-left:52px; "><strong><%= @contestNotification.title %></strong></div>
<div class="underline-contests_four"></div>
<div id="up_zzjs">
<div id="marqueebox">
<!-- <div><span style="color: red">一等奖:</span>&nbsp<span style="color: #1166AD">消灭那怪兽</span></div>
<div><span style="color: red">二等奖:</span>&nbsp<span style="color: #1166AD">兄弟向前冲 </span></div>
<div><span style="color: red">二等奖:</span>&nbsp<span style="color: #1166AD">鸟鸟文件管理器(银河之光版)</span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">疯狂猜图</span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">愉快的定向越野 </span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">体能训练助手 </span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">迷你日记本 </span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">永齐飞机大战</span></div> -->
<%= @contestNotification.content.html_safe %>
</div>
</div>
<!-- 火狐 onmouseover、onmouseout无效 <marquee scrollamount=3 direction=up height=100 onmouseover=stop() onmouseout= start() >
<div><span style="color: red">一等奖:</span>&nbsp<span style="color: #1166AD">消灭那怪兽</span></div>
<div><span style="color: red">二等奖:</span>&nbsp<span style="color: #1166AD">兄弟向前冲 </span></div>
<div><span style="color: red">二等奖:</span>&nbsp<span style="color: #1166AD">鸟鸟文件管理器(银河之光版)</span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">疯狂猜图</span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">愉快的定向越野 </span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">体能训练助手 </span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">迷你日记本 </span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">永齐飞机大战</span></div>
</marquee> -->
<script language="javascript">
function startmarquee(lh,speed,delay) {
var p=false;
var t;
var o=document.getElementById("marqueebox");
o.innerHTML+=o.innerHTML;
o.style.marginTop=0;
o.onmouseover=function(){p=true;}
o.onmouseout=function(){p=false;}
function start(){
t=setInterval(scrolling,speed);
if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
}
function scrolling(){
if(parseInt(o.style.marginTop)%lh!=0){
o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
if(Math.abs(parseInt(o.style.marginTop))>=o.scrollHeight/2) o.style.marginTop=0;
}else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
}
startmarquee(20,40,0);
</script>
</fieldset>
</div>
<ul class="contest-notification-list">
<% @contest_notifications.each do |notification| %>
<li>
<span class="title"><%= link_to notification.title, notification %></span>
<span class="font_lighter content"><%= truncate(strip_tags(notification.content).gsub( '&nbsp;',' '), length:60) %></span>
<span class="font_lighter time"><%=l(:label_release_time)%>:&nbsp;<%=format_time notification.created_at %></span>
</li>
<% end %>
</ul>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">

View File

@ -1377,3 +1377,47 @@ div.pagination {
right: 5%;
}
/***
* contest notifications
*/
ul.contest-notification-list {
clear: both;
}
ul.contest-notification-list li{
padding: 10px;
border-bottom: 1px solid rgb(245,245,245);
display: block;
}
ul.contest-notification-list li span.time {
color: rgb(172, 174, 177);
font-size: 13px;
line-height: 25px;
}
ul.contest-notification-list li span.title {
font-size: 14px;
}
ul.contest-notification-list li span.content {
padding-top: 5px;
padding-bottom: 10px;
}
ul.contest-notification-list li span{
display: block;
}
.notification-content{
margin: 0 auto;
width: 80%;
}
.notification-content hr{
background: #eee;
}
.notification-content .title{
font-size: 15px;
}
.notification-content .content{
font-size: 13px;
}