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" %>