<% if @project %>
- <%= label_tag l(:field_subject) %>: <%= link_to @topic.subject.truncate(29, omission: '...'), project_boards_path(@topic.project),title: @topic.subject.to_s %>
+ <%= label_tag l(:field_subject) %>: <%= link_to @topic.subject, project_boards_path(@topic.project),title: @topic.subject.to_s %>
<% elsif @course %>
- <%= label_tag l(:field_subject) %>: <%= link_to @topic.subject.truncate(29,omission:'...'), course_boards_path(@topic.course),title: @topic.subject.to_s %>
+ <%= label_tag l(:field_subject) %>: <%= link_to @topic.subject, course_boards_path(@topic.course),title: @topic.subject.to_s %>
<% end %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index aeaa344e9..7ddff7d04 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2143,3 +2143,5 @@ zh:
lable_bar_active: 贴吧动态
lable_student_list_visable: 学生列表是否公开
lable_sure_exit_project: 是否确认退出该项目
+ lable_input_class: 在此输入课时
+ lable_input_class_vilidate: 学时只能为整数
From 341ee214c1d0ab87eb7ae736e15a9b816f6c458e Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 9 Oct 2014 09:13:50 +0800
Subject: [PATCH 10/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A=E8=BF=9B=E5=85=A5=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=E5=88=97=E8=A1=A8=E6=8A=A5=E9=94=99=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../20141009010934_update_bids_proportion.rb | 12 +++++++++
db/schema.rb | 25 ++++++++++---------
2 files changed, 25 insertions(+), 12 deletions(-)
create mode 100644 db/migrate/20141009010934_update_bids_proportion.rb
diff --git a/db/migrate/20141009010934_update_bids_proportion.rb b/db/migrate/20141009010934_update_bids_proportion.rb
new file mode 100644
index 000000000..b589a6c32
--- /dev/null
+++ b/db/migrate/20141009010934_update_bids_proportion.rb
@@ -0,0 +1,12 @@
+class UpdateBidsProportion < ActiveRecord::Migration
+ def up
+ Bid.where("proportion is null").each do |bid|
+ bid.proportion = 60
+ bid.save
+ end
+ end
+
+ def down
+
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e13ff4942..172a11ec5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140916005319) do
+ActiveRecord::Schema.define(:version => 20141009010934) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -350,6 +350,7 @@ ActiveRecord::Schema.define(:version => 20140916005319) do
t.integer "rgt"
t.integer "is_public", :limit => 1, :default => 1
t.integer "inherit_members", :limit => 1, :default => 1
+ t.integer "open_student", :default => 0
end
create_table "custom_fields", :force => true do |t|
@@ -437,9 +438,9 @@ ActiveRecord::Schema.define(:version => 20140916005319) do
t.string "web_title"
t.string "title"
t.text "description"
+ t.string "page_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
- t.string "page_type"
t.integer "sort_type"
t.integer "image_width", :default => 107
t.integer "image_height", :default => 63
@@ -878,18 +879,18 @@ ActiveRecord::Schema.define(:version => 20140916005319) do
create_table "relative_memos", :force => true do |t|
t.integer "osp_id"
t.integer "parent_id"
- t.string "subject", :null => false
- t.text "content", :null => false
+ t.string "subject", :null => false
+ t.text "content", :limit => 16777215, :null => false
t.integer "author_id"
- t.integer "replies_count", :default => 0
+ t.integer "replies_count", :default => 0
t.integer "last_reply_id"
- t.boolean "lock", :default => false
- t.boolean "sticky", :default => false
- t.boolean "is_quote", :default => false
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "viewed_count_crawl", :default => 0
- t.integer "viewed_count_local", :default => 0
+ t.boolean "lock", :default => false
+ t.boolean "sticky", :default => false
+ t.boolean "is_quote", :default => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "viewed_count_crawl", :default => 0
+ t.integer "viewed_count_local", :default => 0
t.string "url"
t.string "username"
t.string "userhomeurl"
From 0a0a5d67146970e4f784b0ede550e1a5489a3a21 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 9 Oct 2014 09:19:21 +0800
Subject: [PATCH 11/14] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/bids/_homework_list.html.erb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb
index 9bf997cbe..514092988 100644
--- a/app/views/bids/_homework_list.html.erb
+++ b/app/views/bids/_homework_list.html.erb
@@ -136,7 +136,8 @@
终评得分:
<%# totle_homework_score = score_for_homework(homework) %>
- <% totle_homework_score = format("%.2f",(homework.t_score.nil? ? 0.00 : homework.t_score) * (@bid.proportion * 1.0 / 100) + (homework.s_score.nil? ? 0.00 : homework.s_score) * (1 - @bid.proportion * 1.0 / 100)) %>
+ <% totle_homework_score = format("%.2f",(homework.t_score.nil? ? 0.00 : homework.t_score) * ((@bid.proportion.nil? ? 60 : @bid.proportion) * 1.0 / 100) +
+ (homework.s_score.nil? ? 0.00 : homework.s_score) * (1 - (@bid.proportion.nil? ? 60 : @bid.proportion) * 1.0 / 100)) %>
;">
<% score = totle_homework_score == "0.00"? "N/A" : totle_homework_score %>
<%= score %>
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 12/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=E3=80=81=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E4=BB=A5=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 %>
<%= 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 %>
From 65de079ad9913a72aed293330200274c99c08c7b Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 9 Oct 2014 10:21:39 +0800
Subject: [PATCH 13/14] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/bids_controller.rb | 9 ++++++++-
app/views/bids/_homework_list.html.erb | 9 ++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index 29a7760d6..0cf8ea45d 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -496,11 +496,18 @@ class BidsController < ApplicationController
#@homework_list = @bid.homeworks
#增加作业按评分排序,
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
- @homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
+ all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.author_id}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.author_id}) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) DESC,created_at ASC")
+
+ limit = 10
+ feedback_count = all_homework_list.count
+ @feedback_pages = Paginator.new feedback_count, limit, params['page']
+ offset ||= @feedback_pages.offset
+ @homework_list = all_homework_list[offset, limit]
+
if params[:student_id].present?
@temp = []
@homework_list.each do |pro|
diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb
index 514092988..3ed809fe0 100644
--- a/app/views/bids/_homework_list.html.erb
+++ b/app/views/bids/_homework_list.html.erb
@@ -153,4 +153,11 @@
-<% end %>
\ No newline at end of file
+<% end %>
+
+
+
\ No newline at end of file
From 1361801723d3416aa42f5843f2a72418dda10eb5 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 9 Oct 2014 11:16:45 +0800
Subject: [PATCH 14/14] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E6=8F=8F=E8=BF=B0=E6=9C=80=E9=95=BF=E9=99=90=E5=AE=9A254?=
=?UTF-8?q?=E4=B8=AA=E5=AD=97=E7=AC=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/attachments/_form.html.erb | 2 +-
public/javascripts/attachments.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb
index d6cbb72fe..16de21226 100644
--- a/app/views/attachments/_form.html.erb
+++ b/app/views/attachments/_form.html.erb
@@ -3,7 +3,7 @@
<% container.attachments.each_with_index do |attachment, i| %>
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
- <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
+ <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<%= l(:field_is_public)%>:
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, :class => 'is_public')%>
<%= if attachment.id.nil?
diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js
index 1b60b370e..c20617ce5 100644
--- a/public/javascripts/attachments.js
+++ b/public/javascripts/attachments.js
@@ -22,7 +22,7 @@ function addFile(inputEl, file, eagerUpload) {
fileSpan.append(
$(' ', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
- $(' ', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 255, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
+ $(' ', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
$('公开: ').attr({ 'class': 'ispublic-label' }) ,
$(' ', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public]', checked:'checked' } ).toggle(!eagerUpload),
$('  ').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),