From f83668bf735cfb566b30c815f1e1c53bc1507345 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 9 Oct 2014 10:10:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E3=80=81=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=A2=9E=E5=8A=A0js=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 12 ++++- app/views/bids/_homework_form.html.erb | 61 ++++++++++++----------- app/views/bids/edit.html.erb | 57 +++++++++++++++++++-- app/views/courses/_homework_form.html.erb | 4 +- 4 files changed, 98 insertions(+), 36 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 7264c03ee..29a7760d6 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -839,8 +839,18 @@ class BidsController < ApplicationController def update @bid = Bid.find(params[:id]) @course = @bid.courses.first#Project.find(params[:course_id]) + @bid.name = params[:bid][:name] + @bid.description = params[:bid][:description] + @bid.is_evaluation = params[:bid][:is_evaluation] + @bid.proportion = params[:bid][:proportion] + @bid.reward_type = 3 + @bid.deadline = params[:bid][:deadline] + @bid.budget = 0 + @bid.author_id = User.current.id + @bid.commit = 0 + @bid.homework_type = 1 @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) - if @bid.update_attributes(params[:bid]) && @bid.save + if @bid.save flash[:notice] = l(:label_update_homework_succeed) redirect_to course_homework_path(@course) else diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index 463b2b621..226eae650 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -1,44 +1,45 @@ <%= error_messages_for 'bid' %> -
<%= l(:label_homeworks_form_new_description) %>
-<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %>
++ <%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :onblur => "regexName();" %> -
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>
- -<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%>
-<%= f.select :is_evaluation, is_evaluation_option %> -
<%= hidden_field_tag 'course_id', @project_id %> +
+<%= f.select :proportion, proportion_option %> +
+<%= hidden_field_tag 'course_id', @course.id %>
\ No newline at end of file diff --git a/app/views/bids/edit.html.erb b/app/views/bids/edit.html.erb index 4cc181146..fe92977ae 100644 --- a/app/views/bids/edit.html.erb +++ b/app/views/bids/edit.html.erb @@ -1,9 +1,60 @@ + +<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %><%= calendar_for('bid_deadline')%> +
<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %> + <%= calendar_for('bid_deadline')%> -
<%= f.select :is_evaluation, is_evaluation_option %>