diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index af81a69e..8d66bf1a 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -6,7 +6,7 @@ class BidsController < ApplicationController menu_item :homework_respond, :only => :homework_respond menu_item :homework_statistics, :only => :homework_statistics #Ended by young - before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork] + before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork, :show_course] before_filter :require_login,:only => [:set_reward] helper :watchers @@ -205,6 +205,28 @@ class BidsController < ApplicationController end end + + def show_course + bids = Bid.where('parent_id = ?', @bid.id) + @courses = [] + for bid in bids + @courses << bid.courses.first + end + + respond_to do |format| + if @bid.reward_type == 3 + format.html { + render :layout => 'base_homework' + } + else + format.html { + render :layout => 'base_bids' + } + end + format.api + + end + end def show_project # flash[:notice] = "" diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ef27bc69..14dad38b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -77,6 +77,7 @@ class UsersController < ApplicationController ##added by fq def watch_bids + cond = 'bids.reward_type <> 1' @bids = Bid.watched_by(@user) @bids = Bid.visible.where('reward_type = ?', 1) # modified by huang @offset, @limit = api_offset_and_limit({:limit => 10}) diff --git a/app/views/bids/show_course.html.erb b/app/views/bids/show_course.html.erb new file mode 100644 index 00000000..c5f81fea --- /dev/null +++ b/app/views/bids/show_course.html.erb @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/app/views/layouts/base_bids.html.erb b/app/views/layouts/base_bids.html.erb index c5c41a06..0c124609 100644 --- a/app/views/layouts/base_bids.html.erb +++ b/app/views/layouts/base_bids.html.erb @@ -55,16 +55,18 @@ <% if @bid.reward_type.nil? or @bid.reward_type == 1%> - <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= @bid.budget%> - <% elsif @bid.reward_type == 2%> - <%= l(:label_bids_reward_method) %><%= @bid.budget%> - <% else %> - <%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %> <%= @bid.budget%> <%= l(:label_bids_credit_number) %> - <% end %> + <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= @bid.budget%> + <% elsif @bid.reward_type == 2%> + <%= l(:label_bids_reward_method) %><%= @bid.budget%> + <% else %> + <%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %> <%= @bid.budget%> <%= l(:label_bids_credit_number) %> + <% end %> <%= l(:label_investment_time_limit) %><%= @bid.deadline%> - + + +
该需求已经被 <%= link_to(Bid.where('parent_id = ?', @bid.id).count, show_course_path(@bid), :class => 'reference') %> 个课程引用为作业
@@ -73,6 +75,7 @@ <%= link_to l(:label_x_bids_responses, :count => @bid.commit)+"("+@bid.commit.to_s+")", respond_path(@bid)%>
+
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 128f4bda..d8eddbed 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -94,11 +94,12 @@
- + + - - - + + + diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 36571453..420ac18e 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -68,8 +68,9 @@ <% unless @bid.parent_id.nil?%> - + <% end %>
<%= l(:label_main_teacher) %><%=link_to (@course.teacher.lastname+@course.teacher.firstname) %>
<%= l(:label_main_teacher) %><%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher)) %>
<%= l(:label_main_term) %><%= @course.time %> -- <%= @course.term %>
- <%= l(:label_homework_source) %>:<%= link_to(Bid.find(@bid.parent_id).name, respond_path(Bid.find(@bid.parent_id))) %>
+ <% author=Bid.find(@bid.parent_id).author%> + 作业来源于<%= link_to(author.lastname+author.firstname, user_path(Bid.find(@bid.parent_id).author))%>的需求:<%= link_to(Bid.find(@bid.parent_id).name, respond_path(Bid.find(@bid.parent_id))) %>
diff --git a/app/views/projects/member.html.erb b/app/views/projects/member.html.erb index bfaad722..f0b94c6e 100644 --- a/app/views/projects/member.html.erb +++ b/app/views/projects/member.html.erb @@ -14,16 +14,16 @@ <% end %> <%= member.user.nil? ? '' : (link_to image_tag(url_to_avatar(member.user), :class => 'avatar'), :class => "avatar") %> <%= content_tag "div", link_to_user(member.principal), :class => "nomargin avatar_name" %> - + <% if @project.project_type == 1 %>

<% if member.roles.sort.collect(&:to_s).join(', ') =='Manager' %> - 老师 + <%= l(:label_teacher) %> <% elsif member.roles.sort.collect(&:to_s).join(', ') =='Reporter' %> - 学生 + <%= l(:label_student) %> <% elsif member.roles.sort.collect(&:to_s).join(', ') =='TA' %> - 助教 - <% else %> + <%= l(:label_TA) %> + <% else %> <% end %>

diff --git a/app/views/users/watch_bids.html.erb b/app/views/users/watch_bids.html.erb index 60ff3a69..fd3de7c4 100644 --- a/app/views/users/watch_bids.html.erb +++ b/app/views/users/watch_bids.html.erb @@ -22,7 +22,6 @@ <% elsif bid.reward_type == 2%> <%= l(:label_bids_reward_method) %><%= bid.budget%> <% else %> - <%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %> <%= bid.budget%> <%= l(:label_bids_credit_number) %> <% end %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index ecd2ee50..984b8b44 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1518,6 +1518,7 @@ zh: label_teacher: 教师 label_teacher_homework: 教师姓名 label_student: 学生 + label_TA: 助教 label_other: 其他 label_enterprise: 企业 label_developer: 用户 @@ -1537,6 +1538,7 @@ zh: button_submit_homework: 提交作业 label_my_course: 我的课程 button_submit_bid: 参与竞标 + label_requirement_from: 需求来源 #end @@ -1619,4 +1621,4 @@ zh: label_new_join: 加入 label_new_join_order: 请输入课程密码 label_task_submit_form_accessory: 作业最终以附件形式提交 - label_task_submit_form_project: 作业最终以项目形式提交 \ No newline at end of file + label_task_submit_form_project: 作业最终以项目形式提交 diff --git a/config/routes.rb b/config/routes.rb index 0db7afc7..3df494b5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -453,6 +453,7 @@ RedmineApp::Application.routes.draw do match 'calls/:id/create_fork', :to => 'bids#create_fork' match 'project/enterprise_course', :to => 'projects#enterprise_course' match 'project/course_enterprise', :to => 'projects#course_enterprise' + match 'calls/:id/show_course', :to => 'bids#show_course', :as => 'show_course' post 'join_in/join', :to => 'courses#join', :as => 'join' delete 'join_in/join', :to => 'courses#unjoin' diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index f5ccc53d..92d1e6e6 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -1807,6 +1807,9 @@ input[type='text'].noline { cursor: text; border-radius: 4px; # added by bai (边框变圆润) } +a.reference { + font-size: 22px; +} .grayline{ border: #d5dee9 1px solid; font-size: 12px;