1.修改竞赛首页通知公告

2.调整竞赛首页页面布局
解决方案:查找系统中最新的最多5条通知公告,显示在首页,用户可以点击相应公告进入公告详细信息页面
This commit is contained in:
sw 2014-09-16 15:38:21 +08:00
parent 5ac7304858
commit 51a783c9a9
3 changed files with 17 additions and 13 deletions

View File

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

View File

@ -166,14 +166,12 @@
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<div class="d-p-projectlist"> <div class="d-p-projectlist">
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %> <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
<li style="overflow:auto;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'> <li style="overflow:auto;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4" style="float: left; margin-top: 7px"> <div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/contest1.png')%> <%= image_tag('/images/contest1.png')%>
</div> </div>
<div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;"> <div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;">
<%= link_to(contest.name, contest_contestnotifications_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> <%= link_to(contest.name.truncate(50, omission: '...'), contest_contestnotifications_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
<% if contest.id == 2 or contest.id == 3 or contest.id == 6 %> <% if contest.id == 2 or contest.id == 3 or contest.id == 6 %>
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("#{contest.projects.where('is_public=1').count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span> <span class="font_lighter">(<span style="font-size: 13px"><%= link_to("#{contest.projects.where('is_public=1').count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
<% else %> <% else %>
@ -186,29 +184,35 @@
</div><br /> </div><br />
<div style="padding-left: 57px; clear: left;"> <div style="padding-left: 57px; clear: left;">
<span class="font_lighter"><%=l(:label_release_time)%>:&nbsp;<%=format_time contest.created_on %></span> <span class="font_lighter"><%=l(:label_release_time)%>:&nbsp;<%=format_time contest.created_on %></span>
</div> </div>
</li> </li>
<% end; reset_cycle %> <% end; reset_cycle %>
</div> </div>
</div> </div>
</div> </div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;"> <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);"> <h3 style="margin-left: 5px; color: #e8770d;">
<strong><%=l(:label_notification)%></strong> <strong><%=l(:label_notification)%></strong>
</h3> </h3>
<ul class="contest-notification-list"> <ul class="contest-notification-list">
<% @contest_notifications.each do |notification| %> <% @contest_notifications.each do |notification| %>
<li> <li>
<span class="title"><%= link_to notification.title, notification %></span> <div class="inner-right" style="float: left; margin-top: 7px ">
<span class="font_lighter content"><%= truncate(strip_tags(notification.content).gsub( '&nbsp;',' '), length:60) %></span> <%= link_to image_tag(url_to_avatar(notification.author), :class => "avatar"), user_path(notification.author) %>
<span class="font_lighter time"><%=l(:label_release_time)%>:&nbsp;<%=format_time notification.created_at %></span> </div>
<div class="font_lighter" style="padding-top: 7px;padding-left: 55px;" title="<%= notification.title%>">
<span>
<strong><%= link_to_user(notification.author) %></strong>
<%= l(:label_project_notice) %>
<%= link_to notification.title.truncate(35, omission: '...'), contest_contestnotifications_path(notification.contest_id) %>
</span>
</div>
<div class="font_lighter" style="padding-left: 55px;" title="<%= notification.description%>"><%= notification.description.truncate(30, omission: '...') %></div>
<div class="font_lighter" style="padding-left: 55px;"><%=l(:label_release_time)%>:&nbsp;<%=format_time notification.created_at %></div>
</li> </li>
<% end %> <% end %>
</ul> </ul>
@ -223,7 +227,7 @@
<span style="margin-top: -20px;float: right; display: block;"><%= link_to l(:label_more_information), forums_path %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to l(:label_more_information), forums_path %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% find_new_forum_topics(8).each do |topic|%> <% find_new_forum_topics(9 - @contest_notifications.count).each do |topic|%>
<li class="message-brief-intro" style="height: auto; line-height:2em; padding-bottom: 1px "> <li class="message-brief-intro" style="height: auto; line-height:2em; padding-bottom: 1px ">
<div style="display: inline-block; width: 100%;"> <div style="display: inline-block; width: 100%;">
<span class="memo_activity text_nowrap" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="memo_activity text_nowrap" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

View File

@ -2073,7 +2073,7 @@ zh:
label_current_hot_contest: 最新热门竞赛 label_current_hot_contest: 最新热门竞赛
label_current_attendingcontest_work: 最新参赛作品 label_current_attendingcontest_work: 最新参赛作品
label_issue_feedback_activities: 问题和反馈动态 label_issue_feedback_activities: 问题和反馈动态
label_more_information: 更多... label_more_information: 更多>>
label_my_question: 我要提问 label_my_question: 我要提问
label_my_feedback: 我要反馈 label_my_feedback: 我要反馈
label_release_time: 发布时间 label_release_time: 发布时间