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 %>

<%= l(:label_attachment_plural) %> -
<%= render :partial => 'attachments/form', :locals => {:container => @bid} %>
+

<%= render :partial => 'attachments/form', :locals => {:container => @homework} %>

\ 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 @@ + +

<%= l(:label_edit_homework) %>

<%= labelled_form_for @bid do |f| %>
- <%= render :partial => 'homework_form', :locals => { :f => f } %> - <%= submit_tag l(:button_create) %> - <%= javascript_tag "$('#bid_name').focus();" %> + <%#= render :partial => 'homework_form', :locals => { :f => f } %> + <%= render :partial => 'homework_form', :locals => { :f => f } %> + <% end %>
\ No newline at end of file diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index f93d57f90..4b63b8852 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -34,9 +34,9 @@ <%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>

--> <% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %> -

<%= 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 %>