This commit is contained in:
parent
8e51ea7327
commit
2c45fb8760
|
@ -24,7 +24,7 @@ class BidsController < ApplicationController
|
|||
# elsif
|
||||
# @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4)
|
||||
else
|
||||
@bids = Bid.visible.where('reward_type = ? or reward_type = ?', 1, 2)
|
||||
@bids = Bid.visible.where('reward_type = ?', 1)
|
||||
end
|
||||
|
||||
@bids = @bids.like(params[:name]) if params[:name].present?
|
||||
|
@ -76,6 +76,64 @@ class BidsController < ApplicationController
|
|||
#end
|
||||
end
|
||||
|
||||
def contest
|
||||
@project_type = params[:project_type]
|
||||
# Modified by nie
|
||||
# @requirement_title = "4"
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
|
||||
@bids = Bid.visible.where('reward_type = ?', 2)
|
||||
|
||||
# elsif
|
||||
# @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4)
|
||||
@bids = @bids.like(params[:name]) if params[:name].present?
|
||||
@bid_count = @bids.count
|
||||
@bid_pages = Paginator.new @bid_count, @limit, params['page']
|
||||
|
||||
@offset ||= @bid_pages.reverse_offset
|
||||
#added by nie
|
||||
if params[:bid_sort_type].present?
|
||||
case params[:bid_sort_type]
|
||||
when '0'
|
||||
unless @offset == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 0
|
||||
when '1'
|
||||
unless @offset == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 1
|
||||
when '2'
|
||||
unless @offset == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
end
|
||||
@s_state = 0
|
||||
end
|
||||
else
|
||||
unless @offset == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 1
|
||||
end
|
||||
end
|
||||
|
||||
def fork
|
||||
@courses = []
|
||||
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
|
@ -308,6 +366,36 @@ class BidsController < ApplicationController
|
|||
@bid.safe_attributes = params[:bid]
|
||||
end
|
||||
|
||||
#huang
|
||||
def create_contest
|
||||
@bid = Bid.new
|
||||
@bid.name = params[:bid][:name]
|
||||
@bid.description = params[:bid][:description]
|
||||
@bid.reward_type = params[:bid_reward_type]
|
||||
@bid.budget = params[:bid][:budget]
|
||||
@bid.deadline = params[:bid][:deadline]
|
||||
@bid.author_id = User.current.id
|
||||
@bid.commit = 0
|
||||
if @bid.save
|
||||
unless @bid.watched_by?(User.current)
|
||||
if @bid.add_watcher(User.current)
|
||||
flash[:notice] = l(:label_bid_succeed)
|
||||
end
|
||||
end
|
||||
redirect_to respond_path(@bid)
|
||||
else
|
||||
@bid.safe_attributes = params[:bid]
|
||||
render :action => 'new_bid'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#huang
|
||||
def new_contest
|
||||
@bid = Bid.new
|
||||
@bid.safe_attributes = params[:bid]
|
||||
end
|
||||
|
||||
def create_bid
|
||||
@bid = Bid.new
|
||||
@bid.name = params[:bid][:name]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!-- fq -->
|
||||
|
||||
<% else %>
|
||||
<script type="text/javascript" language="javascript">
|
||||
function show(id, id_t, label_reward, label_money, label_credit, label_content) {
|
||||
var text = $('#' + id);
|
||||
|
@ -19,7 +19,6 @@
|
|||
return content;
|
||||
}
|
||||
</script>
|
||||
|
||||
<%= error_messages_for 'bid' %>
|
||||
<!--[form:project]-->
|
||||
<p style="width:500px;"><%= l(:label_bids_form_new_description) %></p>
|
||||
|
@ -35,3 +34,4 @@
|
|||
</p>
|
||||
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<!-- huang -->
|
||||
<script type="text/javascript" language="javascript">
|
||||
function show(id, id_t, label_reward, label_money, label_credit, label_content) {
|
||||
var text = $('#' + id);
|
||||
var text_t = $('#' + id_t);
|
||||
if (text.val() == 0) {
|
||||
text_t.attr("placeholder", label_reward);
|
||||
}
|
||||
if (text.val() == 1) {
|
||||
text_t.attr("placeholder", label_money);
|
||||
}
|
||||
if (text.val() == 3) {
|
||||
text_t.attr("placeholder", label_credit);
|
||||
}
|
||||
if (text.val() == 2) {
|
||||
text_t.attr("placeholder", label_content);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
</script>
|
||||
<%= error_messages_for 'bid' %>
|
||||
<!--[form:project]-->
|
||||
<p style="width:500px;"><%= l(:label_bids_form_contest_new_description) %></p>
|
||||
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_name)}" %></p>
|
||||
|
||||
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %></p>
|
||||
<p><%= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
|
||||
:onChange => "show('bid_reward_type', 'bid_budget', '"+l(:label_bids_reward_what)+"','"+l(:label_bids_new_money)+"','"+l(:label_bids_new_credit)+"','"+l(:label_bids_new_content)+"')" %>
|
||||
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
|
||||
|
||||
<!-- 设置奖项设置的打开 关闭开关-->
|
||||
</p>
|
||||
<!-- <em class="info" style="margin-left:95px;"><%= l(:text_contest_reward) %></em> -->
|
||||
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%></p>
|
|
@ -0,0 +1,53 @@
|
|||
<!-- fq -->
|
||||
<%= form_tag(calls_path, :method => :get) do %>
|
||||
<div class="project-search-block">
|
||||
<table width="100%" valign="center">
|
||||
<tr>
|
||||
<td width="16%"><span style="margin-left:0px">
|
||||
竞赛列表
|
||||
</span></td>
|
||||
<td valign="center"><% if User.current.logged? %>
|
||||
|
||||
<!-- <div class='icon icon-add'> -->
|
||||
<%= link_to(l(:label_newtype_contest), {:controller => 'bids', :action => 'new_contest'}, :class => 'icon icon-add') %>
|
||||
<!-- <%= toggle_link l(:label_new_call), 'put-bid-form', {:focus => 'project_id'} %> -->
|
||||
<!-- </div> -->
|
||||
<% end %></td>
|
||||
|
||||
<td align="right">
|
||||
<div class="project-search">
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
|
||||
<%= submit_tag l(:label_search), :class => "small", :name => nil %>
|
||||
|
||||
</div></td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<%end%>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<div id="put-bid-form" style="display: none">
|
||||
<%= render :partial => 'new_bid' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= sort_bid(@s_state, @project_type)%>
|
||||
|
||||
<!-- <div class="pagination" style="border-bottom: 1px solid rgb(223,223,223); width: 95%; margin-left: 2%; margin-top: 15px" >
|
||||
<ul style="margin-right:0px">
|
||||
<li>
|
||||
<%= link_to l(:label_sort_by_time), calls_path(:bid_sort_type => '0') %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_sort_by_active), calls_path(:bid_sort_type => '1') %>
|
||||
</li>
|
||||
<!-- <li>
|
||||
<%= link_to l(:label_sort_by_influence), calls_path(:bid_sort_type => '2') %>
|
||||
</li> -->
|
||||
<!-- </ul>
|
||||
</div> -->
|
||||
|
||||
<div id="bid-show">
|
||||
<%= render :partial => 'contest_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<!-- huang -->
|
||||
<h3><%=l(:label_newtype_contest)%></h3>
|
||||
|
||||
<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_bid'} do |f| %>
|
||||
<div class="box tabular">
|
||||
<%= render :partial => 'form_contest', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= javascript_tag "$('#bid_name').focus();" %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -87,13 +87,10 @@
|
|||
<tr>
|
||||
<td valign="top" style="padding-left: 8px;"><%= l(:label_main_teacher) %></td><td class="font_lighter_sidebar"><%= @course.teacher.lastname+@course.teacher.firstname %></td>
|
||||
</tr>
|
||||
<!-- added by bai -->
|
||||
<tr>
|
||||
<td valign="top" style="padding-left: 8px;"><%= l(:label_course_time) %></td><td class="font_lighter_sidebar"><%= @course.time %></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign="top" style="padding-left: 8px;"><%= l(:label_main_term) %></td><td class="font_lighter_sidebar"><%= @course.term %></td>
|
||||
<td valign="top" style="padding-left: 8px;"><%= l(:label_main_term) %></td><td class="font_lighter_sidebar"><%= @course.time %> -- <%= @course.term %></td>
|
||||
</tr>
|
||||
<!-- end -->
|
||||
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
<td>
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong><%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author), :class => 'bid_user') %>: <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></strong></td>
|
||||
<td colspan="2" valign="top"><strong><%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author), :class => 'bid_user') %>:
|
||||
<%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %>
|
||||
<%= l(:label_course_homework) %> : <%= link_to(bid.courses.first.name, project_path(bid.courses.first)) %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="500">
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
<td>
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong><%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author), :class => 'bid_user') %>: <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></strong></td>
|
||||
<td colspan="2" valign="top"><strong><%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author), :class => 'bid_user') %>: <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %>
|
||||
|
||||
<%= l(:label_course_homework) %> : <%= link_to(bid.courses.first.name, project_path(bid.courses.first)) %>
|
||||
</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="500">
|
||||
|
|
|
@ -741,6 +741,7 @@ zh:
|
|||
label_time_tracking: 时间跟踪
|
||||
label_change_plural: 变更
|
||||
label_statistics: 统计
|
||||
label_contest: 竞赛
|
||||
label_commits_per_month: 每月提交次数
|
||||
label_commits_per_author: 每用户提交次数
|
||||
label_view_diff: 查看差别
|
||||
|
@ -972,6 +973,7 @@ zh:
|
|||
text_caracters_minimum: "至少需要 %{count} 个字符。"
|
||||
text_length_between: "长度必须在 %{min} 到 %{max} 个字符之间。"
|
||||
text_command: 学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。
|
||||
text_contest_reward: 选择奖励后输入描述。
|
||||
text_tracker_no_workflow: 此跟踪标签未定义工作流程
|
||||
text_unallowed_characters: 非法字符
|
||||
text_comma_separated: 可以使用多个值(用逗号,分开)。
|
||||
|
@ -1287,6 +1289,8 @@ zh:
|
|||
|
||||
label_bid_me: 我要应标
|
||||
label_new_call: 发布需求
|
||||
|
||||
label_newtype_contest: 发布竞赛
|
||||
label_user_information: "与我相关"
|
||||
label_bid_succeed: "需求发布成功"
|
||||
label_wrong_budget: 错误的金额格式
|
||||
|
@ -1337,7 +1341,9 @@ zh:
|
|||
label_question_requirement: 对作业提出了问题!
|
||||
label_deadline: 投资时限yyyy-mm-dd
|
||||
label_requirement_name: 在此输入需求名称
|
||||
label_contest_name: 在此输入竞赛名称
|
||||
label_requirement_description: 内容:对你的需求进行描述
|
||||
label_contest_description: 内容:对你的竞赛进行描述
|
||||
label_requirement_bargain_money: 输入具体奖励方式(如金钱、奖项、学分)
|
||||
button_upload_photo: 上传图片
|
||||
label_leave_me_message: 给我留言了
|
||||
|
@ -1466,6 +1472,7 @@ zh:
|
|||
label_bids_reward_what: 输入奖励内容
|
||||
label_call_bonus: 奖金
|
||||
label_bids_form_new_description: 企业可以在此发布一个软件开发任务或者一个技术方案需求:(1)获得价廉物美的解决方案;(2)发现对此项任务有贡献的大学生,获得可以招聘的人才。
|
||||
label_bids_form_contest_new_description: 企业或者高校可以在此发布一个竞赛。
|
||||
label_homeworks_form_new_description: 发布一个作业,作业提交方式可以是附件或者项目形式,在作业类型里面设置。
|
||||
label_fork_form_new_description: 该需求将作为某课程的作业被发布,作业提交方式可以使附件或者项目形式,在作业类型里面设置。
|
||||
label_bids_new_money: 输入奖励金额,如 500,2.5等
|
||||
|
|
|
@ -437,6 +437,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'calls/more', :to => 'bids#more'
|
||||
get 'calls/back', :to=> 'bids#back'
|
||||
match 'calls/new_bid', :controller => 'bids', :action => 'new_bid'
|
||||
match 'contest/new_contest', :controller => 'bids', :action => 'new_contest' #huang
|
||||
match 'calls/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid'
|
||||
match 'calls/:id/show_project_homework', :controller => 'bids', :action => 'show_project_homework', :as => 'project_for_bid_homework' # by huang
|
||||
match 'calls/:id/add', :controller => 'bids', :action => 'add'
|
||||
|
@ -444,6 +445,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond'
|
||||
match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback'
|
||||
match 'calls/create_bid', :to => 'bids#create_bid'
|
||||
match 'contest/create_contest', :to => 'bids#create_contest' #huang
|
||||
match 'calls/create_homework', :to => 'bids#create_homework'
|
||||
match 'calls/:id/homework_respond', :to => 'bids#homework_respond'
|
||||
match 'calls/:id/homework_statistics', :to => 'bids#homework_statistics'
|
||||
|
@ -471,6 +473,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'calls', :controller => 'bids', :action => 'index'
|
||||
|
||||
match 'calls/:id', :controller => 'bids', :action => 'show', :as => 'respond'
|
||||
match 'contest', :controller => 'bids', :action => 'contest'
|
||||
|
||||
######added by nie
|
||||
match 'tags/show_projects_tags',:to => 'tags#show_projects_tags'
|
||||
|
|
|
@ -239,7 +239,7 @@ Redmine::MenuManager.map :top_college_menu do |menu|
|
|||
menu.push :home, :home_path
|
||||
menu.push :new_course, {:controller => 'projects', :action => 'course', :project_type => 1 }
|
||||
menu.push :new_homework, {:controller => 'bids', :action => 'index', :project_type => 1 }
|
||||
# menu.push :new_contest, {:controller => 'bids', :action => 'index', :project_type => 1 }
|
||||
menu.push :new_contest, {:controller => 'bids', :action => 'contest', :project_type => 1}
|
||||
menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 1 }, :caption => :label_project_plural
|
||||
menu.push :developer, {:controller => 'users', :action => 'index', :project_type => 1 }
|
||||
menu.push :enterprise_into, {:controller=>'projects', :action=>'enterprise_course', :project_type => 0 }
|
||||
|
|
Loading…
Reference in New Issue