竞赛首页的简介下方直接显示竞赛动态
This commit is contained in:
parent
3e3ad381b1
commit
01484701d2
|
@ -22,6 +22,34 @@ class ContestsController < ApplicationController
|
||||||
update_messsages_to_viewed("ContestMessage", @contest)
|
update_messsages_to_viewed("ContestMessage", @contest)
|
||||||
@left_nav_type = 1
|
@left_nav_type = 1
|
||||||
|
|
||||||
|
contest_activities = @contest.contest_activities
|
||||||
|
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||||
|
if params[:type].present?
|
||||||
|
case params[:type]
|
||||||
|
when "work"
|
||||||
|
@contest_activities = contest_activities.where("contest_act_type = 'Work'").order('updated_at desc')
|
||||||
|
when "news"
|
||||||
|
@contest_activities = contest_activities.where("contest_act_type = 'News'").order('updated_at desc')
|
||||||
|
when "message"
|
||||||
|
@contest_activities = contest_activities.where("contest_act_type = 'Message'").order('updated_at desc')
|
||||||
|
when "poll"
|
||||||
|
@contest_activities = contest_activities.where("contest_act_type = 'Poll'").order('updated_at desc')
|
||||||
|
when "attachment"
|
||||||
|
@contest_activities = contest_activities.where("contest_act_type = 'Attachment'").order('updated_at desc')
|
||||||
|
when "journalsForMessage"
|
||||||
|
@contest_activities = contest_activities.where("contest_act_type = 'JournalsForMessage'").order('updated_at desc')
|
||||||
|
when "news"
|
||||||
|
@contest_activities = contest_activities.where("contest_act_type = 'News'").order('updated_at desc')
|
||||||
|
else
|
||||||
|
@contest_activities = contest_activities.order('updated_at desc')
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@contest_activities = contest_activities.order('updated_at desc')
|
||||||
|
end
|
||||||
|
@contest_activities_count = @contest_activities.count
|
||||||
|
@contest_activities = @contest_activities.limit(10).offset(@page * 10)
|
||||||
|
@type = params[:type]
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
format.html
|
format.html
|
||||||
|
|
|
@ -260,7 +260,7 @@ class MessagesController < ApplicationController
|
||||||
elsif @course
|
elsif @course
|
||||||
redirect_to course_activity_path(@course)
|
redirect_to course_activity_path(@course)
|
||||||
elsif @contest
|
elsif @contest
|
||||||
redirect_to contest_activities_contest_path(@contest)
|
redirect_to contest_path(@contest)
|
||||||
end
|
end
|
||||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||||
if @project
|
if @project
|
||||||
|
@ -351,7 +351,7 @@ class MessagesController < ApplicationController
|
||||||
if params[:is_course] && params[:is_course].to_i == 0
|
if params[:is_course] && params[:is_course].to_i == 0
|
||||||
redirect_to user_contest_community_path(User.current.id)
|
redirect_to user_contest_community_path(User.current.id)
|
||||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
|
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
|
||||||
redirect_to contest_activities_contest_path(@contest)
|
redirect_to contest_path(@contest)
|
||||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||||
redirect_to contest_boards_path(@contest)
|
redirect_to contest_boards_path(@contest)
|
||||||
elsif @message.parent
|
elsif @message.parent
|
||||||
|
|
|
@ -126,7 +126,7 @@ class WordsController < ApplicationController
|
||||||
if params[:user_activity_id] == params[:activity_id]
|
if params[:user_activity_id] == params[:activity_id]
|
||||||
redirect_to feedback_contest_path(@contest)
|
redirect_to feedback_contest_path(@contest)
|
||||||
else
|
else
|
||||||
redirect_to contest_activities_contest_path(@contest)
|
redirect_to contest_path(@contest)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -59,5 +59,5 @@
|
||||||
|
|
||||||
<% if contest_activities.count + page * 10 < @contest_activities_count %>
|
<% if contest_activities.count + page * 10 < @contest_activities_count %>
|
||||||
<!--<div id="show_more_course_activities" class="loadMore mt10 f_grey">点击展开更多<%#= link_to "", course_activity_path(@course.id, :type => type, :page => page), :id => "more_course_activities_link", :remote => "true", :class => "none" %></div>-->
|
<!--<div id="show_more_course_activities" class="loadMore mt10 f_grey">点击展开更多<%#= link_to "", course_activity_path(@course.id, :type => type, :page => page), :id => "more_course_activities_link", :remote => "true", :class => "none" %></div>-->
|
||||||
<%= link_to "点击展开更多",contest_activities_contest_path(@contest.id, :type => type, :page => page),:id => "show_more_course_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
|
<%= link_to "点击展开更多",contest_path(@contest.id, :type => type, :page => page),:id => "show_more_course_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,30 +1,57 @@
|
||||||
<div class="homepageRight mt0 ml10" onmouseover="$('#edit_link').show(); " onmouseout="$('#edit_link').hide();" style="background-color: #fff;">
|
<div class="homepageRight mt0 ml10" onmouseover="$('#edit_link').show(); " onmouseout="$('#edit_link').hide();">
|
||||||
<div class="contestRightBanner border-bottom">
|
<div style="background-color: #fff;">
|
||||||
<div class="NewsBannerName">
|
<div class="contestRightBanner border-bottom">
|
||||||
竞赛介绍
|
<div class="NewsBannerName">
|
||||||
</div>
|
竞赛介绍
|
||||||
<% if User.current.admin_of_contest?(@contest) %>
|
|
||||||
<%= link_to "编辑", {:controller => 'contests', :action => 'settings', :id => @contest}, :class => "link-blue fr mt5 none", :id => "edit_link" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<% if (@contest.description.nil? || (@contest.description == "" && @contest.attachments.blank?)) && User.current.admin_of_contest?(@contest) %>
|
|
||||||
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
|
||||||
<p class="sy_tab_con_p">请尽快补充竞赛说明,赢得更多参赛者的青睐吧~</p>
|
|
||||||
<% elsif (@contest.description.nil? || (@contest.description == "" && @contest.attachments.blank?)) %>
|
|
||||||
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
|
||||||
<p class="sy_tab_con_p">尚未发布竞赛说明,敬请期待~</p>
|
|
||||||
<% else %>
|
|
||||||
<div class="description_div">
|
|
||||||
<div class="syllabuscon upload_img ke-block break_word" id="syllabus_description_<%= @contest.id %>">
|
|
||||||
<%= @contest.description.html_safe %>
|
|
||||||
</div>
|
|
||||||
<div class="mt10" style="font-weight:normal; font-size: 12px;">
|
|
||||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @contest} %>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% if User.current.admin_of_contest?(@contest) %>
|
||||||
|
<%= link_to "编辑", {:controller => 'contests', :action => 'settings', :id => @contest}, :class => "link-blue fr mt5 none", :id => "edit_link" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<% if (@contest.description.nil? || (@contest.description == "" && @contest.attachments.blank?)) && User.current.admin_of_contest?(@contest) %>
|
||||||
|
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
||||||
|
<p class="sy_tab_con_p" style="margin-bottom: 0px; padding-bottom: 100px;">请尽快补充竞赛说明,赢得更多参赛者的青睐吧~</p>
|
||||||
|
<% elsif (@contest.description.nil? || (@contest.description == "" && @contest.attachments.blank?)) %>
|
||||||
|
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
||||||
|
<p class="sy_tab_con_p" style="margin-bottom: 0px; padding-bottom: 100px;">尚未发布竞赛说明,敬请期待~</p>
|
||||||
|
<% else %>
|
||||||
|
<div class="description_div">
|
||||||
|
<div class="syllabuscon upload_img ke-block break_word" id="syllabus_description_<%= @contest.id %>">
|
||||||
|
<%= @contest.description.html_safe %>
|
||||||
|
</div>
|
||||||
|
<div class="mt10" style="font-weight:normal; font-size: 12px;">
|
||||||
|
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @contest} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt10">
|
||||||
|
<div class="homepageRightBanner">
|
||||||
|
<div class="NewsBannerName">
|
||||||
|
<%= get_acts_list_type @type %></div>
|
||||||
|
<ul class="resourcesSelect">
|
||||||
|
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||||
|
<ul class="homepagePostType" style="width:90px; left:-80px;">
|
||||||
|
<li>
|
||||||
|
<ul class="homepagePostTypeHomework fl">
|
||||||
|
<li><%= link_to "全部动态", contest_path(@contest), :class =>"homepagePostTypeAll postTypeGrey"%></li>
|
||||||
|
<li><%= link_to "作品动态", contest_path(@contest, :type => 'work'), :class => "homepagePostTypeAssignment postTypeGrey"%></li>
|
||||||
|
<li><%= link_to "通知动态", contest_path(@contest, :type => 'news'), :class => "homepagePostTypeNotice postTypeGrey"%></li>
|
||||||
|
<!--<li><%#= link_to "资源库动态", {:controller => "courses", :action => "show", :type => "attachment"}, :class => "homepagePostTypeResource resourcesGrey"%></li>-->
|
||||||
|
<li><%= link_to "论坛动态", contest_path(@contest, :type => 'message'), :class => "homepagePostTypeForum postTypeGrey"%></li>
|
||||||
|
<li><%= link_to "留言动态", contest_path(@contest, :type => 'journalsForMessage'), :class => "homepagePostTypeMessage postTypeGrey"%></li>
|
||||||
|
<!--<li><%#= link_to "问卷动态", {:controller => "courses", :action => "show", :type => "poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%></li>-->
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<%= render :partial => 'contests/contest_activity', :locals => {:contest_activities => @contest_activities,:page => 0,:type => @type} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -0,0 +1 @@
|
||||||
|
$("#show_more_course_activities").replaceWith("<%= escape_javascript( render :partial => 'contests/contest_activity',:locals => {:contest_activities => @contest_activities, :page => @page,:type => @type} )%>");
|
|
@ -44,11 +44,11 @@
|
||||||
<div class="sy_class_leftnav mb12" >
|
<div class="sy_class_leftnav mb12" >
|
||||||
<ul class="accordion">
|
<ul class="accordion">
|
||||||
<li id="sy_01" class="sy_icons_game">
|
<li id="sy_01" class="sy_icons_game">
|
||||||
<%= link_to '竞赛首页', contest_path(@contest) %>
|
<a href="<%= contest_path(@contest) %>">动态<span><%=@contest.contest_activities.count %></span></a>
|
||||||
</li>
|
|
||||||
<li id="sy_02" class="sy_icons_index">
|
|
||||||
<%= link_to '动态', contest_activities_contest_path(@contest) %>
|
|
||||||
</li>
|
</li>
|
||||||
|
<!--<li id="sy_02" class="sy_icons_index">-->
|
||||||
|
<!--<%#= link_to '动态', contest_activities_contest_path(@contest) %>-->
|
||||||
|
<!--</li>-->
|
||||||
<!--<li id="sy_03" class="sy_icons_boards"> <a href="">讨论区<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>-->
|
<!--<li id="sy_03" class="sy_icons_boards"> <a href="">讨论区<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>-->
|
||||||
<li id="sy_03" class="sy_icons_hwork">
|
<li id="sy_03" class="sy_icons_hwork">
|
||||||
<a href="<%= works_path(:contest => @contest) %>">提交<span><%= work_num%></span></a>
|
<a href="<%= works_path(:contest => @contest) %>">提交<span><%= work_num%></span></a>
|
||||||
|
|
Loading…
Reference in New Issue