发布作品和关联作品都可以用了,参赛应用也可以取出来了,接下来通过判断来去参赛项目和参赛应用

This commit is contained in:
wanglinchun 2014-05-08 15:06:36 +08:00
parent fb3c513da2
commit f2dbbc48fc
3 changed files with 152 additions and 11 deletions

View File

@ -292,17 +292,16 @@ class ContestsController < ApplicationController
###我要参赛
def show_attendingcontest
@softapplication = Softapplication.all
@contesting_softapplication = @contest.contesting_softapplications
@contesting_softapplication = paginateHelper @contesting_softapplication, 10
##引用base_newcontest整体样式
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
}
format.api
@contest = Contest.find_by_id(params[:id])
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
}
format.api
end
end

View File

@ -0,0 +1,141 @@
<style>
input[type="submit"].contest_btn {
vertical-align: middle;
width: 60px;
height: 30px;
line-height: 18px;
font-size: 14px;
color: rgb(0, 0, 0);
background: url("/images/button/bg103.jpg") no-repeat scroll left top transparent;
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
/*margin-right: -4px;*/
}
input[type="button"].contest_btn {
width: 60px;
height: 30px;
line-height: 18px;
font-size: 14px;
color: rgb(0, 0, 0);
background: url("/images/button/bg103.jpg") no-repeat scroll left top transparent;
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
margin-right: -2px;
}
textarea:focus {
border: #d5dee9 1px solid;
}
</style>
<script type="text/javascript" language="javascript">
function clearInfo(id,content) {
var text = $('#' + id);
if (text.val() == content) {
$('#' + id).val('');
}
}
function showInfo(id,content) {
var text = $('#' + id);
if (text.val() == '') {
$('#' + id).val(content);
}
}
function cancel() {
$("#put-bid-form").hide();
}
</script>
<!---->
<div style="padding-left: 17px; padding-bottom: 15px">温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛!</div>
<% if User.current.logged? %>
<div>
<div style="padding-left: 17px; font-size: 15px"><strong>参赛步骤:</strong></div>
<div style="padding-left: 82px; ">
<span style="padding-top: 50px">步骤1</span>
<span><%= link_to '新建参赛作品', new_softapplication_path(:target=>'_blank'), :target=>'_blank' %></span>
<span style="font-size: 12px; color: grey">(先点击“新建参赛作品”, 然后返回本页继续步骤2即可。</span>
</div>
<div style="padding-left: 82px; ">
<span style="padding-top: 50px">步骤1</span>
<span><%= link_to '关联参赛作品', "javascript:void(0);", onclick: "$('#put-bid-form').toggle();" %></span>
</div>
</div>
<!--点击关联参赛作品后弹出关联框-->
<div id="put-bid-form" style="display: none">
<%= form_for "contest_for_save", :remote=>true, :url => {:controller => 'contests', :action => 'add_softapplication'}, :update => "contesting_softapplication_list", :complete => '$("#put-bid-form").hide();' do |f| %>
<table id="contesting_table" border="0" width="100%" style="margin-left: 40px;"> <!--该table为点击关联参赛作品后弹出的-->
<tr>
<%= select_tag 'contest', options_for_select(select_option_app_helper(@softapplication)), :name => 'contest', :class => 'grayline' %>
</tr>
<tr>
<td><%= f.text_area :contest_message, :id => "contest_message", :required => true, :rows => 2, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%></td>
</tr>
<tr>
<td align="right">
<%= submit_tag l(:button_add), :name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'"%>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
</td>
</tr>
</table>
<% end %>
</div>
<% end %>
<!--参赛作品列表,通过判断竞赛的id为2,3,6的则跳转到partial=> "list_projects" 否则跳转到-->
<% @contesting_softapplication.each do |c_softapplication|%>
<% if c_softapplication.softapplication %>
<div style="padding-left: 18px">
<div style="font-size: 15px">
<tr>
<td><strong>应用软件:</strong></td>
<td>
<%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %>
</td>
</tr></br>
</div>
<div style="padding-left: 68px">
<tr>
<td>简介:</td>
<td>
<%= c_softapplication.softapplication.description.truncate(90, omission: '...') %>
</td>
</tr></br>
</div>
<div style="padding-left: 68px; padding-bottom: 8px">
<tr>
<td>发布时间:</td>
<td>
<%=format_time c_softapplication.created_at %>
</td>
</tr>
</div>
</div>
<% end %>
<div class="underline-contests_three"></div>
<% end %>
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>

View File

@ -281,7 +281,8 @@ Redmine::MenuManager.map :contest_menu do |menu|
menu.push :respond, :show_contest_contest_path, :caption => :label_user_response
menu.push :project, :show_project_contest_path, :caption => :label_contest_project
menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application
menu.push :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attending_contest
menu.push :attendingcontest, {:controller => 'contests', :action => 'show_attendingcontest'}, :caption => :label_attending_contest
# menu.push :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attendin,g_contest
# menu.push :result, { :controller => 'bids', :action => 'show_results' },
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
end