修改了作业课程里面一些Bug

This commit is contained in:
huangjingquan 2013-10-09 16:14:11 +08:00
parent 7d2bdbc935
commit 9e77d3e001
11 changed files with 144 additions and 55 deletions

View File

@ -76,11 +76,12 @@ class BidsController < ApplicationController
#end
end
#huang
def contest
@project_type = params[:project_type]
# Modified by nie
# @requirement_title = "4"
@offset, @limit = api_offset_and_limit({:limit => 10})
@offset, @limit = api_offset_and_limit({:limit => 10})
@bids = Bid.visible.where('reward_type = ?', 2)
@ -131,7 +132,8 @@ class BidsController < ApplicationController
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
end
@s_state = 1
end
end
#end
end
def fork
@ -365,7 +367,6 @@ class BidsController < ApplicationController
@bid = Bid.new
@bid.safe_attributes = params[:bid]
end
#huang
def create_contest
@bid = Bid.new

View File

@ -71,6 +71,23 @@ module BidsHelper
content_tag('div', content, :class => "tabs")
end
#huang
def sort_contest(state)
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:contest_sort_type => '1')))
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:contest_sort_type => '0'), :class=>"selected"), :class=>"selected")
when 1
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:contest_sort_type => '1'), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:contest_sort_type => '0')))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
end
#end
def course_options_for_select(courses)
# <option value = '0'>#{l(:label_choose_reward)}</option>
html = ''

View File

@ -50,7 +50,7 @@ module WatchersHelper
def join_in_course(course, user)
return '' unless user && user.logged?
joined = user.member_of?(course)
text = joined ? '退出课程' : '加入课程'
text = joined ? '退出课程 ' : '加入课程'
url_t = join_path(:object_id => course.id)
url_f = try_join_path(:object_id => course.id)
method = joined ? 'delete' : 'post'

View File

@ -14,21 +14,11 @@
<tr>
<td> <% if bid.reward_type.nil? or bid.reward_type == 1%> <strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_call_bonus) %>&nbsp;<%= l(:label_RMB_sign) %><%= bid.budget%></span></strong> <% elsif bid.reward_type == 2%> <strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= bid.budget%></span></strong> <% else %> <!-- <strong><%= l(:label_bids_reward_method) %><span style="color: #00aa83;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_credit) %>&nbsp;<%= bid.budget%>&nbsp;<%= l(:label_bids_credit_number) %></span></strong> --> <% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%></strong></td> --></td>
</tr>
<% unless bid.reward_type == 3 %>
<tr>
<td><span class="font_lighter"><%= l(:label_x_biding_project, :count => bid.biding_projects.count) %>(<strong><%= link_to bid.biding_projects.count, project_for_bid_path(bid) %></strong>)</span><span class="font_lighter"><%= l(:label_x_bids_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span><span class="font_lighter"> <%= l(:label_x_followers, :count => bid.watcher_users.count) %>(<strong><%= link_to bid.watcher_users.count, respond_path(bid) %></strong>)</span></td>
</tr>
<% else %>
<tr>
<td><span class="font_lighter"><%= l(:label_x_homework_project, :count => bid.biding_projects.count) %>(<strong><%= link_to bid.biding_projects.count, project_for_bid_path(bid) %></strong>) </span><span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span><span class="font_lighter"> <%= l(:label_x_followers, :count => bid.watcher_users.count) %>(<strong><%= link_to bid.watcher_users.count, respond_path(bid) %></strong>)</span></td>
</tr>
<% unless bid.courses.empty? %>
<% teacher = Course.find_by_extra(bid.courses.first.identifier).teacher %>
<tr>
<td><span class="font_lighter">课程名称:<%= link_to bid.courses.first.name, project_path(bid.courses.first)%>&nbsp;&nbsp;教师:<%= link_to teacher.lastname+teacher.firstname, user_path(teacher) %></span></td>
</tr>
<% end %>
<% end %>
</table></td>
<td width="200" align="right" class="a"><span class="font_lighter"> <%= format_time bid.created_on %></span></td>
</tr>

View File

@ -28,7 +28,5 @@
</table></td>
</tr>
</table>
<div class="line_under"></div>
<div class="line_under"></div>
<% end %>

View File

@ -1,35 +1,112 @@
<!-- fq -->
<%= render_flash_messages %>
<% if @bid.reward_type == 3 %>
<table width="1000px" border="0" style="padding-left: 15px">
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_homework_project) %>(<%= @bidding_project.count%>)</td>
<% if User.current.logged? %>
<td>
<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 5, 7)).size >0) %>
<div class='icon icon-add'>
<%= toggle_link l(:button_bidding_homework), 'put-bid-form' %>
</div>
<% end %>
</td>
<% end %>
</table>
<% else %>
<table width="1000px" border="0" style="padding-left: 15px">
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_bidding_project) %>(<%= @bidding_project.count%>)</td>
<% if User.current.logged? %>
<% @bidding_project.each do |b_project|%>
<table width="90%" border="0" align='center'>
<tr>
<td>
<div class='icon icon-add'>
<%= toggle_link l(:button_bidding_homework), 'put-bid-form' %>
</div>
</td>
<% end %>
</table>
<table width="660px" border="0" align='center'>
<tr>
<td width="50px" valign="top" colspan="2" align="middle">
<div style="width: 50px; height: 50px;">
<%= link_to image_tag(url_to_avatar(b_project.project), :class => 'avatar3'), :class => "avatar" %>
</div></td>
<td width="60%" valign="top">
<table width="100%" valign="top">
<tr>
<td colspan="2" valign="top"><strong><%= link_to(b_project.project.name, project_path(b_project.project)) %></strong><a class="font_lighter"><%= l(:label_jion_bidding_homework)%></a></td>
</tr>
<tr></tr>
<tr>
<td valign="top"><%= b_project.project.description %></td>
</tr>
<tr>
<td valign="top"><a class="font_lighter"><%=format_time(b_project.created_at) %></a></td>
</tr>
</table></td>
<td width="30%">
<div class="bid-user-message" style="border-left: 1px solid rgb(225, 225, 225); margin-left: 20px; padding-left: 20px;">
<table width="100%">
<tr>
<td><%= l(:label_bidding_user_studentcode) %> : <%= @user.user_extensions.student_id %></td>
</tr>
<tr>
<td><%= l(:label_bidding_user_homework) %> : <%= link_to(b_project.user.name, user_path(b_project.user)) %></td>
</tr>
<tr>
<td style=" word-wrap: break-word; word-break: break-all"><%= l(:label_bidding_reason_homewrok) %> : <%= b_project.description %></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<% end %>
<% else %>
<table width="1000px" border="0" style="padding-left: 15px">
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_bidding_project) %>(<%= @bidding_project.count%>)</td>
<% if User.current.logged? %>
<td>
<div class='icon icon-add'>
<%= toggle_link l(:button_bidding), 'put-bid-form' %>
</div></td>
<% end %>
</table>
<% @bidding_project.each do |b_project|%>
<table width="90%" border="0" align='center'>
<tr>
<td>
<table width="660px" border="0" align='center'>
<tr>
<td width="50px" valign="top" colspan="2" align="middle">
<div style="width: 50px; height: 50px;">
<%= link_to image_tag(url_to_avatar(b_project.project), :class => 'avatar3'), :class => "avatar" %>
</div></td>
<td width="60%" valign="top">
<table width="100%" valign="top">
<tr>
<td colspan="2" valign="top"><strong><%= link_to(b_project.project.name, project_path(b_project.project)) %></strong><a class="font_lighter"><%= l(:label_join_bidding)%></a></td>
</tr>
<tr></tr>
<tr>
<td valign="top"><%= b_project.project.description %></td>
</tr>
<tr>
<td valign="top"><a class="font_lighter"><%= b_project.created_at%></a></td>
</tr>
</table></td>
<td width="30%">
<div class="bid-user-message" style="border-left: 1px solid rgb(225, 225, 225); margin-left: 20px; padding-left: 20px;">
<table width="100%">
<tr>
<td><%= l(:label_bidding_user) %><%= link_to(b_project.user.name, user_path(b_project.user)) %></td>
</tr>
<tr>
<td style=" word-wrap: break-word; word-break: break-all"><%= l(:label_bidding_reason) %><%= b_project.description %></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<% end %>
<% unless @bid.reward_type == 3%>
<%= render :partial=> "list_projects",:locals => {:bidding_project => @bidding_project,:bid => @bid }%>
<% end %>

View File

@ -31,7 +31,7 @@
</div>
<% end %>
<%= sort_bid(@s_state, @project_type)%>
<%= sort_contest(@s_state)%>
<!-- <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">
@ -51,3 +51,4 @@
<%= render :partial => 'contest_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
</div>

View File

@ -51,7 +51,8 @@
<td align="center">
<div class="info_font" style=" word-wrap: break-word; word-break: break-all">
<%= @project.name %>
</div> <% unless @course.teacher.id == User.current.id%>
</div>
<% unless @course.teacher.id == User.current.id%>
<!-- <%= image_tag "/images/sidebar/add.png" %>
<%= image_tag "/images/add.png" %> -->
<div class="icon-add icon" style="margin-right: 30px; margin-left: 20px">

View File

@ -5,15 +5,16 @@
<%= l(:label_project_course_un) %>
</p>
<% else %>
<p class="font_description">
<%= l(:label_project_course_unadd) %>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<p class="font_description">
<% if @user.user_extensions.identity == 0 %>
<%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<% else %>
<%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'index', :course => 1}, :class => 'icon icon-add' %>
<% end %>
</p>
</p>
<% end %>
<% else %>
<% if User.current.user_extensions.identity == 0 %>
<% if @user.user_extensions.identity == 0 %>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<% end %>
<ul class="user_project_sort">

View File

@ -6,11 +6,12 @@
</p>
<% else %>
<p class="font_description">
<%= l(:label_project_course_unadd) %>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<% if @user.user_extensions.identity == 0 %>
<%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<% else %>
<%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'index', :course => 1}, :class => 'icon icon-add' %>
<% end %>
</p>
</p>
<% end %>
<% else %>
<% if User.current.user_extensions.identity == 0 %>

View File

@ -838,7 +838,8 @@ zh:
label_project_unadd: "暂无项目,赶快去创建吧!"
label_project_un: "该用户暂未参与任何项目!"
label_project_course_un: "该用户暂未加入任何课程!"
label_project_course_unadd: "你还未创建课程,赶快去创建吧!"
label_project_course_unadd: "你还未创建课程,赶快去创建吧!"
label_project_cousre_studentun: "你还未加入任何课程,赶快加入吧!"
#end by huang
label_user_mail_option_selected: "收取选中项目的所有通知..."
label_user_mail_option_none: "不收取任何通知"
@ -1279,11 +1280,11 @@ zh:
label_user_response: 用户反馈
label_student_response: 学生反馈
label_bidding_project: 参与项目
label_homework_project: 已提交作业 #huang
label_homework_project: 已提交作业 #huang
button_bidding: 我要参加
field_enterprise: '企业:'
button_bidding_homework: 参加竞 #huang
button_bidding_homework: 参加竞 #huang
field_homework_type: 作业类型
label_homework_respond: 作业情况
@ -1538,6 +1539,7 @@ zh:
label_course: 课程
label_course_new: 新建课程
label_course_join_student: 加入课程
label_public_info: 若不公开,仅项目成员可见该项目
label_course_student: 学生
label_homework: 课程作业