Module: ApplicationHelper

Includes:
WithStudentPathNavigation
Defined in:
app/helpers/application_helper.rb

Instance Method Summary collapse

Methods included from WithStudentPathNavigation

#next_button, #next_exercise_button, #next_lesson_button

Instance Method Details

#assistance_box(assignment) ⇒ Object



32
33
34
35
36
37
38
# File 'app/helpers/application_helper.rb', line 32

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

#chapter_finished(chapter) ⇒ Object



40
41
42
# File 'app/helpers/application_helper.rb', line 40

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

#contact_emailObject



4
5
6
# File 'app/helpers/application_helper.rb', line 4

def contact_email
  Organization.current.contact_email
end

#corollary_box(with_corollary) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'app/helpers/application_helper.rb', line 22

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

#page_title(subject) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/helpers/application_helper.rb', line 8

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

#paginate(object, options = {}) ⇒ Object



18
19
20
# File 'app/helpers/application_helper.rb', line 18

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

#span_toggle(hidden_text, active_text, active) ⇒ Object



44
45
46
47
48
49
# File 'app/helpers/application_helper.rb', line 44

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