<%= l(:label_task_plural)%>(<%= @homework_list.count%>)
<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(
- User.current.admin? ||
- !(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) ||
+ User.current.admin? ||
+ !(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) ||
(Rails.env.development?) %>
|
@@ -25,8 +27,8 @@
<% @homework_list.each do |homework|%>
<% if homework.attachments.any?%>
-
- <%= image_tag(url_to_avatar(homework.user), :class => "avatar")%> |
+
+ <%= image_tag(url_to_avatar(homework.user), :class => "avatar")%> |
@@ -44,8 +46,12 @@
<% end %>
- <% if display_id %>
+ <% if is_student %>
<%= link_to "互评>>" , homework_attach_path(homework)%>
+ <% else %>
+ <% if is_teacher %>
+ <%= link_to "综评>>" , homework_attach_path(homework)%>
+ <% end %>
<% end %>
|
@@ -71,7 +77,7 @@
- <% if display_id %>
+ <% if is_cur_course_user? @bid %>
<%= l(:label_bidding_user_studentcode) %> : <%= homework.user.user_extensions.student_id%>
<% end %>
|
diff --git a/app/views/homework_attach/_addjour.html.erb b/app/views/homework_attach/_addjour.html.erb
index a5e7bed66..6cb35bccc 100644
--- a/app/views/homework_attach/_addjour.html.erb
+++ b/app/views/homework_attach/_addjour.html.erb
@@ -56,6 +56,7 @@
:url => {:controller => 'homework_attach',
:action => 'addjours',
:jour_id => homework_attach.id,
+ :is_comprehensive_evaluation => is_comprehensive_evaluation,
:sta => sta}) do |f|%>
diff --git a/app/views/homework_attach/_comprehensive_evaluation.html.erb b/app/views/homework_attach/_comprehensive_evaluation.html.erb
new file mode 100644
index 000000000..df0c03b21
--- /dev/null
+++ b/app/views/homework_attach/_comprehensive_evaluation.html.erb
@@ -0,0 +1,50 @@
+<% is_teacher = is_course_teacher User.current,homework.bid.courses.first %>
+<% if comprehensive_evaluation != nil && comprehensive_evaluation.count > 0 %>
+ <% stars = homework.rates(:quality).where("rater_id = #{comprehensive_evaluation.first.user.id}").select("stars").first.stars * 2 * 10 %>
+
+
+
+ <%= comprehensive_evaluation.first.notes%>
+
+ <% if is_teacher %>
+ 评分:
+ <%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>
+ (您可以重新打分,打分结果以最后一次打分为主!)
+
+ <% end %>
+
+<% else %>
+ <% if is_teacher %>
+
+
+ 作业综评:
+
+ 评分:
+ <%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>
+ (您可以重新打分,打分结果以最后一次打分为主!)
+
+
+ <%= render :partial => 'addjour', :locals => {:homework_attach => homework, :sta => 0,:is_comprehensive_evaluation => 1} %>
+
+
+ <% else %>
+
+
+ 作业综评:
+
+ 老师还未进行评价!
+
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/homework_attach/_showjour.html.erb b/app/views/homework_attach/_showjour.html.erb
index 939deff3b..529767138 100644
--- a/app/views/homework_attach/_showjour.html.erb
+++ b/app/views/homework_attach/_showjour.html.erb
@@ -38,10 +38,25 @@
<% if jour.size > 0 %>
<% for journal in jour%>
+ <% seems = homework.rates(:quality).where("rater_id = #{journal.user.id}").select("stars").first %>
-
<%= image_tag(url_to_avatar(journal.user), :class => "avatar") %>
- <%= link_to journal.user, user_path(journal.user)%>
+
+ <%= link_to journal.user, user_path(journal.user)%>
+
+
<% label = l(:label_contest_requirement) %>
<%= textilizable journal.notes%>
<%= l(:label_bids_published) %>
@@ -70,4 +85,12 @@
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/homework_attach/addjours.js.erb b/app/views/homework_attach/addjours.js.erb
index e463237e5..ed5887a7f 100644
--- a/app/views/homework_attach/addjours.js.erb
+++ b/app/views/homework_attach/addjours.js.erb
@@ -1,4 +1,9 @@
-$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false} )) %>');
-$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
-$('#new_form_user_message').val("");
-$('#new_form_reference_user_id').val("");
\ No newline at end of file
+<% if @add_jour.is_comprehensive_evaluation == 1 %>
+ $('#comprehensive_evaluation').html('<%= escape_javascript(render(:partial => 'comprehensive_evaluation',
+ :locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework} )) %>');
+<% else %>
+ $('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false,:homework => @homework} )) %>');
+ $('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
+ $('#new_form_user_message').val("");
+ $('#new_form_reference_user_id').val("");
+<% end %>
\ No newline at end of file
diff --git a/app/views/homework_attach/show.html.erb b/app/views/homework_attach/show.html.erb
index f2c37d9ac..9c39e84f1 100644
--- a/app/views/homework_attach/show.html.erb
+++ b/app/views/homework_attach/show.html.erb
@@ -6,6 +6,9 @@
height: 200px;
}
+<% is_student = is_cur_course_student? @homework.bid.courses.first %>
+<% is_teacher = is_course_teacher User.current,@homework.bid.courses.first %>
+
<%= notice %>
@@ -93,10 +96,14 @@
+ <% score = @homework.average(:quality).try(:avg).try(:round, 2).to_s %>
最终得分
- <%= @homework.average(:quality).try(:avg).try(:round, 2).to_s %>
- 分
+ <% if score == "" %>
+ 0分
+ <% else %>
+ <%= score %>分
+ <% end %>
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
@@ -114,42 +121,32 @@
-
+
+ <%= render :partial => 'comprehensive_evaluation', :locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework} %>
-
--->
+
作业评论:
- 评分:
- <%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
- (您可以重新打分,打分结果以最后一次打分为主!)
-
-
+ <% if is_student %>
+ 评分:
+ <%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
+ (您可以重新打分,打分结果以最后一次打分为主!)
+
+ <% end %>
+<% if !is_teacher %>
-
- <%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0} %>
+
+ <%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => nil} %>
+<% end %>
- <%= render :partial => 'showjour', :locals => {:jour => @jour} %>
-
-
-
-
diff --git a/db/migrate/20140527060344_add_coloum_to_homework_journals_for_message.rb b/db/migrate/20140527060344_add_coloum_to_homework_journals_for_message.rb
new file mode 100644
index 000000000..744a09d31
--- /dev/null
+++ b/db/migrate/20140527060344_add_coloum_to_homework_journals_for_message.rb
@@ -0,0 +1,5 @@
+class AddColoumToHomeworkJournalsForMessage < ActiveRecord::Migration
+ def change
+ add_column :journals_for_messages, :is_comprehensive_evaluation, :integer
+ end
+end
From 8227c5222a92e2da99435ecc3fc756f86093b146 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 28 May 2014 08:50:38 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=80=81=E5=B8=88?=
=?UTF-8?q?=E6=9C=AA=E8=BF=9B=E8=A1=8C=E7=BB=BC=E8=AF=84=E7=9A=84=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E8=BF=9B=E5=85=A5=E4=BA=92=E8=AF=84=E7=95=8C=E9=9D=A2?=
=?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../homework_attach/_comprehensive_evaluation.html.erb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/views/homework_attach/_comprehensive_evaluation.html.erb b/app/views/homework_attach/_comprehensive_evaluation.html.erb
index df0c03b21..e6ebacffe 100644
--- a/app/views/homework_attach/_comprehensive_evaluation.html.erb
+++ b/app/views/homework_attach/_comprehensive_evaluation.html.erb
@@ -1,13 +1,17 @@
<% is_teacher = is_course_teacher User.current,homework.bid.courses.first %>
<% if comprehensive_evaluation != nil && comprehensive_evaluation.count > 0 %>
- <% stars = homework.rates(:quality).where("rater_id = #{comprehensive_evaluation.first.user.id}").select("stars").first.stars * 2 * 10 %>
+ <% stars = homework.rates(:quality).where("rater_id = #{comprehensive_evaluation.first.user.id}").select("stars").first %>
作业综评:
-
+ <% if stars != nil %>
+
+ <% else %>
+
+ <% end %>
From 61135a352aefc03babc1371f88b587dab9b262d6 Mon Sep 17 00:00:00 2001
From: nwb
Date: Wed, 28 May 2014 14:43:20 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=94=AF=E6=8C=81=E6=B7=BB=E5=8A=A0=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E6=A0=87=E7=AD=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/files_controller.rb | 31 ++++++++++++++++++++++++++---
app/controllers/users_controller.rb | 2 +-
app/helpers/tags_helper.rb | 6 +++++-
app/views/attachments/upload.js.erb | 3 +--
app/views/files/_new.html.erb | 2 +-
app/views/tags/_tagEx.html.erb | 26 +++++++-----------------
config/routes.rb | 5 ++++-
db/schema.rb | 17 +++++++++-------
8 files changed, 57 insertions(+), 35 deletions(-)
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index f9236d0b7..5b81b7291 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -52,9 +52,14 @@ class FilesController < ApplicationController
end
def create
- if params[:tag_name]
+ if params[:add_tag]
+ @addTag=true
+ #render :back
tag_saveEx
- render :text =>"success"
+ #render :text =>"success"
+ respond_to do |format|
+ format.js
+ end
else
@addTag=false
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
@@ -64,7 +69,27 @@ class FilesController < ApplicationController
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.attachments_added(attachments[:files]).deliver
end
- redirect_to project_files_path(@project)
+
+ # 临时用
+ sort_init 'created_on', 'desc'
+ sort_update 'created_on' => "#{Attachment.table_name}.created_on",
+ 'filename' => "#{Attachment.table_name}.filename",
+ 'size' => "#{Attachment.table_name}.filesize",
+ 'downloads' => "#{Attachment.table_name}.downloads"
+
+ @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] #modify by Long Jun
+ @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
+
+ @attachtype = 0
+ @contenttype = 0
+
+ respond_to do |format|
+ format.js
+ format.html {
+ redirect_to project_files_path(@project)
+ }
+ end
+
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index cdecb97f8..840dabfe0 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -689,7 +689,7 @@ class UsersController < ApplicationController
end
def tag_saveEx
- @tags = params[:tag_name][:name]
+ @tags = params[:tag_name]
@obj_id = params[:obj_id]
@obj_flag = params[:obj_flag]
diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb
index ba2470fe9..201a582f2 100644
--- a/app/helpers/tags_helper.rb
+++ b/app/helpers/tags_helper.rb
@@ -49,5 +49,9 @@ module TagsHelper
end
return @result
end
-
+
+end
+
+def tagname_val
+ ("#tag_name_name").value
end
\ No newline at end of file
diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb
index 674d73b79..63600619b 100644
--- a/app/views/attachments/upload.js.erb
+++ b/app/views/attachments/upload.js.erb
@@ -12,6 +12,5 @@ fileSpan.find('a.remove-upload')
})
.off('click');
var divattach = fileSpan.find('div.div_attachments');
-divattach.html('<%#= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>');
-
+divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>');
<% end %>
diff --git a/app/views/files/_new.html.erb b/app/views/files/_new.html.erb
index a01143e0b..7dcf82e19 100644
--- a/app/views/files/_new.html.erb
+++ b/app/views/files/_new.html.erb
@@ -2,7 +2,7 @@
<% versions = project.versions.sort %>
<% attachmenttypes = project.attachmenttypes %>
<%= error_messages_for 'attachment' %>
-<%= form_tag(project_files_path(project), :multipart => true,:name=>"upload_form", :class => "tabular") do %>
+<%= form_tag(project_files_path(project), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %>
diff --git a/app/views/tags/_tagEx.html.erb b/app/views/tags/_tagEx.html.erb
index 08800caa1..3e7cd9c68 100644
--- a/app/views/tags/_tagEx.html.erb
+++ b/app/views/tags/_tagEx.html.erb
@@ -1,13 +1,3 @@
-
| |