diff --git a/app/views/poll/student_poll_list.html.erb b/app/views/poll/student_poll_list.html.erb index d454fba3..2e570bc3 100644 --- a/app/views/poll/student_poll_list.html.erb +++ b/app/views/poll/student_poll_list.html.erb @@ -5,167 +5,163 @@ SearchByName_poll(); } } - - $(function () { - - });
-

- <%= link_to @course.name, course_path(@course),:class => "color-grey-9" %> > <%= link_to "问卷列表", poll_index_path(:course_id => @course.id),:class => "color-grey-9" %> > - #<%= get_poll_index(@poll, @course, @is_teacher) + 1 %> -

-
-

- <% unless @poll.is_public %> - - <% end %> - <%= @poll.polls_name %> +

+ <%= link_to @course.name, course_path(@course),:class => "color-grey-9" %> > <%= link_to "问卷列表", poll_index_path(:course_id => @course.id),:class => "color-grey-9" %> > + #<%= get_poll_index(@poll, @course, @is_teacher) + 1 %>

- <%= link_to "返回", poll_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %> -
-
+
+

+ <% unless @poll.is_public %> + + <% end %> + <%= @poll.polls_name %> +

+ <%= link_to "返回", poll_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %> +
+
  • 答题列表
  • <% if @is_teacher || (@poll.show_result == 1 && @poll.polls_status == 3) %> -
  • - 统计结果 -
  • +
  • + 统计结果 +
  • <% end %> <% if @is_teacher %> -
  • - 问卷内容 -
  • -
  • - 设置 -
  • - <% if @poll.polls_status > 1 %> - <%= link_to "导出统计", export_poll_poll_path(@poll, :course_id => @course.id, :format => 'xls'), :id => "export_poll_work", :class => "fr white-btn orange-btn mt10 ml15" %> - <% end %> - <% if @poll.polls_status < 3 %> - <%= link_to "编辑问卷", edit_poll_path(@poll, :course_id => @course.id), :class => "fr white-btn orange-btn mt10 ml15" %> - <% end %> - <% if @poll.polls_status == 1 || @poll.poll_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %> - <%= link_to '立即发布', publish_notice_poll_path(@poll), :remote => true, :class => "white-btn orange-btn fr ml15 mt10" %> - <% end %> - <% if (@poll.polls_status == 2 && @poll.end_time > Time.now) || @poll.poll_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %> - <%= link_to '立即截止', end_notice_poll_path(@poll), :remote => true, :class => "white-btn orange-btn fr ml15 mt10" %> - <% end %> - <% if @poll.polls_status == 2 %> - 撤销发布 - <% end %> +
  • + 问卷内容 +
  • +
  • + 设置 +
  • + <% if @poll.polls_status > 1 %> + <%= link_to "导出统计", export_poll_poll_path(@poll, :course_id => @course.id, :format => 'xls'), :id => "export_poll_work", :class => "fr white-btn orange-btn mt10 ml15" %> + <% end %> + <% if @poll.polls_status < 3 %> + <%= link_to "编辑问卷", edit_poll_path(@poll, :course_id => @course.id), :class => "fr white-btn orange-btn mt10 ml15" %> + <% end %> + <% if @poll.polls_status == 1 || @poll.poll_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %> + <%= link_to '立即发布', publish_notice_poll_path(@poll), :remote => true, :class => "white-btn orange-btn fr ml15 mt10" %> + <% end %> + <% if (@poll.polls_status == 2 && @poll.end_time > Time.now) || @poll.poll_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %> + <%= link_to '立即截止', end_notice_poll_path(@poll), :remote => true, :class => "white-btn orange-btn fr ml15 mt10" %> + <% end %> + <% if @poll.polls_status == 2 %> + 撤销发布 + <% end %> <% else %> -
  • - 查看设置 -
  • - <% if User.current.member_of_course?(@poll.course) %> -

    - <% poll_user = @poll.poll_users.where(:user_id => User.current).first %> - <% member = @poll.course.members.where(:user_id => User.current.id).first %> - <% setting_time = poll_group_setting @poll, member.try(:course_group) %> - <% if poll_user %> - <% if poll_user.commit_status > 0 %> - <%= link_to '查看答题', poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %> - <% elsif setting_time.publish_time < Time.now && setting_time.end_time > Time.now %> - <%= link_to (poll_user.start_at.nil? ? "开始答题" : "继续答题"), poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %> - <% end %> - <% elsif setting_time.publish_time < Time.now && setting_time.end_time > Time.now %> - <%= link_to "开始答题", poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %> - <% end %> -

    - <% end %> +
  • + 查看设置 +
  • + <% if User.current.member_of_course?(@poll.course) %> +

    + <% poll_user = @poll.poll_users.where(:user_id => User.current).first %> + <% member = @poll.course.members.where(:user_id => User.current.id).first %> + <% setting_time = poll_group_setting @poll, member.try(:course_group) %> + <% if poll_user %> + <% if poll_user.commit_status > 0 %> + <%= link_to '查看答题', poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %> + <% elsif setting_time.publish_time < Time.now && setting_time.end_time > Time.now %> + <%= link_to (poll_user.start_at.nil? ? "开始答题" : "继续答题"), poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %> + <% end %> + <% elsif setting_time.publish_time < Time.now && setting_time.end_time > Time.now %> + <%= link_to "开始答题", poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %> + <% end %> +

    + <% end %> <% end %>
-
+
<% if @is_teacher %> -
-
  • - - <% poll_curr_status = poll_curr_time @poll %> - <% if poll_curr_status[:status] != "" %> - <%= poll_curr_status[:status] %> - <% end %> - - <% if @poll.try(:polls_status) == 1 && @poll.publish_time %> - 将于 <%= format_time(@poll.publish_time).to_s %> 发布 - <% else %> - <%= poll_curr_status[:time] %> - <% end %> -
  • - - -
      +
    • - 答题状态: - - 不限 - - > - - > - + + <% poll_curr_status = poll_curr_time @poll %> + <% if poll_curr_status[:status] != "" %> + <%= poll_curr_status[:status] %> + <% end %> + + <% if @poll.try(:polls_status) == 1 && @poll.publish_time %> + 将于 <%= format_time(@poll.publish_time).to_s %> 发布 + <% else %> + <%= poll_curr_status[:time] %> + <% end %>
    • -
    • - 分班情况: - - 不限 - -
      - <% if @group_teacher %> - <% groups = @course.course_groups.where(:id => @member.teacher_course_groups.pluck(:course_group_id)) %> - <% else %> - <% groups = @course.course_groups %> - <% end %> - <% groups.each do |group| %> - > - - <% end %> - <% if !@group_teacher %> - - - <% end %> + + +
        +
      • + 答题状态: + + 不限 + + /> + + /> + +
      • +
      • + 分班情况: + + 不限 + +
        + <% if @group_teacher %> + <% groups = @course.course_groups.where(:id => @member.teacher_course_groups.pluck(:course_group_id)) %> + <% else %> + <% groups = @course.course_groups %> + <% end %> + <% groups.each do |group| %> + /> + + <% end %> + <% if !@group_teacher %> + + + <% end %> +
        +
      • +
      +
    • +
      +
      + + + × +
      +
    • -
    -
  • -
    -
    - - - × -
    - -
    -
  • -
    + <% elsif User.current.member_of_course?(@poll.course) %> - -
    -

    - <% poll_user = @poll.poll_users.where(:user_id => User.current).first %> - <% if poll_user %> - <% if poll_user.commit_status > 0 %> - 你已提交 - <% else %> - 你未提交 + +

    +

    + <% poll_user = @poll.poll_users.where(:user_id => User.current).first %> + <% if poll_user %> + <% if poll_user.commit_status > 0 %> + 你已提交 + <% else %> + 你未提交 + <% end %> <% end %> - <% end %> -

    +

    -

    - (<%= @has_commit_count %>人已交) - <% if @poll.polls_status == 2 && @poll.end_time > Time.now %> - <% end_time = @poll.end_time.to_time.to_i %> - 答题剩余时间:<%= (end_time - Time.now.to_i) / (24 * 60 * 60) %><%= ((end_time - Time.now.to_i) % (24 * 60 * 60)) / (60 * 60) %>小时<%= (((end_time - Time.now.to_i) % (24 * 60 * 60)) % (60 * 60)) / 60 %> - <% elsif @poll.polls_status == 3 %> - 提交已截止 - <% end %> -

    -
    +

    + (<%= @has_commit_count %>人已交) + <% if @poll.polls_status == 2 && @poll.end_time > Time.now %> + <% end_time = @poll.end_time.to_time.to_i %> + 答题剩余时间:<%= (end_time - Time.now.to_i) / (24 * 60 * 60) %><%= ((end_time - Time.now.to_i) % (24 * 60 * 60)) / (60 * 60) %>小时<%= (((end_time - Time.now.to_i) % (24 * 60 * 60)) % (60 * 60)) / 60 %> + <% elsif @poll.polls_status == 3 %> + 提交已截止 + <% end %> +

    +
    <% end %>
    @@ -196,71 +192,71 @@
    <% @poll.poll_questions.includes(:poll_answers).each_with_index do |poll_question, i| %> -
    -
    -

    - <% if poll_question.try(:is_necessary) == 1 %> - * - <% end %> - 第<%= poll_question.question_number %> - 题:[<%= poll_question.question_type_name %>] - <% if poll_question.question_type == 2 && (poll_question.min_choices != 0 || poll_question.max_choices != 0) %> - 可选 <%= poll_question.min_choices %> - <%= poll_question.max_choices %> 项 - <% end %> -

    -
    -
    <%= poll_question.question_title.html_safe %>
    - <% case poll_question.question_type %> - <% when 1 %> -
    - <% poll_answers = poll_question.poll_answers %> - <% poll_answers.each_with_index do |poll_answer, index| %> -
  • - <% if poll_answer.answer_text != '' %> - - - <% else %> - - - - - - <% end %> -
  • - <% end %> +
    +
    +

    + <% if poll_question.try(:is_necessary) == 1 %> + * + <% end %> + 第<%= poll_question.question_number %> + 题:[<%= poll_question.question_type_name %>] + <% if poll_question.question_type == 2 && (poll_question.min_choices != 0 || poll_question.max_choices != 0) %> + 可选 <%= poll_question.min_choices %> - <%= poll_question.max_choices %> 项 + <% end %> +

    - <% when 2 %> -
    - <% poll_answers = poll_question.poll_answers %> - <% poll_answers.each_with_index do |poll_answer, index| %> -
  • - <% if poll_answer.answer_text != '' %> - - - <% else %> - - - - - +
    <%= poll_question.question_title.html_safe %>
    + <% case poll_question.question_type %> + <% when 1 %> +
    + <% poll_answers = poll_question.poll_answers %> + <% poll_answers.each_with_index do |poll_answer, index| %> +
  • + <% if poll_answer.answer_text != '' %> + + + <% else %> + + + + + + <% end %> +
  • <% end %> - - <% end %> -
    - <% when 3 %> -
    - -
    - <% end %> -
    +
    + <% when 2 %> +
    + <% poll_answers = poll_question.poll_answers %> + <% poll_answers.each_with_index do |poll_answer, index| %> +
  • + <% if poll_answer.answer_text != '' %> + + + <% else %> + + + + + + <% end %> +
  • + <% end %> +
    + <% when 3 %> +
    + +
    + <% end %> +
    <% end %>
    -
    - <%= render :partial => "poll_setting" %> +
    + <%= render :partial => "poll_setting" %> +
    -