diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 87879f242..ba1a2b817 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -805,6 +805,10 @@ class BidsController < ApplicationController @homework = @bid @course = Course.find_by_id(params[:course_id]) @course_id = @course.id + #respond_to do |format| + # format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'} + # format.api { render_validation_errors(@bid) } + #end render file: 'courses/new_homework', layout: 'base_courses' end end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index c0d7c1e25..3a81d36d4 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -489,19 +489,9 @@ class CoursesController < ApplicationController # 新建作业 def new_homework - if (User.current.logged? && - (User.current.admin? || - ( - !Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && - ( - Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles && - ( Role.where(id: [3, 4, 7, 9]).size > 0 ) - ) - ) - ) - ) - @homework = Bid.new - @homework.safe_attributes = params[:bid] + @homework = Bid.new + @homework.safe_attributes = params[:bid] + if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] )) render :layout => 'base_courses' else render_404 diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 179e2d58f..6f0b35ae9 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -70,8 +70,8 @@ - <% 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%> + <% 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 %> <% end %> @@ -83,9 +83,12 @@ - <%= l(:label_create_time) %> :  <%=format_time bid.created_on %> <%= l(:field_deadline) %> :  <%=bid.deadline %> - - + + + <%= l(:label_create_time) %> :  <%=format_time bid.created_on %> <%= l(:field_deadline) %> :  <%=bid.deadline %> + + + @@ -94,7 +97,7 @@ <% end %> \ No newline at end of file diff --git a/app/views/courses/_course_form.html.erb b/app/views/courses/_course_form.html.erb index d223bbad6..ddcad7b9b 100644 --- a/app/views/courses/_course_form.html.erb +++ b/app/views/courses/_course_form.html.erb @@ -94,7 +94,8 @@ - ".html_safe %>

+ ".html_safe %> +

<% elsif @course.time == 2009 %>

@@ -237,7 +238,8 @@ ".html_safe %>
<%= l(:label_term) %> *  

<% end %> - <% end %> + <% end %> + <% unless @course.nil? %> <% if @course.term == l(:label_spring) %> @@ -277,7 +279,8 @@ <% end %> - <% end %>

+ <% end %> +

@@ -292,12 +295,12 @@ - +

<%= l(:text_command) %> <% end %> - +

diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb index e1fd553b0..335ce910e 100644 --- a/app/views/courses/new_homework.html.erb +++ b/app/views/courses/new_homework.html.erb @@ -1,6 +1,5 @@

<%=l(:label_course_new_homework)%>

- -<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework'} do |f| %> +<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<%= render :partial => 'homework_form', :locals => { :f => f } %> <%= submit_tag l(:button_create), :class => "enterprise" %>