diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8bb217cc..3d2960e7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -76,48 +76,59 @@ class ApplicationController < ActionController::Base # 包月+按license 9200109002 # 云启训练场(EduCoder))院校版 产品编码(appId) 9200109 - def ecloud_auth subject_id - # euser = EcloudUser.where("userid =? and opttype not in(3, 5)", User.current.id).first - # if euser.present? # 开通过业务 - # # 获取用户的套餐信息 - # e_service = euser.ecloud_services.where("opttype != 1") - # # 如果用户开通过服务 - # if e_service.present? - # if e_service.count >1 # 说明有重复开通过业务 - # else - # code = e_service.first.try(:code) - # - # end - # end - # else - # false # 没开通过服务,或者服务被禁用则不允许访问 - # end - # - # - # - # - # if e_service.count > 1 # 说明有重复订购过套餐 - # else - # code = e_service.try(:code) - # end - # service_count = euser.ecloud_services.where("opttype != 1").try(:code) - # - # end - # 如果不是Ecloud过来的用户,则不改变用户的使用状态及权限,按现有模式即可 + + # 如果不是Ecloud过来的用户,则不改变用户的使用状态及权限,按现有模式即可 + def ecloud_auth + euser = EcloudUser.where("userid =? and opttype not in(3, 5)", User.current.id).first + + if euser.present? # 开通过业务 + # 获取用户的套餐信息 + e_services = euser.ecloud_services.where("opttype != 1").order("ecloud_services.code desc") + # 如果用户开通过服务 + if e_services.present? + if e_services.count > 1 # 说明有重复开通过业务 + # 开通多业务的话,以最大的套餐排序,如果最大套餐还可以用,则直接返回true,如果最大套餐不能用,则轮询返回,直到找到可用的套餐 + e_services.each do |e_service| + # 使用期限内套餐才有效 + ecloud_services_auth(e_service.code, e_service.begintime, e_service.endtime) + end + else + # 先看套餐,再看时间区间 + e_service = e_services.first + ecloud_services_auth(e_service.code, e_service.begintime, e_service.endtime) + end + else + false # 没开通过服务,或者服务被禁用则不允许访问 + end + end end # 根据业务确定权限 - def ecloud_services_auth code, subject_id - subject = Subject.find(subject_id) - subject_level = subject.subject_level_system.try(:level) - # case code - # when "9200108001" - # subject_level.to_i == 1 ? true : false - # when "9200108002" - # - # end - # end - + def ecloud_services_auth code, begintime, endtime + # 如果当前实训不在实训课堂等级体系中,则不允许访问 + subject_id = @shixun.stage_shixuns.map(&:subject_id) + if subject_id.blank? + render_403 + end + subject_level = Subject.find(subject_id).subject_level_system.try(:level) + # 当前时间转毫秒 + current_time = DateTime.now.strftime('%Q').to_i + if current_time - begintime > 0 && endtime - current_time > 0 + case code + when "9200108001" + subject_level.to_i == 1 ? true : false + when "9200108002" + subject_level.to_i == 2 ? true : false + when "9200108003" + subject_level.to_i == 3 ? true : false + when "9200109001" # 企业用户 + subject_level.to_i < 3 ? true : false + when "9200109002" # 企业用户 + subject_level.to_i <= 3 ? true : false + end + else + false + end end diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 0c37a3ab..54f545e5 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -13,7 +13,7 @@ class ChallengesController < ApplicationController skip_before_filter :verify_authenticity_token, :only => [:create_choose_question, :update_choose_question] #before_filter :find_shixun_language, :only => [:show, :new, :edit] before_filter :base_index, :only => [:index, :index_down, :index_up, :destroy] - before_filter :view_allow, :only => [:index, :show] + before_filter :view_allow, :only => [:show] include ApplicationHelper diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 4d249508..6d58fa8a 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -4060,28 +4060,30 @@ end def shixun_feedback_xls shixun_ids xls_report = StringIO.new book = Spreadsheet::Workbook.new - sheet1 = book.create_worksheet :name => "报名列表" + sheet1 = book.create_worksheet :name => "实训反馈" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue count_row = 1 shixuns = Shixun.where(:id => shixun_ids).includes(discusses: [:user]) - sheet1.row(0).concat(["序号", "实训ID", "实训名称","评论数", "评论内容", "关卡", "评论者", "评论者职业", + sheet1.row(0).concat(["序号", "实训ID", "实训名称", "实训作者", "作者单位", "评论数", "评论内容", "关卡", "评论者", "评论者职业", "评论者单位", "评论时间", "社区导师是否已回复"]) shixuns.each_with_index do |shixun, i| discusses = shixun.discusses.where("user_id != ?", 1) sheet1[count_row, 0] = i + 1 sheet1[count_row, 1] = shixun.identifier sheet1[count_row, 2] = shixun.name - sheet1[count_row, 3] = discusses.count + sheet1[count_row, 3] = shixun.owner.show_real_name + sheet1[count_row, 4] = shixun.owner.school_name + sheet1[count_row, 5] = discusses.count discusses.each_with_index do |discuss, j| user = discuss.user - sheet1[count_row, 4] = discuss.content.gsub(//, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】") - sheet1[count_row, 5] = "第#{discuss.position}关" - sheet1[count_row, 6] = user.show_real_name - sheet1[count_row, 7] = user.identity - sheet1[count_row, 8] = user.school_name - sheet1[count_row, 9] = format_time discuss.created_at - sheet1[count_row, 10] = discuss.children.pluck(:user_id).include?(1) ? "是" : "否" + sheet1[count_row, 6] = discuss.content.gsub(//, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】") + sheet1[count_row, 7] = "第#{discuss.position}关" + sheet1[count_row, 8] = user.show_real_name + sheet1[count_row, 9] = user.identity + sheet1[count_row, 10] = user.school_name + sheet1[count_row, 11] = format_time discuss.created_at + sheet1[count_row, 12] = discuss.children.pluck(:user_id).include?(1) ? "是" : "否" count_row += 1 end #count_row += 1 diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index e50827e3..18107cae 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -2,13 +2,16 @@ # REDO: 创建版本库权限控制 class ShixunsController < ApplicationController layout 'base_shixun' - before_filter :require_login, :except => [:ghook, :download_file] - before_filter :check_authentication, :except => [:ghook, :download_file] + before_filter :require_login, :except => [:ghook, :download_file, :show, :index] + before_filter :check_authentication, :except => [:ghook, :download_file, :show, :index] before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search, :shixun_courses, :new_disscuss, :shixun_migrate, :qrcode, :download_file, :departments, :get_mirror_script, :send_message_to_administrator] + skip_before_filter :verify_authenticity_token, :only => [:ghook, :download_file] - before_filter :view_allow, :only => [:show, :collaborators, :propaedeutics, :shixun_discuss, :ranking_list] + before_filter :view_allow, :only => [:collaborators, :propaedeutics, :shixun_discuss, :ranking_list] before_filter :require_manager, :only => [ :settings, :add_script, :publish, :collaborators_delete, :shixun_members_added, :add_collaborators, :update, :destroy] before_filter :validation_email, :only => [:new] + # 移动云ToC模式权限控制 + # before_filter :ecloud_auth, :except => [:show, :index] include ApplicationHelper include ShixunsHelper diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 3191899c..e526d468 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -1,8 +1,8 @@ # encoding: utf-8 class SubjectsController < ApplicationController layout 'base_subject' - before_filter :require_login, :except => [:show] - before_filter :check_authentication, :except => [:show] + before_filter :require_login, :except => [:show, :index] + before_filter :check_authentication, :except => [:show, :index] before_filter :find_subject, :except => [:index, :new, :create, :create_subject, :new_subject, :append_to_stage, :send_to_course] include ApplicationHelper diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2a4402b7..611b7803 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -54,7 +54,7 @@ class UsersController < ApplicationController accept_api_auth :index, :show, :create, :update, :destroy, :tag_save, :tag_saveEx #william - before_filter :require_login, :only => [:tag_save, :tag_saveEx] + before_filter :require_login, :only => [:tag_save, :tag_saveEx, :search_user_course, :search_user_project] #before_filter :refresh_changests, :only =>[:user_activities,:user_courses,:user_projects,:user_newfeedback] #visitor diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3d980718..79732e10 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -340,15 +340,11 @@ module ApplicationHelper # TPM查看权限 # result一般为页面权限 def shixun_view_allow shixun, result = nil - if params[:openi].to_i == 1 + if User.current.manager_of_shixun?(shixun) result ? false : true else - if User.current.manager_of_shixun?(shixun) - result ? false : true - else - if shixun.status == 0 || (shixun.use_scope == 1 && !shixun.schools.map(&:name).include?(User.current.school_name)) - result ? true : (render_403) - end + if shixun.status == 0 || (shixun.use_scope == 1 && !shixun.schools.map(&:name).include?(User.current.school_name)) + result ? true : (render_403) end end end @@ -619,7 +615,7 @@ module ApplicationHelper redirect_to user_info_path() Rails.logger.info("check_authentication end") return - elsif User.current.certification != 1 + elsif User.current.certification != 1 # 系统没有授权 day_cer = UserDayCertification.where(:user_id => User.current.id).last unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 redirect_to my_account_path() diff --git a/app/models/ecloud_serviece_servicepara.rb b/app/models/ecloud_serviece_servicepara.rb index 91bb0a0d..5dbff71f 100644 --- a/app/models/ecloud_serviece_servicepara.rb +++ b/app/models/ecloud_serviece_servicepara.rb @@ -1,3 +1,4 @@ +# ket值,license表示人数,对应企业版;duration表示月数,对应个人版; class EcloudServieceServicepara < ActiveRecord::Base attr_accessible :key, :value, :ecloud_service_id belongs_to :ecloud_service diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 41fdfc64..6e239e5d 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -5,7 +5,7 @@
  • "><%= link_to "实训课程", subjects_path %>
  • "><%= link_to "翻转课堂", courses_path %>
  • -
  • "><%= link_to "开发社区", shixuns_path %>
  • +
  • "><%= link_to "开发社区", shixuns_path %>
  • <% careers = Career.published.order("created_at asc") %> <% if careers.present? %> diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index fb1e901e..d970fffc 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -3,16 +3,14 @@
      -
    • <%= link_to "实训课程", subjects_path %>
    • -
    • <%= link_to "翻转课堂", courses_path %>
    • +
    • "><%= link_to "实训课程", subjects_path %>
    • +
    • "><%= link_to "翻转课堂", courses_path %>
    • + +
    • "><%= link_to "开发社区", shixuns_path %>
    • -
    • - <%= link_to "开发社区", shixuns_path %> - -
    • <% careers = Career.published.order("created_at asc") %> <% if careers.present? %> -
    • +
    • " style="cursor: auto;">

      职业路径

        <% careers.each do |career| %> @@ -21,8 +19,8 @@
    • <% end %> -
    • <%= link_to "竞赛", competitions_path %>
    • -
    • <%= link_to "问答", forums_path %>
    • +
    • "><%= link_to "竞赛", competitions_path %>
    • +
    • "><%= link_to "问答", forums_path %>
    \ No newline at end of file +
    + \ No newline at end of file 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" %> +
    -