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 %>
<% if from_course %> @@ -61,4 +63,5 @@ <% end %> <% end %> <% end %> +<% end %> <% end %> \ No newline at end of file diff --git a/app/views/homework_common/_homework_index_list.html.erb b/app/views/homework_common/_homework_index_list.html.erb index 865f7adf..ecb75520 100644 --- a/app/views/homework_common/_homework_index_list.html.erb +++ b/app/views/homework_common/_homework_index_list.html.erb @@ -62,6 +62,8 @@ <% end %> <%# elsif homework_common.homework_type != 4 %> <% else %> + + <% if false %> <% if had_commit_studentwork_count(homework_common) > 0 %> <%= link_to had_commit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id), :class => 'color-orange03 mr5', :target => '_blank' %> @@ -77,6 +79,7 @@ 未交 <% end %> + <% end %> <%# elsif homework_common.homework_type == 4 && homework_common.homework_commons_shixuns.shixun %> <%# had_passed_count = had_passed_changllenge_count(homework_common.homework_commons_shixuns.shixun, User.current) %> <%# challenge_count = homework_common.homework_commons_shixuns.shixun.challenges.count %> @@ -148,7 +151,7 @@
  • <%= link_to '立即发布', publish_notice_homework_common_path(homework_common), :remote => true %>
  • - <% elsif (homework_common.homework_detail_manual.try(:comment_status) == 1 || homework_common.homework_detail_manual.try(:comment_status) == 2) && homework_common.end_time > Time.now %> + <% elsif (homework_common.homework_detail_manual.try(:comment_status) == 1 || homework_common.homework_detail_manual.try(:comment_status) == 2) && homework_common.end_time.present? && homework_common.end_time > Time.now %>
  • <%= link_to '立即截止', end_notice_homework_common_path(homework_common), :remote => true %>
  • diff --git a/app/views/layouts/_board_children_list.html.erb b/app/views/layouts/_board_children_list.html.erb index 779b900a..c2cf3c71 100644 --- a/app/views/layouts/_board_children_list.html.erb +++ b/app/views/layouts/_board_children_list.html.erb @@ -1,13 +1,15 @@ <% course_board = @course.boards.where(:parent_id => 0).first %> -<% count = course_board ? course_board.messages.count : 0 %>
  • <% if course_module.module_name != course_board.name %> <% course_board.update_name(course_module.module_name) %> <% end %> <%= course_module.module_name %> - <% if count > 0 %> - <%= count %> + <% if is_teacher %> + <% count = course_board ? course_board.messages.count : 0 %> + <% if count > 0 %> + <%= count %> + <% end %> <% end %>
  • @@ -15,10 +17,12 @@
    <% end%> + <% end %> +

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

    @@ -63,6 +64,8 @@ <%= link_to "开始答题", poll_path(activity,:user_id => User.current.id), :class => "edu-activity-blue edu-filter-btn ml15 fl mt5" %> <% end %> <% end%> + <% end %> +

    <%= link_to activity.user.show_real_name, user_path(activity.user), :class => "color-grey-6 mr30" %>