Sha256: cad8f2b2cb9ec3dbd99db61e7ebfd2bb180d079147a9a3d413379a49cbc2dce5

Contents?: true

Size: 1.43 KB

Versions: 13

Compression:

Stored size: 1.43 KB

Contents

module ApplicationHelper
  include WithStudentPathNavigation

  def contact_email
    Organization.current.contact_email
  end

  def page_title(subject)
    name = "Mumuki#{Organization.current.title_suffix}"

    if subject && !subject.new_record?
      "#{subject.friendly} - #{name}"
    else
      "#{name} - #{t :mumuki_catchphrase}"
    end
  end

  def profile_picture
    image_tag(current_user.image_url, height: 40, class: 'img-circle', onError: "this.onerror = null; this.src = '#{image_url('user_shape.png')}'")
  end

  def paginate(object, options={})
    "<div class=\"text-center\">#{super(object, {theme: 'twitter-bootstrap-3'}.merge(options))}</div>".html_safe
  end

  def corollary_box(with_corollary)
    if with_corollary.corollary.present?
      %Q{
      <div class="corollary-box">
        <p>#{with_corollary.corollary_html}</p>
      </div>
}.html_safe
    end
  end

  def assistance_box(assignment)
    if assignment.tips.present?
      %Q{<div class="mu-tips-box">
        #{Mumukit::Assistant::Narrator.random.compose_explanation_html assignment.tips}
      </div>}.html_safe
    end
  end

  def chapter_finished(chapter)
    t :chapter_finished_html, chapter: link_to_path_element(chapter) if chapter
  end

  def span_toggle(hidden_text, active_text, active)
    %Q{
      <span class="#{'hidden' if active}">#{hidden_text}</span>
      <span class="#{'hidden' unless active}">#{active_text}</span>
    }.html_safe
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mumuki-laboratory-5.12.1 app/helpers/application_helper.rb
mumuki-laboratory-5.12.0 app/helpers/application_helper.rb
mumuki-laboratory-5.11.0 app/helpers/application_helper.rb
mumuki-laboratory-5.10.4 app/helpers/application_helper.rb
mumuki-laboratory-5.10.3 app/helpers/application_helper.rb
mumuki-laboratory-5.10.2 app/helpers/application_helper.rb
mumuki-laboratory-5.10.1 app/helpers/application_helper.rb
mumuki-laboratory-5.10.0 app/helpers/application_helper.rb
mumuki-laboratory-5.9.1 app/helpers/application_helper.rb
mumuki-laboratory-5.9.0 app/helpers/application_helper.rb
mumuki-laboratory-5.8.3 app/helpers/application_helper.rb
mumuki-laboratory-5.8.1 app/helpers/application_helper.rb
mumuki-laboratory-5.8.0 app/helpers/application_helper.rb