From 243803cc5ea6153480df755adc4e506f9d230ebc Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 1 Nov 2014 16:19:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=202.=E4=BF=AE=E6=94=B9=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E6=9C=AA=E8=AF=84=E5=88=97=E8=A1=A8=E5=8F=AA=E8=83=BD=E7=82=B9?= =?UTF-8?q?=E8=B5=9E=203.=E5=AD=A6=E7=94=9F=E4=BF=AE=E6=94=B9=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E3=80=81=E5=88=9B=E5=BB=BA=E4=BD=9C=E5=93=81=E6=8A=A5?= =?UTF-8?q?=E9=94=99=204.=E5=A2=9E=E5=8A=A0=E7=82=B9=E8=B5=9E=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 1 + app/views/bids/_homework_list.html.erb | 2 +- .../homework_attach/_homeworks_list.html.erb | 6 ++-- app/views/homework_attach/edit.html.erb | 16 --------- app/views/homework_attach/new.html.erb | 34 ------------------ public/stylesheets/css.css | 4 +++ public/stylesheets/images/pic_zan.png | Bin 0 -> 1218 bytes 7 files changed, 10 insertions(+), 53 deletions(-) create mode 100644 public/stylesheets/images/pic_zan.png diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 8e57f9f2b..5b17271af 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -515,6 +515,7 @@ class BidsController < ApplicationController INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id}) AS table1 WHERE table1.m_score IS NULL") + @is_student_batch_homework = true end @homework_list = paginateHelper all_homework_list,10 diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index db61bf93d..81843479f 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -47,7 +47,7 @@
- <%= render :partial => 'homework_attach/homeworks_list', :locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => false}%> + <%= render :partial => 'homework_attach/homeworks_list', :locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => false, :is_student_batch_homework => @is_student_batch_homework}%>
diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index 53b384e2c..278155ce6 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -102,8 +102,10 @@ <% else %> -
  • - 点赞 +
  • + + + 15
  • <% end %> <% end %> diff --git a/app/views/homework_attach/edit.html.erb b/app/views/homework_attach/edit.html.erb index d122dfcf8..d7764f347 100644 --- a/app/views/homework_attach/edit.html.erb +++ b/app/views/homework_attach/edit.html.erb @@ -9,22 +9,6 @@ } -
    - - - - - - - - - - -
    高校课程实践社区<%= l(:label_user_location) %> :
    <%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index'%>

    <%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %> > - <%= link_to(@homework.bid.courses.first.name.to_s, homework_course_path(@homework.bid.courses.first)) if @homework.bid.courses.first%> > - <%=link_to(@homework.bid.name, respond_path(@homework.bid)) %> > <%= link_to "修改作业",edit_homework_attach_path(@homework)%>

    -
    -

    <%=raw l(:label_edit_homework)%>

    diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb new file mode 100644 index 000000000..6bf4128eb --- /dev/null +++ b/app/views/homework_attach/_homework.html.erb @@ -0,0 +1,81 @@ +
  • + <%= link_to image_tag(url_to_avatar(homework.user), :width => "40", :height => "40"), user_path(homework.user) %> + + <% user_realname = homework.user.lastname.to_s + homework.user.firstname.to_s %> + <% user_name = is_teacher ? (user_realname.empty? ? homework.user.login : user_realname) : homework.user.login %> + <%= link_to user_name, user_path(homework.user), :title => user_name %> + +
  • +
  • + <% if homework.name == nil || homework.name == "" %> + <% homework_filename = homework.user.name + "提交的作业" %> + <% else %> + <% homework_filename = homework.name %> + <% end %> + <%= link_to homework_filename , homework_attach_path(homework), :title => homework_filename, :remote => true%> +
  • +
  • + <%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%> +
  • +
  • + <%= l(:label_teacher_score)%>: + + <%= homework.t_score.nil? ? l(:label_without_score) : format("%.2f",homework.t_score)%> + +    +
  • +
  • + <%= l(:label_student_score)%>: + + <%= homework.s_score.nil? ? l(:label_without_score) : format("%.2f",homework.s_score) %> + +
  • +<% if is_teacher %> + +
  • + <%= link_to l(:label_work_rating),homework_attach_path(homework),:remote => true %> + <% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %> +   迟交! + <% end %> +
  • +<% else %> + + <% if is_my_homework %> + +
  • + <%= link_to l(:button_edit), edit_homework_attach_path(homework) %> + <% if homework.user == User.current || User.current.admin? %> + <%= link_to(l(:label_bid_respond_delete), homework, + method: :delete, :confirm => l(:text_are_you_sure), :remote => true ) %> + <% end %> +
  • + <% elsif is_student_batch_homework%> + +
  • + <%= link_to l(:label_work_rating),homework_attach_path(homework),:remote => true %> + <% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %> +   迟交! + <% end %> +
  • + <% else %> + + <% if is_praise_homework User.current.id,homework.id %> +
  • + <%= link_to "",praise_homework_homework_attach_path(homework,:is_my_homework => is_my_homework, + :is_student_batch_homework => is_student_batch_homework, + :is_teacher => is_teacher), + :class => "wzan_img wzan_visited", :remote => true%> + + <%= praise_homework_count homework.id %> + +
  • + <% else %> +
  • + + + <%= praise_homework_count homework.id %> + +
  • + <% end %> + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index 278155ce6..d03ca22b0 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -40,75 +40,10 @@ <% end %> <% homeworks.each do |homework| %> -