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 @@ +
<%= link_to image_tag(url_to_avatar(course), :class => 'avatar'), project_path(course) %> | +
+
|
+
<%= 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 %> | 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 @@
+ |
+ <% 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))) %> |
<% 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 %>