From 39dee9d928553aee3c957b12e6834de30cc51ee7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 16 Apr 2019 10:42:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=B7=E5=B7=A5=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 8 +- app/views/boards/update_position.js.erb | 3 +- app/views/courses/_course_activity.html.erb | 4 +- .../graduation_tasks/_task_status.html.erb | 3 + .../_homework_index_list.html.erb | 5 +- .../layouts/_board_children_list.html.erb | 16 +- .../layouts/_group_children_list.html.erb | 24 +- app/views/layouts/base_courses.html.erb | 67 +++-- app/views/users/_course_exercise.html.erb | 3 + .../users/_course_graduation_topic.html.erb | 2 + app/views/users/_course_homework.html.erb | 254 +++++++++--------- app/views/users/_course_message.html.erb | 4 + app/views/users/_course_poll.html.erb | 11 +- 13 files changed, 228 insertions(+), 176 deletions(-) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 7aba1442..2329db0f 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -326,14 +326,16 @@ class BoardsController < ApplicationController end def update_position - if @course || @contest + if @course + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + boards = @board.parent.children - if params[:opr] == 'up' && @board.position > 1 + if @is_teacher && params[:opr] == 'up' && @board.position > 1 before_board = boards.where("position = #{@board.position - 1}").first if before_board && @board.update_attribute('position', @board.position - 1) before_board.update_attribute('position', before_board.position + 1) end - elsif params[:opr] == 'down' && @board.position < boards.count + elsif @is_teacher && params[:opr] == 'down' && @board.position < boards.count after_board = boards.where("position = #{@board.position + 1}").first if after_board && @board.update_attribute('position', @board.position + 1) after_board.update_attribute('position', after_board.position - 1) diff --git a/app/views/boards/update_position.js.erb b/app/views/boards/update_position.js.erb index bd7ee8fd..cba7203d 100644 --- a/app/views/boards/update_position.js.erb +++ b/app/views/boards/update_position.js.erb @@ -1,7 +1,8 @@ <% if @course %> $("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>"); <% course_board = @course.boards.where(:parent_id => 0).first %> -$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>"); +$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => + {:course_board => course_board, :is_teacher => @is_teacher})%>"); <% elsif @contest %> $("#game-setting-content-3").html("<%=escape_javascript(render :partial => 'contests/boards') %>"); <% contest_board = @contest.boards.where(:parent_id => 0).first %> diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index 89187650..19eab902 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -32,7 +32,9 @@ <%= render :partial => 'users/course_create', :locals => {:activity => activity.course_act, :user_activity_id => activity.id, :is_course => 1} if activity.course_act %> <% when 'JoinCourse' %> <% act = CourseMessage.where(:id => activity.course_act_id).first %> - <%= render :partial => 'users/join_course', :locals => {:activity => act, :user_activity_id => activity.id} %> + <% if act.present? %> + <%= render :partial => 'users/join_course', :locals => {:activity => act, :user_activity_id => activity.id} %> + <% end %> <% end %> <% end %> <% end %> diff --git a/app/views/graduation_tasks/_task_status.html.erb b/app/views/graduation_tasks/_task_status.html.erb index 2f0a0b3b..90cd813b 100644 --- a/app/views/graduation_tasks/_task_status.html.erb +++ b/app/views/graduation_tasks/_task_status.html.erb @@ -1,6 +1,8 @@ <%= render :partial => "graduation_tasks/task_tag", :locals => {:task => task} %> <% from_course = defined?(is_course) ? true : false %> + +<% if false %> <% if @is_teacher %>
<%= link_to activity.user.show_real_name, user_path(activity.user), :class => "color-grey-6 mr30" %> diff --git a/app/views/users/_course_graduation_topic.html.erb b/app/views/users/_course_graduation_topic.html.erb index 1f4b5723..e107fa28 100644 --- a/app/views/users/_course_graduation_topic.html.erb +++ b/app/views/users/_course_graduation_topic.html.erb @@ -13,6 +13,7 @@ 已确认 <% end %> + <% if false %> <% if @is_teacher %>
<%= link_to activity.teacher.show_real_name, user_path(activity.teacher), :class => "color-grey-6 mr30" %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 5f521117..23c10229 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -25,115 +25,91 @@ <% end %> <% end %> - <% if @is_teacher %> - <% comment_status = activity.homework_detail_manual.try(:comment_status) %> -
<%= link_to activity.author.show_real_name, user_path(activity.author), :class => "color-grey-6 mr30" %> diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index 4ec07679..33077b2c 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -10,12 +10,13 @@ <% end %> <% if @is_teacher || !User.current.member_of_course?(activity.course) %> - <% ex_curr_status = poll_curr_time activity %> - <% if ex_curr_status[:status] != "" %> - <%= ex_curr_status[:status] %> - <% end %> + <% ex_curr_status = poll_curr_time activity %> + <% if ex_curr_status[:status] != "" %> + <%= ex_curr_status[:status] %> <% end %> + <% end %> + <% if false %> <% if @is_teacher %>
<%= link_to activity.user.show_real_name, user_path(activity.user), :class => "color-grey-6 mr30" %>