Sha256: 9219bcb3484a078ee491f0fe149be4a0cbf60e05a3262247ee0a7922191455c5

Contents?: true

Size: 966 Bytes

Versions: 8

Compression:

Stored size: 966 Bytes

Contents

module ExamsHelper
  def exam_information_for(user, exam)
    %Q{
      #{course_information_for(user, exam)}
      #{date_information_for(exam)}
      #{duration_information_for(exam)}
    }.html_safe
  end

  private

  def course_information_for(user, exam)
    if user.teacher_here?
      "#{fa_icon('graduation-cap', class: 'fa-fw',
                 text: "<strong>#{t :course}:</strong> #{exam.course.canonical_code}".html_safe)}
      <br>"
    end
  end

  def date_information_for(exam)
    "#{fa_icon('calendar-alt', class: 'fa-fw',
               text: "<strong>#{t :date_and_time}:</strong> #{local_time_without_time_zone(exam.start_time)} - #{local_time(exam.end_time)}".html_safe)}
    <br>"
  end

  def duration_information_for(exam)
    if exam.duration?
      "#{fa_icon(:stopwatch, class: 'fa-fw',
                 text: "<strong>#{t :available_time}:</strong> #{t :time_in_minutes, time: exam.duration}".html_safe)}
      <br>"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mumuki-laboratory-9.23.0 app/helpers/exams_helper.rb
mumuki-laboratory-9.22.0 app/helpers/exams_helper.rb
mumuki-laboratory-9.21.0 app/helpers/exams_helper.rb
mumuki-laboratory-9.20.1 app/helpers/exams_helper.rb
mumuki-laboratory-9.20.0 app/helpers/exams_helper.rb
mumuki-laboratory-9.19.0 app/helpers/exams_helper.rb
mumuki-laboratory-9.18.1 app/helpers/exams_helper.rb
mumuki-laboratory-9.18.0 app/helpers/exams_helper.rb