diff --git a/Gemfile b/Gemfile index 711032123..9ba9eafd7 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ unless RUBY_PLATFORM =~ /w32/ gem 'nokogiri' end -gem 'simple_xlsx_reader' +#gem 'simple_xlsx_reader' gem 'wechat',path: 'lib/wechat' gem 'grack', path:'lib/grack' gem 'gitlab', path: 'lib/gitlab-cli' diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 8bfd88ffa..d33d211ae 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -36,7 +36,7 @@ class CoursesController < ApplicationController before_filter :require_login, :only => [:join, :unjoin] #before_filter :allow_join, :only => [:join] require 'bundler/setup' - require 'simple_xlsx_reader' + #require 'simple_xlsx_reader' # params[:search] 搜索课程的名称 # params[:select] "join" "create" "all" 参与的 创建的 所有的课程 @@ -978,23 +978,19 @@ class CoursesController < ApplicationController join_course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_id =? and status = ? and viewed =?", User.current.id, 'JoinCourse', @course.id, 1, 0) join_course_messages.update_all(:viewed => true) - if User.current.allowed_to?(:as_teacher,@course) - @member ||= @course.members.new - @role = params[:role] if params[:role] + @member ||= @course.members.new + @role = params[:role] if params[:role] - @teachers = searchTeacherAndAssistant(@course) - @teacher_count = @teachers.count - @student_count = studentCount(@course) - @no_group_count = @course.members.where(:course_group_id => 0).select{|m| m.roles.to_s.include?("Student")}.count - @apply_users = CourseMessage.where(:course_id => @course.id,:course_message_type => 'JoinCourseRequest', :status => 0) + @teachers = searchTeacherAndAssistant(@course) + @teacher_count = @teachers.count + @student_count = studentCount(@course) + @no_group_count = @course.members.where(:course_group_id => 0).select{|m| m.roles.to_s.include?("Student")}.count + @apply_users = CourseMessage.where(:course_id => @course.id,:course_message_type => 'JoinCourseRequest', :status => 0) - @curr_page = '成员管理' - respond_to do |format| - format.html { render :layout => 'base_edu_course' } - format.api { render_validation_errors(@course) } - end - else - render_403 + @curr_page = '成员管理' + respond_to do |format| + format.html { render :layout => 'base_edu_course' } + format.api { render_validation_errors(@course) } end end diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 7f26da079..182d355f4 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -349,7 +349,7 @@ class HomeworkCommonController < ApplicationController end @homework.save @homework_detail_manual.save - redirect_to student_work_index_path(:homework => @homework.id, :tab => 4) + redirect_to student_work_index_path(:homework => @homework.id) end def edit diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1df371b9b..9788e36ba 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -532,7 +532,7 @@ module ApplicationHelper when '评阅中' style = 'edu-filter-btn-green' when '已结束' - style = 'edu-filter-btn' + style = 'edu-filter-btn-end' when '已开启补交' style = 'edu-filter-btn-late' when '未开启补交' diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 5336ffd56..21acbdcb2 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -95,10 +95,10 @@ module CoursesHelper #生成课程老师成员链接 def course_teacher_link teacher_num - if User.current.allowed_to?(:as_teacher, @course) - link_to teacher_num, settings_course_path(@course, :tab => 'member'), :class => 'ml5 edu-cir-grey-q color-orange05', :id => 'teacher_number' - elsif User.current.member_of_course?(@course) - link_to teacher_num, course_member_path(@course, :role => 't'), :class => 'ml5 edu-cir-grey-q color-orange05', :id => 'teacher_number' + if User.current.allowed_to?(:as_teacher, @course) || User.current.member_of_course?(@course) + link_to teacher_num, members_course_path(@course), :class => 'ml5 edu-cir-grey-q color-orange05', :id => 'teacher_number' + # elsif User.current.member_of_course?(@course) + # link_to teacher_num, course_member_path(@course, :role => 't'), :class => 'ml5 edu-cir-grey-q color-orange05', :id => 'teacher_number' else content_tag 'span',teacher_num, :class => 'ml5 edu-cir-grey-q color-orange05' end @@ -106,10 +106,10 @@ module CoursesHelper #生成课程学生列表连接 def course_student_link student_num - if User.current.allowed_to?(:as_teacher, @course) - link_to "#{student_num}", settings_course_path(@course, :tab => 'member', :role => 'as'), :class => 'ml5 edu-cir-grey-q color-orange05', :id => 'student_number' - elsif (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) - link_to "#{student_num}", course_member_path(@course, :role => 'as'), :class => 'ml5 edu-cir-grey-q color-orange05', :id => "student_number" + if User.current.allowed_to?(:as_teacher, @course) || User.current.member_of_course?(@course) + link_to "#{student_num}", members_course_path(@course, :role => 'as'), :class => 'ml5 edu-cir-grey-q color-orange05', :id => 'student_number' + # elsif (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) + # link_to "#{student_num}", course_member_path(@course, :role => 'as'), :class => 'ml5 edu-cir-grey-q color-orange05', :id => "student_number" else content_tag 'span',student_num, :class => 'ml5 edu-cir-grey-q color-orange05' end @@ -117,10 +117,10 @@ module CoursesHelper # 生成分班列表连接 def course_group_link group_num - if User.current.allowed_to?(:as_teacher, @course) - link_to "#{group_num}", settings_course_path(@course, :tab => 'member', :role => @course.course_groups.first.id), :class => 'ml5 edu-cir-grey-q color-orange03', :id => 'group_number' - elsif (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) - link_to "#{group_num}", course_member_path(@course, :role => @course.course_groups.first.id), :class => 'ml5 edu-cir-grey-q color-orange03', :id => "group_number" + if User.current.allowed_to?(:as_teacher, @course) || User.current.member_of_course?(@course) + link_to "#{group_num}", members_course_path(@course, :role => @course.course_groups.first.id), :class => 'ml5 edu-cir-grey-q color-orange03', :id => 'group_number' + # elsif (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) + # link_to "#{group_num}", course_member_path(@course, :role => @course.course_groups.first.id), :class => 'ml5 edu-cir-grey-q color-orange03', :id => "group_number" else content_tag 'span',group_num, :class => 'ml5 edu-cir-grey-q color-orange05' end diff --git a/app/views/boards/_course_show_detail.html.erb b/app/views/boards/_course_show_detail.html.erb index 5930d76df..8b766d033 100644 --- a/app/views/boards/_course_show_detail.html.erb +++ b/app/views/boards/_course_show_detail.html.erb @@ -3,8 +3,4 @@ <%= javascript_include_tag "create_kindeditor" %> <% end %> -<% if @topics.count > 0 %> - <%= render :partial => 'users/course_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1} %> -<% else %> - <%= render :partial => "welcome/no_data" %> -<% end %> \ No newline at end of file +<%= render :partial => 'users/course_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1} %> diff --git a/app/views/courses/_course_activity_content.html.erb b/app/views/courses/_course_activity_content.html.erb index 91771c539..7e49d2868 100644 --- a/app/views/courses/_course_activity_content.html.erb +++ b/app/views/courses/_course_activity_content.html.erb @@ -1,4 +1,4 @@ -
+
<%= get_acts_list_type @type %>
diff --git a/app/views/courses/all_student_list.js.erb b/app/views/courses/all_student_list.js.erb index b17d198a1..a439657cb 100644 --- a/app/views/courses/all_student_list.js.erb +++ b/app/views/courses/all_student_list.js.erb @@ -1,4 +1,4 @@ -<% if params[:page] %> +<% if params[:page] || params[:search] %> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> $("#student_table_div").html("<%= j(render :partial => "courses/settings/student_table", :locals => {:is_teacher => is_teacher}) %>"); <% else %> diff --git a/app/views/courses/has_group_student_list.js.erb b/app/views/courses/has_group_student_list.js.erb index a9b65f5b3..4896db9dd 100644 --- a/app/views/courses/has_group_student_list.js.erb +++ b/app/views/courses/has_group_student_list.js.erb @@ -1,4 +1,4 @@ -<% if params[:page] %> +<% if params[:page] || params[:search] %> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> $("#student_table_div").html("<%= j(render :partial => "courses/settings/student_table", :locals => {:is_teacher => is_teacher}) %>"); <% else %> diff --git a/app/views/courses/no_group_student_list.js.erb b/app/views/courses/no_group_student_list.js.erb index 63c3e0e6d..662e8380b 100644 --- a/app/views/courses/no_group_student_list.js.erb +++ b/app/views/courses/no_group_student_list.js.erb @@ -1,4 +1,4 @@ -<% if params[:page] %> +<% if params[:page] || params[:search] %> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> $("#student_table_div").html("<%= j(render :partial => "courses/settings/student_table", :locals => {:is_teacher => is_teacher}) %>"); <% else %> diff --git a/app/views/courses/settings/_members.html.erb b/app/views/courses/settings/_members.html.erb index c3b9ef0e8..1c1806e00 100644 --- a/app/views/courses/settings/_members.html.erb +++ b/app/views/courses/settings/_members.html.erb @@ -1,3 +1,4 @@ +<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
    @@ -7,9 +8,11 @@
    @@ -33,10 +36,12 @@ diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 92b641741..425576ec6 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -9,13 +9,13 @@
    <% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %> -
    - <%= link_to '成员管理', members_course_path(@course), :class => "fl white-btn orange-btn", :style => "flex: 1;text-align: center;" %> - <%= link_to '发布普通作业', new_homework_common_path(:course => @course.id, :homework_type => 1), :class => "fl white-btn orange-btn ml20", :style => "flex: 1;text-align: center;" %> - <%= link_to '发布实训作业', shixuns_homework_common_index_path(:course => @course.id), :remote => true, :class => "fl white-btn orange-btn ml20", :style => "flex: 1;text-align: center;" %> - 发布资源 +
    + <%= link_to '成员管理', members_course_path(@course), :class => "fl white-btn orange-btn", :style => "flex: 1;text-align: center;height:32px;line-height:32px" %> + <%= link_to '发布普通作业', new_homework_common_path(:course => @course.id, :homework_type => 1), :class => "fl white-btn orange-btn ml20", :style => "flex: 1;text-align: center;height:32px;line-height:32px" %> + <%= link_to '发布实训作业', shixuns_homework_common_index_path(:course => @course.id), :remote => true, :class => "fl white-btn orange-btn ml20", :style => "flex: 1;text-align: center;height:32px;line-height:32px" %> + 发布资源 <% course_board = @course.boards.where("parent_id is NULL").first %> - <%= link_to '发布帖子', new_board_message_path(:board_id => course_board.id), :class => "fl white-btn orange-btn ml20", :style => "flex: 1;text-align: center;" %> + <%= link_to '发布帖子', new_board_message_path(:board_id => course_board.id), :class => "fl white-btn orange-btn ml20", :style => "flex: 1;text-align: center;height:32px;line-height:32px" %>
    <% end %>
    diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb index 8711c38f1..d46ccd01b 100644 --- a/app/views/files/_upload_course_files.erb +++ b/app/views/files/_upload_course_files.erb @@ -10,7 +10,7 @@ <%= error_messages_for 'attachment' %> - <%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:id=>"upload_course_file_form") do %> + <%= form_tag(course_files_path(course), :multipart => true,:id=>"upload_course_file_form") do %>
    -
    <%= comment.content_detail.html_safe %>
    +
    <%= comment.content_detail.html_safe %>
    <%= link_to comment.creator_user.show_real_name, user_url_in_org(comment.creator_user), :class => "content-username hide fl" %> @@ -77,9 +77,9 @@ <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>

    -
    -
    +
    +
    diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index abf73dfa3..c7e950c77 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -98,7 +98,7 @@ <% else %> <%= user_work_status @homework %> <% if @homework.homework_type == 4 && !@homework.student_works.where(:user_id => User.current.id, :work_status => 0).blank? %> - <%= link_to "开始实战", shixun_path(@homework.homework_commons_shixuns.shixun),:class => 'task-btn task-btn-blue fr mr10 mt8',:target => "_blank" %> + <%= link_to "开始实战", shixun_path(@homework.homework_commons_shixuns.shixun),:class => 'white-btn orange-btn fr mr10 mt8',:target => "_blank" %> <% end %> <%#= link_to "查看设置", setting_homework_common_path(@homework), :class => 'edu-btn fr mr10 mt8' %> <% end %> @@ -207,13 +207,13 @@
  • <% if @is_teacher %>
    - <%= link_to "导出成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :comment => @comment, :status => @status, :format => 'xls'),:class=>'fl mr5 white-btn orange-btn', :id => "export_student_work"%> + <%= link_to "导出成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :comment => @comment, :status => @status, :format => 'xls'),:class=>'fl mt8 mr5 white-btn orange-btn', :id => "export_student_work"%> <% if @homework.homework_type == 1 || @homework.homework_type == 3 %> <% if @stundet_works.empty?%> - <%= link_to "导出作品附件", "javascript:void(0)", class: "fl mr5 white-btn orange-btn", :onclick => "notice_box('该检索条件下没有作品,无法下载附件')" %> + <%= link_to "导出作品附件", "javascript:void(0)", class: "fl mt8 mr5 white-btn orange-btn", :onclick => "notice_box('该检索条件下没有作品,无法下载附件')" %> <% else%> <%= link_to "导出作品附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), - remote: true, class: "fl mr5 white-btn orange-btn download_homework_attachments" %> + remote: true, class: "fl mt8 mr5 white-btn orange-btn download_homework_attachments" %> <% end%> <% end %>
    @@ -228,8 +228,8 @@
  • - 你的评阅: - + 你的评阅: + 不限 <% has_comment = User.current.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count %> @@ -239,8 +239,8 @@
  • - 作品状态: - + 作品状态: + 不限 > @@ -251,8 +251,8 @@
  • - 分班情况: - + 分班情况: + 不限 <% @homework.course.course_groups.each do |group| %> diff --git a/app/views/users/_course_boardlist.html.erb b/app/views/users/_course_boardlist.html.erb index 74c6654ac..15f4bc394 100644 --- a/app/views/users/_course_boardlist.html.erb +++ b/app/views/users/_course_boardlist.html.erb @@ -1,4 +1,19 @@

    @@ -46,7 +48,8 @@

    - <% topics.each do |activity| %> + <% if @topics.count > 0 %> + <% topics.each do |activity| %>
    <%= link_to image_tag(url_to_avatar(activity.author), :width => "60", :height => "60", :class => "panel-list-img mr15"), user_path(activity.author), :alt => "用户",:style => "width:60px;height:60px;display: block;" %>
    @@ -77,6 +80,9 @@

    + <% end %> + <% else %> + <%= render :partial => "welcome/no_data" %> <% end %>
    diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 651c6f208..fc95d3ece 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -50,7 +50,7 @@ <% if User.current.logged? %>
  • <%= user.try(:login) %> <%= zh_course_role(h teacher.roles.where("name != 'Student'").first.name) %> - <% if User.current == @course.teacher && user.id == @course.tea_id %> - 更换管理员 - <% elsif user.id != @course.tea_id %> - 删除 + <% if is_teacher %> + <% if User.current == @course.teacher && user.id == @course.tea_id %> + 更换管理员 + <% elsif user.id != @course.tea_id %> + 删除 + <% end %> <% end %>