From ba742cd9109b68ded56688362451fde0c978472a Mon Sep 17 00:00:00 2001 From: z9hang Date: Sun, 2 Nov 2014 13:18:59 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=AF=84=E5=88=86=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E7=9A=84=E7=95=99=E8=A8=80=E9=83=A8=E5=88=86=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/_addjour.html.erb | 22 +++++++-------------- app/views/homework_attach/_show.html.erb | 15 +++++++------- public/stylesheets/css.css | 2 +- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/app/views/homework_attach/_addjour.html.erb b/app/views/homework_attach/_addjour.html.erb index fae799a93..2519f6a15 100644 --- a/app/views/homework_attach/_addjour.html.erb +++ b/app/views/homework_attach/_addjour.html.erb @@ -63,27 +63,19 @@ <% if User.current.logged? %> - - - - -
<%= f.text_area 'user_message', :rows => 3, :cols => 65, :value => "#{l(:label_leave_a_message)}", - :onfocus => "clearInfo('new_form_user_message','#{l(:label_leave_a_message)}')", - :onblur => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')", - :style => "resize: none;", :class => 'noline'%>
+ <%= f.text_area 'user_message', :rows => 3, :cols => 65, + :style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250)%> <%= f.text_field :reference_user_id, :style=>"display:none"%> - - - - -
<%= submit_tag l(:button_leave_meassge), +
+ <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%> - <%= submit_tag l(:button_clear_meassge), :name => nil, :class => "enterprise", + <%= submit_tag l(:button_clear_meassge), :name => nil, :class => "enterprise", :onclick => "clearMessage('new_form_user_message');", :onmouseout => "this.style.backgroundPosition = 'left top'", - :onmouseover => "this.style.backgroundPosition = 'left -31px'" %>
+ :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> + <% else %>
<%= l(:label_user_login_tips) %> diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb index c432d4f3f..51853cd23 100644 --- a/app/views/homework_attach/_show.html.erb +++ b/app/views/homework_attach/_show.html.erb @@ -3,7 +3,7 @@ function g(o){return document.getElementById(o);} function HoverLi(n){ //如果有N个标签,就将i<=N; - for(var i=1;i<=2;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab'; + for(var i=3;i<=4;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab'; } //如果要做成点击后再转到请将
  • 中的onmouseover 改成 onclick; //]]> @@ -53,23 +53,24 @@ <%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
  • - - 提交评论 + <%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => nil} %> +
      -
    • +
    • 全部评论(30
    • -
    • +
    • 教师评论(30
    -
    +
    @@ -135,7 +136,7 @@
    -
    +
    diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index e401b59da..25b720bfc 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -112,7 +112,7 @@ a:hover.ping_sub{ background:#14a8b9;} .ping_C{border-bottom:1px dashed #CCC; padding:5px;} .ping_dispic a{ display:block; height:46px; width:46px; border:1px solid #CCC; padding:1px; float:left;} .ping_dispic img{ height:46px; width:46px;} -.ping_discon{ float:left; width:384px; margin-left:15px;} +.ping_discon{ float:left; width:372px; margin-left:15px;} .ping_distop span{ float:left;} .ping_distop p{ color:#5f5f5f;} .ping_disfoot a{ float:right; color:#15bccf; margin-left:5px;} From cb87d6337cef48cd81ba86d4c34007c69f0c5288 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sun, 2 Nov 2014 14:41:41 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=95=99=E8=A8=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 23 +++++++++- app/models/journals_for_message.rb | 1 + app/views/homework_attach/_show.html.erb | 43 ++++++++++++++++--- config/locales/en.yml | 4 +- config/locales/zh.yml | 2 + 5 files changed, 65 insertions(+), 8 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 917040170..61a06ece6 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -366,16 +366,35 @@ class HomeworkAttachController < ApplicationController #是否开启互评功能 @is_evaluation = @homework.bid.is_evaluation == 1 || @homework.bid.is_evaluation == nil @limit = 10 - @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation is null").order("created_on DESC") + #@jours留言 is null条件用以兼容历史数据 + @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") @feedback_count = @jours.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @offset ||= @feedback_pages.offset @jour = @jours[@offset, @limit] - @comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation is not null").order("created_on DESC") + #@comprehensive_evaluation教师评论 + @comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1").order("created_on DESC") + #@anonymous_comments 匿评 + @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2").order("created_on DESC") @totle_score = score_for_homework @homework @teaher_score = teacher_score_for_homework @homework + is_student = is_cur_course_student @homework.bid.courses.first + is_teacher = is_course_teacher User.current,@homework.bid.courses.first + is_anonymous_comments = true #是否开启了匿评 + if !User.current.member_of_course?(@homework.bid.courses.first) + @is_comprehensive_evaluation = 3 #留言 + elsif is_student && is_anonymous_comments #是学生且开启了匿评 + @is_comprehensive_evaluation = 2 #匿评 + elsif is_student && !is_anonymous_comments #是学生未开启匿评 + @is_comprehensive_evaluation = 3 #留言 + elsif is_teacher + @is_comprehensive_evaluation = 1 #教师评论 + else + @is_comprehensive_evaluation = 3 + end + respond_to do |format| format.html format.js diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 20e0c15f4..4819cd253 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -14,6 +14,7 @@ class JournalsForMessage < ActiveRecord::Base "is_readed", # 留言是否已读 "m_reply_count", # 留言的回复数量 "m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id) + "is_comprehensive_evaluation" # 1 教师评论、2 匿评、3 留言 acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC" belongs_to :project, diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb index 51853cd23..28b1cc0e8 100644 --- a/app/views/homework_attach/_show.html.erb +++ b/app/views/homework_attach/_show.html.erb @@ -3,7 +3,7 @@ function g(o){return document.getElementById(o);} function HoverLi(n){ //如果有N个标签,就将i<=N; - for(var i=3;i<=4;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab'; + for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab'; } //如果要做成点击后再转到请将
  • 中的onmouseover 改成 onclick; //]]> @@ -62,10 +62,12 @@
      -
    • - 全部评论(30
    • - 教师评论(30
    • + <%= l(:label_teacher_comments) %>(30) +
    • + <%= l(:label_anonymous_comments) %>(30
    • +
    • + <%= l(:label_responses) %>(30
    @@ -153,9 +155,40 @@
  • +
    +
    +
    +
    +
    + gugu012014-10-24评分: +
    +

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,多了,或者

    +
    + + + +
    +
    +
    +
    +
    +
    +
    + gugu012014-10-24评分: +
    +

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,多了,或者

    +
    + + + +
    +
    +
    +
    -
    +
    +
    \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 8a07284ba..a8d85efed 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1847,4 +1847,6 @@ en: label_max_length: A maximum of 250 characters label_create_person: Create personnel label_participation_person: The participation of personnel - label_homework_without_description: The homework without any description! \ No newline at end of file + label_homework_without_description: The homework without any description! + label_teacher_comments: Teacher comments + label_anonymous_comments: Anonymous comments \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3df099ef5..3b7c8e7db 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2179,3 +2179,5 @@ zh: label_create_person: 创建人员 label_participation_person: 参与人员 label_homework_without_description: 该作业无任何描述! + label_teacher_comments: 教师评论 + label_anonymous_comments: 匿评 \ No newline at end of file From 8e4f55253aeb453b37ffae6f8e2896123c74f468 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sun, 2 Nov 2014 16:15:14 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=AF=84=E5=88=86=E7=95=99=E8=A8=80?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/_history.erb | 2 +- app/views/homework_attach/_jour.html.erb | 24 ++++ app/views/homework_attach/_show.html.erb | 136 ++++--------------- app/views/homework_attach/_showjour.html.erb | 6 +- 4 files changed, 53 insertions(+), 115 deletions(-) create mode 100644 app/views/homework_attach/_jour.html.erb diff --git a/app/views/homework_attach/_history.erb b/app/views/homework_attach/_history.erb index 6897ef6b5..299ba1aa5 100644 --- a/app/views/homework_attach/_history.erb +++ b/app/views/homework_attach/_history.erb @@ -19,7 +19,7 @@
    - <%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%>2014-10-24 + <%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%><%= journal.created_on %>

    <%= textilizable journal.notes%>

    diff --git a/app/views/homework_attach/_jour.html.erb b/app/views/homework_attach/_jour.html.erb new file mode 100644 index 000000000..7e2bf8eee --- /dev/null +++ b/app/views/homework_attach/_jour.html.erb @@ -0,0 +1,24 @@ +
    + +
    +
    + <%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%><%= jour.created_on %>评分: +
    +

    <%= textilizable jour.notes%>

    +
    +
    + <% ids = 'project_respond_form_'+ jour.id.to_s%> + + <%= link_to l(:label_projects_feedback_respond),'', + {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{jour.user.name}: '); $('##{ids} textarea') ;return false;"} + %> + <% if jour.user==User.current|| User.current.admin? %> + <%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour', :object_id => jour, :user_id => jour.user}, + :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %> + <% 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 28b1cc0e8..b23c98823 100644 --- a/app/views/homework_attach/_show.html.erb +++ b/app/views/homework_attach/_show.html.erb @@ -1,3 +1,5 @@ +<% reply_allow = JournalsForMessage.create_by_user? User.current %> +