Sha256: 69d6a7a0735d5eb6001a831422c8ea8d6a860154470ee13f169ffe945b45e426

Contents?: true

Size: 1.31 KB

Versions: 30

Compression:

Stored size: 1.31 KB

Contents

module AssignmentResultHelper
  def solution_download_link(assignment)
    link_to fa_icon(:download, text: t(:download)),
            solution_octet_data(assignment),
            download: solution_filename(assignment) if assignment.exercise.upload?
  end

  def community_link
    Organization.current.community_link
  end

  def community_link?
    community_link.present?
  end

  def render_community_link
    if community_link?
      link_to fa_icon(:facebook, text: I18n.t(:ask_community), class: 'fa-fw'), community_link, target: '_blank'
    end
  end

  def report_bug_link(assignment, organization=Organization.current)
    if organization.report_issue_enabled?
      mail_to contact_email,
        fa_icon(:bug, text: t(:notify_problem_with_exercise), class: 'fa-fw'),
        subject: t(:problem_with_exercise, title: @exercise.name),
        body: assignment_help_email_body(assignment),
        class: 'warning'
    end
  end

  def manual_evaluation_comment(assignment)
    if assignment.manual_evaluation_comment?
      Mumukit::ContentType::Markdown.to_html assignment.manual_evaluation_comment
    end
  end

  private

  def solution_octet_data(assignment)
    "data:application/octet-stream,#{URI.encode assignment.solution}"
  end

  def solution_filename(assignment)
    "solution.#{assignment.extension}"
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
mumuki-laboratory-6.1.5 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.0.4 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.1.4 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.1.3 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.0.3 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.1.2 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.1.1 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.1.0 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.0.2 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.0.1 app/helpers/assignment_result_helper.rb
mumuki-laboratory-6.0.0 app/helpers/assignment_result_helper.rb
mumuki-laboratory-5.13.0 app/helpers/assignment_result_helper.rb
mumuki-laboratory-5.12.1 app/helpers/assignment_result_helper.rb
mumuki-laboratory-5.12.0 app/helpers/assignment_result_helper.rb
mumuki-laboratory-5.11.0 app/helpers/assignment_result_helper.rb
mumuki-laboratory-5.10.4 app/helpers/assignment_result_helper.rb
mumuki-laboratory-5.10.3 app/helpers/assignment_result_helper.rb
mumuki-laboratory-5.10.2 app/helpers/assignment_result_helper.rb
mumuki-laboratory-5.10.1 app/helpers/assignment_result_helper.rb
mumuki-laboratory-5.10.0 app/helpers/assignment_result_helper.rb