Sha256: 8b06d6c9ff1abe08a3647c2d38909f087bd9b3cf78bb2dda825fd1d1326da0f7

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

module ApplicationHelper
  include WithStudentPathNavigation

  # html-escapes an string even if it is html-safe
  def html_rescape(html)
    html_escape html.to_str
  end

  def profile_picture
    image_tag(current_user.profile_picture, 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 last_box_class(trailing_boxes)
    trailing_boxes ? '' : 'mu-last-box'
  end

  def corollary_box(with_corollary, trailing_boxes = false)
    if with_corollary.corollary.present?
      %Q{
        <div class="#{last_box_class trailing_boxes}">
          <p>#{with_corollary.corollary_html}</p>
        </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

6 entries across 6 versions & 1 rubygems

Version Path
mumuki-laboratory-7.6.2 app/helpers/application_helper.rb
mumuki-laboratory-7.6.1 app/helpers/application_helper.rb
mumuki-laboratory-7.6.0 app/helpers/application_helper.rb
mumuki-laboratory-7.5.2 app/helpers/application_helper.rb
mumuki-laboratory-7.5.1 app/helpers/application_helper.rb
mumuki-laboratory-7.5.0 app/helpers/application_helper.rb