From 3f8f1411079f86e25422e27198f5654f794d4843 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 27 Jun 2014 15:35:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=B6=EF=BC=8C=E7=94=B1=E4=BA=8E=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5=E5=90=8E=EF=BC=8C=E5=86=8D?= =?UTF-8?q?=E6=AC=A1=E8=BE=93=E5=85=A5=E9=94=99=E8=AF=AF=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BC=9A=E6=8A=A5=E9=94=99=E3=80=82=E5=A6=82=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0=E6=AD=A3=E7=A1=AE=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E8=BF=9B=E5=85=A5=E4=B8=80=E4=B8=AA=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 4 ++++ app/controllers/courses_controller.rb | 16 +++------------- app/views/bids/_bid_homework_show.html.erb | 19 +++++++++++-------- app/views/courses/_course_form.html.erb | 13 ++++++++----- app/views/courses/new_homework.html.erb | 3 +-- 5 files changed, 27 insertions(+), 28 deletions(-) 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" %>